diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt deleted file mode 100755 index 481d086..0000000 --- a/application/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -#=============================================================================== -# @brief cmake make file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(battery) -add_subdirectory_if_exist(brandy_demo) -add_subdirectory_if_exist(charger) -add_subdirectory_if_exist(dut) -add_subdirectory_if_exist(monitor) -add_subdirectory_if_exist(ota) -add_subdirectory_if_exist(samples) -add_subdirectory_if_exist(ux) -add_subdirectory_if_exist(wstp) -add_subdirectory_if_exist(cfbb) - -if("${CHIP}" STREQUAL "socmn1") - add_subdirectory_if_exist(melody) -else() - add_subdirectory_if_exist(${CHIP}) -endif() - -if("${CHIP}" STREQUAL "socmn1" OR "${CHIP}" STREQUAL "brandy") - add_subdirectory_if_exist(audio) -endif() - -add_subdirectory_if_exist(wearable) diff --git a/application/samples/bt/CMakeLists.txt b/application/samples/bt/CMakeLists.txt deleted file mode 100755 index 28ecd9f..0000000 --- a/application/samples/bt/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_SAMPLE) - add_subdirectory_if_exist(ble) -endif() -if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_SAMPLE) - add_subdirectory_if_exist(sle) -endif() - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/Kconfig b/application/samples/bt/Kconfig deleted file mode 100755 index 85305f0..0000000 --- a/application/samples/bt/Kconfig +++ /dev/null @@ -1,21 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -choice - prompt "Sample" - -config SAMPLE_SUPPORT_BLE_SAMPLE - bool "Support BLE Sample." - -if SAMPLE_SUPPORT_BLE_SAMPLE -osource "application/samples/bt/ble/Kconfig" -endif - -config SAMPLE_SUPPORT_SLE_SAMPLE - bool "Support SLE Sample." - -if SAMPLE_SUPPORT_SLE_SAMPLE -osource "application/samples/bt/sle/Kconfig" -endif -endchoice \ No newline at end of file diff --git a/application/samples/bt/ble/CMakeLists.txt b/application/samples/bt/ble/CMakeLists.txt deleted file mode 100755 index 5a2249d..0000000 --- a/application/samples/bt/ble/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_GATT_CLIENT_SAMPLE) - add_subdirectory_if_exist(ble_gatt_client) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_GATT_SERVER_SAMPLE) - add_subdirectory_if_exist(ble_gatt_server) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_SPEED_SERVER_SAMPLE) - add_subdirectory_if_exist(ble_speed_server) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_SPEED_CLIENT_SAMPLE) - add_subdirectory_if_exist(ble_speed_client) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLE_CFG_SAMPLE) - add_subdirectory_if_exist(ble_wifi_cfg_client) - add_subdirectory_if_exist(ble_wifi_cfg_server) -endif() - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/Kconfig b/application/samples/bt/ble/Kconfig deleted file mode 100755 index 37b21b9..0000000 --- a/application/samples/bt/ble/Kconfig +++ /dev/null @@ -1,24 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== - -choice - prompt "BLE Sample" - -config SAMPLE_SUPPORT_BLE_GATT_CLIENT_SAMPLE - bool "Support BLE GATT Client Sample." - -config SAMPLE_SUPPORT_BLE_GATT_SERVER_SAMPLE - bool "Support BLE GATT Server Sample." - -config SAMPLE_SUPPORT_BLE_SPEED_SERVER_SAMPLE - bool "Support BLE Throughput Server Sample." - -config SAMPLE_SUPPORT_BLE_SPEED_CLIENT_SAMPLE - bool "Support BLE Throughput Client Sample" - -config SAMPLE_SUPPORT_BLE_CFG_SAMPLE - bool "Support BLE WIFI CFG Sample" - -endchoice \ No newline at end of file diff --git a/application/samples/bt/ble/ble_gatt_client/CMakeLists.txt b/application/samples/bt/ble/ble_gatt_client/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/ble/ble_gatt_client/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_gatt_client/inc/ble_gatt_client.h b/application/samples/bt/ble/ble_gatt_client/inc/ble_gatt_client.h deleted file mode 100755 index 2dbb792..0000000 --- a/application/samples/bt/ble/ble_gatt_client/inc/ble_gatt_client.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: BT GATT Client Moudle. - */ - -/** - * @defgroup bluetooth_bts_hid_server HID SERVER API - * @ingroup - * @{ - */ -#ifndef BLE_GATT_CLIENT_H -#define BLE_GATT_CLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @if Eng - * @brief Use this funtion to init gatt client. - * @par Description:init gatt client. - * @attention NULL - * @param NULL - * @retval error code. - * @else - * @brief 初始化gatt 客户端。 - * @par 说明:初始化gatt 客户端。 - * @attention NULL - * @param NULL - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_gatt_client_init(void); - -/** - * @if Eng - * @brief discover all service, character and descriptor of remote device. - * @par Description:discover all service of remote device. - * @attention NULL - * @param conn_id connection ID - * @retval error code. - * @else - * @brief 发现对端设备所有服务、特征和描述符。 - * @par 说明:发现对端设备所有服务、特征和描述符。 - * @attention NULL - * @param conn_id 连接 ID - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id); - -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/bt/ble/ble_gatt_client/src/CMakeLists.txt b/application/samples/bt/ble/ble_gatt_client/src/CMakeLists.txt deleted file mode 100755 index d54b6a0..0000000 --- a/application/samples/bt/ble/ble_gatt_client/src/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/ble_gatt_client.c" PARENT_SCOPE) diff --git a/application/samples/bt/ble/ble_gatt_client/src/ble_gatt_client.c b/application/samples/bt/ble/ble_gatt_client/src/ble_gatt_client.c deleted file mode 100755 index 1776ef5..0000000 --- a/application/samples/bt/ble/ble_gatt_client/src/ble_gatt_client.c +++ /dev/null @@ -1,277 +0,0 @@ -#include "osal_list.h" -#include "bts_le_gap.h" -#include "bts_gatt_client.h" -#include "soc_osal.h" -#include "app_init.h" -#include "securec.h" -#include "common_def.h" - -#define UUID16_LEN 2 -#define DEFAULT_SCAN_INTERVAL 0x48 - -/* client id, invalid client id is "0" */ -uint8_t g_client_id = 0; -/* client app uuid for test */ -static bt_uuid_t g_client_app_uuid = {UUID16_LEN, {0}}; - -errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id); - -static void ble_gatt_client_discover_service_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_service_result_t *service, errcode_t status) -{ - gattc_discovery_character_param_t param = {0}; - osal_printk("[GATTClient]Discovery service----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" start handle:%d end handle:%d uuid_len:%d\n uuid:", - service->start_hdl, service->end_hdl, service->uuid.uuid_len); - for (uint8_t i = 0; i < service->uuid.uuid_len; i++) { - osal_printk("%02x", service->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); - param.service_handle = service->start_hdl; - param.uuid.uuid_len = 0; /* uuid length is zero, discover all character */ - gattc_discovery_character(g_client_id, conn_id, ¶m); -} - -static void ble_gatt_client_discover_character_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_result_t *character, errcode_t status) -{ - osal_printk("[GATTClient]Discovery character----client:%d conn_id:%d uuid_len:%d\n uuid:", - client_id, conn_id, character->uuid.uuid_len); - for (uint8_t i = 0; i < character->uuid.uuid_len; i++) { - osal_printk("%02x", character->uuid.uuid[i]); - } - osal_printk("\n declare handle:%d value handle:%d properties:%x\n", character->declare_handle, - character->value_handle, character->properties); - osal_printk(" status:%d\n", status); - gattc_discovery_descriptor(g_client_id, conn_id, character->declare_handle); -} - -static void ble_gatt_client_discover_descriptor_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_descriptor_result_t *descriptor, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, descriptor->uuid.uuid_len); - for (uint8_t i = 0; i < descriptor->uuid.uuid_len; i++) { - osal_printk("%02x", descriptor->uuid.uuid[i]); - } - osal_printk("\n descriptor handle:%d\n", descriptor->descriptor_hdl); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_service_compl_cbk(uint8_t client_id, uint16_t conn_id, bt_uuid_t *uuid, - errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery service complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, uuid->uuid_len); - for (uint8_t i = 0; i < uuid->uuid_len; i++) { - osal_printk("%02x", uuid->uuid[i]); - } - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_character_compl_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_param_t *param, errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery character complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n service handle:%d\n", param->service_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_descriptor_compl_cbk(uint8_t client_id, uint16_t conn_id, - uint16_t character_handle, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" charatcer handle:%d\n", character_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_read_cfm_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, - gatt_status_t status) -{ - osal_printk("[GATTClient]Read result----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", read_result->handle, read_result->data_len); - for (uint8_t i = 0; i < read_result->data_len; i++) { - osal_printk("%02x", read_result->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_read_compl_cbk(uint8_t client_id, uint16_t conn_id, gattc_read_req_by_uuid_param_t *param, - errcode_t status) -{ - osal_printk("[GATTClient]Read by uuid complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("start handle:%d end handle:%d uuid len:%d\n uuid:", - param->start_hdl, param->end_hdl, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_write_cfm_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status) -{ - osal_printk("[GATTClient]Write result----client:%d conn_id:%d handle:%d\n", client_id, conn_id, handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_mtu_changed_cbk(uint8_t client_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - osal_printk("[GATTClient]Mtu changed----client:%d conn_id:%d mtu size:%d\n", client_id, conn_id, - mtu_size); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_notification_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - osal_printk("[GATTClient]Receive notification----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("handle:%d data_len:%d\ndata:", data->handle, data->data_len); - for (uint8_t i = 0; i < data->data_len; i++) { - osal_printk("%02x", data->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_indication_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - osal_printk("[GATTClient]Receive indication----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", data->handle, data->data_len); - for (uint8_t i = 0; i < data->data_len; i++) { - osal_printk("%02x", data->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_scan_result_cbk(gap_scan_result_data_t *scan_result_data) -{ - uint8_t ble_mac[BD_ADDR_LEN] = {0x63, 0x38, 0xce, 0xad, 0x38, 0x63}; - if (memcmp(scan_result_data->addr.addr, ble_mac, BD_ADDR_LEN) == 0) { - osal_printk("Find The Target Device.\n"); - gap_ble_stop_scan(); - bd_addr_t client_addr = { 0 }; - client_addr.type = scan_result_data->addr.type; - if (memcpy_s(client_addr.addr, BD_ADDR_LEN, scan_result_data->addr.addr, BD_ADDR_LEN) != EOK) { - osal_printk("%s add server app addr memcpy failed\r\n", __FUNCTION__); - return; - } - gap_ble_connect_remote_device(&client_addr); - } else { - osal_printk("\naddr:"); - for (uint8_t i = 0; i < BD_ADDR_LEN; i++) { - osal_printk(" %02x:", scan_result_data->addr.addr[i]); - } - } -} - -static void ble_gatt_client_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *addr, - gap_ble_conn_state_t conn_state, gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - osal_printk("%s connect state change conn_id: %d, status: %d, pair_status:%d, disc_reason %x\n", - __FUNCTION__, conn_id, conn_state, pair_state, disc_reason); - - if (conn_state == GAP_BLE_STATE_CONNECTED) { - gap_ble_pair_remote_device(addr); - } -} - -static void ble_gatt_client_pair_result_cbk(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - unused(addr); - osal_printk("%s pair result conn_id: %d,status: %d \n", __FUNCTION__, conn_id, status); - - ble_gatt_client_discover_all_service(conn_id); -} - -static void ble_gatt_client_conn_param_update_cbk(uint16_t conn_id, errcode_t status, - const gap_ble_conn_param_update_t *param) -{ - osal_printk("%s conn_param_update conn_id: %d,status: %d \n", __FUNCTION__, conn_id, status); - osal_printk("interval:%d latency:%d timeout:%d.\n", param->interval, param->latency, param->timeout); -} - -errcode_t ble_gatt_client_callback_register(void) -{ - errcode_t ret = ERRCODE_BT_UNHANDLED; - gap_ble_callbacks_t gap_cb = {0}; - gap_cb.scan_result_cb = ble_gatt_client_scan_result_cbk; - gap_cb.conn_state_change_cb = ble_gatt_client_conn_state_change_cbk; - gap_cb.pair_result_cb = ble_gatt_client_pair_result_cbk; - gap_cb.conn_param_update_cb = ble_gatt_client_conn_param_update_cbk; - ret |= gap_ble_register_callbacks(&gap_cb); - - gattc_callbacks_t cb = {0}; - cb.discovery_svc_cb = ble_gatt_client_discover_service_cbk; - cb.discovery_svc_cmp_cb = ble_gatt_client_discover_service_compl_cbk; - cb.discovery_chara_cb = ble_gatt_client_discover_character_cbk; - cb.discovery_chara_cmp_cb = ble_gatt_client_discover_character_compl_cbk; - cb.discovery_desc_cb = ble_gatt_client_discover_descriptor_cbk; - cb.discovery_desc_cmp_cb = ble_gatt_client_discover_descriptor_compl_cbk; - cb.read_cb = ble_gatt_client_read_cfm_cbk; - cb.read_cmp_cb = ble_gatt_client_read_compl_cbk; - cb.write_cb = ble_gatt_client_write_cfm_cbk; - cb.mtu_changed_cb = ble_gatt_client_mtu_changed_cbk; - cb.notification_cb = ble_gatt_client_notification_cbk; - cb.indication_cb = ble_gatt_client_indication_cbk; - ret |= gattc_register_callbacks(&cb); - return ret; -} - -errcode_t ble_cliant_start_scan(void) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - gap_ble_scan_params_t ble_device_scan_params = { 0 }; - ble_device_scan_params.scan_interval = DEFAULT_SCAN_INTERVAL; - ble_device_scan_params.scan_window = DEFAULT_SCAN_INTERVAL; - ble_device_scan_params.scan_type = 0x00; - ble_device_scan_params.scan_phy = GAP_BLE_PHY_2M; - ble_device_scan_params.scan_filter_policy = 0x00; - ret |= gap_ble_set_scan_parameters(&ble_device_scan_params); - ret |= gap_ble_start_scan(); - return ret; -} - -errcode_t ble_gatt_client_init(void) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - ret |= enable_ble(); - ret |= ble_gatt_client_callback_register(); - ret |= gattc_register_client(&g_client_app_uuid, &g_client_id); - printf("ble_gatt_client_init, ret:%x.\n", ret); - ret |= ble_cliant_start_scan(); - printf("ble_cliant_start_scan, ret:%x.\n", ret); - return ret; -} - -errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - bt_uuid_t service_uuid = {0}; /* uuid length is zero, discover all service */ - ret |= gattc_discovery_service(g_client_id, conn_id, &service_uuid); - return ret; -} - -#define BLE_UUID_CLIENT_TASK_PRIO 24 -#define BLE_UUID_CLIENT_STACK_SIZE 0x2000 - -static void ble_uuid_client_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)ble_gatt_client_init, 0, "ble_gatt_client", - BLE_UUID_CLIENT_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, BLE_UUID_CLIENT_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(ble_uuid_client_entry); \ No newline at end of file diff --git a/application/samples/bt/ble/ble_gatt_server/CMakeLists.txt b/application/samples/bt/ble/ble_gatt_server/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/ble/ble_gatt_server/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_gatt_server/inc/ble_gatt_server.h b/application/samples/bt/ble/ble_gatt_server/inc/ble_gatt_server.h deleted file mode 100755 index aab7931..0000000 --- a/application/samples/bt/ble/ble_gatt_server/inc/ble_gatt_server.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: BLE UUID Server module. - */ - -/** - * @defgroup bluetooth_bts_hid_server HID SERVER API - * @ingroup - * @{ - */ -#ifndef BLE_UUID_SERVER_H -#define BLE_UUID_SERVER_H - -#include "bts_def.h" - -/* Service UUID */ -#define BLE_UUID_UUID_SERVER_SERVICE 0xABCD -/* Characteristic UUID */ -#define BLE_UUID_UUID_SERVER_REPORT 0xCDEF -/* Client Characteristic Configuration UUID */ -#define BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION 0x2902 -/* Server ID */ -#define BLE_UUID_SERVER_ID 1 - -/* Characteristic Property */ -#define UUID_SERVER_PROPERTIES (GATT_CHARACTER_PROPERTY_BIT_READ | GATT_CHARACTER_PROPERTY_BIT_NOTIFY) - -/** - * @if Eng - * @brief BLE uuid server inir. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE UUID服务器初始化。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_init(void); - -/** - * @if Eng - * @brief send data to peer device by uuid on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_send_report_by_uuid(const uint8_t *data, uint8_t len); - -/** - * @if Eng - * @brief send data to peer device by handle on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len); - -#endif - diff --git a/application/samples/bt/ble/ble_gatt_server/inc/ble_server_adv.h b/application/samples/bt/ble/ble_gatt_server/inc/ble_server_adv.h deleted file mode 100755 index 052a6d3..0000000 --- a/application/samples/bt/ble/ble_gatt_server/inc/ble_server_adv.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * - * Description: BLE ADV Config. - */ - -/** - * @defgroup bluetooth_bts_ble_adv API - * @ingroup - * @{ - */ -#ifndef BLE_SERVER_ADV_H -#define BLE_SERVER_ADV_H - -#include "bts_def.h" - -/* Ble Adv type Flag length */ -#define BLE_ADV_FLAG_LEN 0x03 -/* Ble Adv data length */ -#define BLE_GENERAL_BYTE_1 1 -/* Ble Adv appearance length */ -#define BLE_ADV_APPEARANCE_LENGTH 4 -/* Ble Adv appearance type */ -#define BLE_ADV_APPEARANCE_DATA_TYPE 0x19 -/* Ble keyboard appearance type */ -#define BLE_ADV_CATEGORY_KEYBOARD_VALUE 0x0080 -/* Ble keyboard categorylength */ -#define BLE_ADV_CATEGORY_LEN 2 -/* Ble name adv param type length */ -#define BLE_ADV_PARAM_DATATYPE_LENGTH 1 -/* Ble name adv name type */ -#define BLE_ADV_LOCAL_NAME_DATA_TYPE 0x09 -/* Ble name adv tx power type */ -#define BLE_ADV_TX_POWER_LEVEL 0x0A -/* Ble name adv tx power response type */ -#define BLE_SCAN_RSP_TX_POWER_LEVEL_LEN 0x03 -/* Ble adv flag data */ -#define BLE_ADV_FLAG_DATA 0x05 - -/** - * @if Eng - * @brief Definitaion of BLE ADV data flag. - * @else - * @brief BLE 广播数据类型定义。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv data flag length. - @else 广播数据类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv data type. - @else 广播数据类型 */ - uint8_t flags; /*!< @if Eng adv data flag. - @else 广播数据标志 */ -} ble_adv_flag; - -/** - * @if Eng - * @brief Definitaion of BLE device appearance struct. - * @else - * @brief BLE 广播设备外观结构。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv appearance data length. - @else 设备外观数据类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv appearance data type. - @else 设备外观数据类型 */ - uint8_t catogory_id[BLE_ADV_CATEGORY_LEN]; /*!< @if Eng adv appearance data. - @else 设备外观数据 */ -} ble_appearance_st; - -/** - * @if Eng - * @brief Definitaion of BLE device name. - * @else - * @brief BLE 广播设备名称。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv device name length. - @else 广播设备名称类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv name data type. - @else 设备名称类型 */ - int8_t *name; /*!< @if Eng adv name data. - @else 设备名称数据指针 */ -} ble_local_name_st; - -/** - * @if Eng - * @brief Definitaion of BLE Tx power. - * @else - * @brief BLE 广播发送功率。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv tx power length. - @else 广播发送功率长度 */ - uint8_t adv_data_type; /*!< @if Eng adv tx power type. - @else 广播发送数据类型 */ - uint8_t tx_power_value; /*!< @if Eng adv tx power value. - @else 广播发送数据 */ -} ble_tx_power_level_st; - -/** - * @if Eng - * @brief Definitaion value range for typedef struct ble_adv_para.adv_filter_policy. - * @else - * @brief Ble adv filter policy定义值范围。 - * @endif - */ -typedef enum ble_adv_filter_policy { - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY = 0x00, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_ANY = 0x01, - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_WHITE_LIST = 0x02, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_WHITE_LIST = 0x03 -} ble_adv_filter_policy_t; - -/** - * @if Eng - * @brief Definitaion value range for adv type. - * @else - * @brief Ble adv 类型范围。 - * @endif - */ -typedef enum ble_adverting_type { - BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED = 0x00, - BLE_ADV_TYPE_CONNECTABLE_HIGH_DUTY_CYCLE_DIRECTED = 0x01, - BLE_ADV_TYPE_SCANNABLE_UNDIRECTED = 0x02, - BLE_ADV_TYPE_NON_CONNECTABLE_UNDIRECTED = 0x03, - BLE_ADV_TYPE_CONNECTABLE_LOW_DUTY_CYCLE_DIRECTED = 0x04 -} ble_adverting_type_t; - - -/** - * @if Eng - * @brief Definitaion value range for adv channel map. - * @else - * @brief Ble 广播信道范围。 - * @endif - */ -typedef enum ble_adv_channel_map { - BLE_ADV_CHANNEL_MAP_CH_37 = 0x01, - BLE_ADV_CHANNEL_MAP_CH_38 = 0x02, - BLE_ADV_CHANNEL_MAP_CH_39 = 0x04, - BLE_ADV_CHANNEL_MAP_CH_37_CH_38 = 0x03, - BLE_ADV_CHANNEL_MAP_CH_37_CH_39 = 0x05, - BLE_ADV_CHANNEL_MAP_CH_38_CH_39 = 0x06, - BLE_ADV_CHANNEL_MAP_CH_DEFAULT = 0x07 -} ble_adv_channel_map_t; - -/** - * @if Eng - * @brief Definitaion value range for adv addr type. - * @else - * @brief Ble 广播地址类型。 - * @endif - */ -typedef enum { - BLE_PUBLIC_DEVICE_ADDRESS = 0x00, - BLE_RANDOM_DEVICE_ADDRESS = 0x01, - BLE_PUBLIC_IDENTITY_ADDRESS = 0x02, - BLE_RANDOM_STATIC_IDENTITY_ADDRESS = 0x03 -} ble_address_type; - -/* Ble adv min interval */ -#define BLE_ADV_MIN_INTERVAL 0x30 -/* Ble adv max interval */ -#define BLE_ADV_MAX_INTERVAL 0x60 -/* Ble adv handle */ -#define BTH_GAP_BLE_ADV_HANDLE_DEFAULT 0x01 -/* Ble adv duration */ -#define BTH_GAP_BLE_ADV_FOREVER_DURATION 0 - -/** - * @if Eng - * @brief Enable BLE adv. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 使能BLE广播。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_start_adv(void); - -/** - * @if Eng - * @brief BLE adv data config. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE广播数据配置。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_set_adv_data(void); -#endif - diff --git a/application/samples/bt/ble/ble_gatt_server/src/CMakeLists.txt b/application/samples/bt/ble/ble_gatt_server/src/CMakeLists.txt deleted file mode 100755 index 29ed99f..0000000 --- a/application/samples/bt/ble/ble_gatt_server/src/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_server_adv.c" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_gatt_server.c" - PARENT_SCOPE) diff --git a/application/samples/bt/ble/ble_gatt_server/src/ble_gatt_server.c b/application/samples/bt/ble/ble_gatt_server/src/ble_gatt_server.c deleted file mode 100755 index 2bbc214..0000000 --- a/application/samples/bt/ble/ble_gatt_server/src/ble_gatt_server.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * Description: ble uuid server sample. - */ - -#include -#include -#include -#include -#include "osal_addr.h" -#include "bts_def.h" -#include "securec.h" -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "bts_gatt_stru.h" -#include "bts_gatt_server.h" -#include "soc_osal.h" -#include "app_init.h" -#include "ble_server_adv.h" -#include "ble_gatt_server.h" - -/* server app uuid for test */ -char g_uuid_app_uuid[] = {0x0, 0x0}; - -/* ble indication att handle */ -uint16_t g_indication_characteristic_att_hdl = 0; - -/* ble notification att handle */ -uint16_t g_notification_characteristic_att_hdl = 0; - -/* ble connect handle */ -uint16_t g_conn_hdl = 0; - -/* ble server id */ -uint8_t g_server_id = 0; - -#define OCTET_BIT_LEN 8 -#define UUID_LEN_2 2 - -/* 将uint16的uuid数字转化为bt_uuid_t */ -void stream_data_to_uuid(uint16_t uuid_data, bt_uuid_t *out_uuid) -{ - char uuid[] = {(uint8_t)(uuid_data >> OCTET_BIT_LEN), (uint8_t)uuid_data}; - out_uuid->uuid_len = UUID_LEN_2; - if (memcpy_s(out_uuid->uuid, out_uuid->uuid_len, uuid, UUID_LEN_2) != EOK) { - return; - } -} - -errcode_t compare_service_uuid(bt_uuid_t *uuid1, bt_uuid_t *uuid2) -{ - if (uuid1->uuid_len != uuid2->uuid_len) { - return ERRCODE_BT_FAIL; - } - if (memcmp(uuid1->uuid, uuid2->uuid, uuid1->uuid_len) != 0) { - return ERRCODE_BT_FAIL; - } - return ERRCODE_BT_SUCCESS; -} - -/* 添加描述符:客户端特性配置 */ -static void ble_uuid_server_add_descriptor_ccc(uint32_t server_id, uint32_t srvc_handle) -{ - bt_uuid_t ccc_uuid = {0}; - uint8_t ccc_data_val[] = {0x00, 0x00}; - - osal_printk("[uuid server] beginning add descriptors\r\n"); - stream_data_to_uuid(BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION, &ccc_uuid); - gatts_add_desc_info_t descriptor; - descriptor.desc_uuid = ccc_uuid; - descriptor.permissions = GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE; - descriptor.value_len = sizeof(ccc_data_val); - descriptor.value = ccc_data_val; - gatts_add_descriptor(server_id, srvc_handle, &descriptor); - osal_vfree(ccc_uuid.uuid); -} - -/* 添加HID服务的所有特征和描述符 */ -static void ble_uuid_server_add_characters_and_descriptors(uint32_t server_id, uint32_t srvc_handle) -{ - bt_uuid_t server_uuid = {0}; - uint8_t server_value[] = {0x12, 0x34}; - osal_printk("[uuid server] beginning add characteristic\r\n"); - stream_data_to_uuid(BLE_UUID_UUID_SERVER_REPORT, &server_uuid); - gatts_add_chara_info_t character; - character.chara_uuid = server_uuid; - character.properties = UUID_SERVER_PROPERTIES; - character.permissions = 0; - character.value_len = sizeof(server_value); - character.value = server_value; - gatts_add_characteristic(server_id, srvc_handle, &character); - ble_uuid_server_add_descriptor_ccc(server_id, srvc_handle); -} - -/* 服务添加回调 */ -static void ble_uuid_server_service_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t handle, errcode_t status) -{ - bt_uuid_t service_uuid = {0}; - osal_printk("[uuid server] add service cbk: server: %d, status: %d, srv_handle: %d, uuid_len: %d,uuid:", - server_id, status, handle, uuid->uuid_len); - for (int8_t i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); - stream_data_to_uuid(BLE_UUID_UUID_SERVER_SERVICE, &service_uuid); - if (compare_service_uuid(uuid, &service_uuid) == ERRCODE_BT_SUCCESS) { - ble_uuid_server_add_characters_and_descriptors(server_id, handle); - osal_printk("[uuid server] start service\r\n"); - gatts_start_service(server_id, handle); - } else { - osal_printk("[uuid server] unknown service uuid\r\n"); - return; - } -} - -/* 特征添加回调 */ -static void ble_uuid_server_characteristic_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - gatts_add_character_result_t *result, errcode_t status) -{ - int8_t i = 0; - osal_printk("[uuid server] add characteristic cbk: server: %d, status: %d, srv_hdl: %d "\ - "char_hdl: %x, char_val_hdl: %x, uuid_len: %d, uuid: ", - server_id, status, service_handle, result->handle, result->value_handle, uuid->uuid_len); - for (i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); - g_notification_characteristic_att_hdl = result->value_handle; -} - -/* 描述符添加回调 */ -static void ble_uuid_server_descriptor_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - uint16_t handle, errcode_t status) -{ - int8_t i = 0; - osal_printk("[uuid server] add descriptor cbk : server: %d, status: %d, srv_hdl: %d, desc_hdl: %x ,"\ - "uuid_len:%d, uuid: ", server_id, status, service_handle, handle, uuid->uuid_len); - for (i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); -} - -/* 开始服务回调 */ -static void ble_uuid_server_service_start_cbk(uint8_t server_id, uint16_t handle, errcode_t status) -{ - osal_printk("[uuid server] start service cbk : server: %d status: %d srv_hdl: %d\n", - server_id, status, handle); -} - -static void ble_uuid_server_receive_write_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_write_cb_t *write_cb_para, errcode_t status) -{ - osal_printk("[uuid server]ReceiveWriteReqCallback--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_prep:%d\n", - write_cb_para->request_id, write_cb_para->handle, write_cb_para->offset, write_cb_para->need_rsp, - write_cb_para->need_authorize, write_cb_para->is_prep); - osal_printk("data_len:%d data:\n", write_cb_para->length); - for (uint8_t i = 0; i < write_cb_para->length; i++) { - osal_printk("%02x ", write_cb_para->value[i]); - } - osal_printk("\n"); - osal_printk("status:%d\n", status); -} - -static void ble_uuid_server_receive_read_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_read_cb_t *read_cb_para, errcode_t status) -{ - osal_printk("[uuid server]ReceiveReadReq--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_long:%d\n", - read_cb_para->request_id, read_cb_para->handle, read_cb_para->offset, read_cb_para->need_rsp, - read_cb_para->need_authorize, read_cb_para->is_long); - osal_printk("status:%d\n", status); -} - -static void ble_uuid_server_adv_enable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv enable adv_id: %d, status:%d\n", adv_id, status); -} - -static void ble_uuid_server_adv_disable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv disable adv_id: %d, status:%d\n", - adv_id, status); -} - - -void ble_uuid_server_connect_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, - gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - osal_printk("connect state change conn_id: %d, status: %d, pair_status:%d, addr %x disc_reason %x\n", - conn_id, conn_state, pair_state, addr[0], disc_reason); - g_conn_hdl = conn_id; - - if (conn_state == GAP_BLE_STATE_DISCONNECTED) { - gap_ble_start_adv(BTH_GAP_BLE_ADV_HANDLE_DEFAULT); - } -} - -void ble_uuid_server_mtu_changed_cbk(uint8_t server_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - osal_printk("mtu change change server_id: %d, conn_id: %d, mtu_size: %d, status:%d \n", - server_id, conn_id, mtu_size, status); -} - -void ble_uuid_server_enable_cbk(errcode_t status) -{ - osal_printk("enable status: %d\n", status); -} - -static errcode_t ble_uuid_server_register_callbacks(void) -{ - errcode_t ret; - gap_ble_callbacks_t gap_cb = {0}; - gatts_callbacks_t service_cb = {0}; - - gap_cb.start_adv_cb = ble_uuid_server_adv_enable_cbk; - gap_cb.stop_adv_cb = ble_uuid_server_adv_disable_cbk; - gap_cb.conn_state_change_cb = ble_uuid_server_connect_change_cbk; - gap_cb.ble_enable_cb = ble_uuid_server_enable_cbk; - ret = gap_ble_register_callbacks(&gap_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[uuid server] reg gap cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - - service_cb.add_service_cb = ble_uuid_server_service_add_cbk; - service_cb.add_characteristic_cb = ble_uuid_server_characteristic_add_cbk; - service_cb.add_descriptor_cb = ble_uuid_server_descriptor_add_cbk; - service_cb.start_service_cb = ble_uuid_server_service_start_cbk; - service_cb.read_request_cb = ble_uuid_server_receive_read_req_cbk; - service_cb.write_request_cb = ble_uuid_server_receive_write_req_cbk; - service_cb.mtu_changed_cb = ble_uuid_server_mtu_changed_cbk; - ret = gatts_register_callbacks(&service_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[uuid server] reg service cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - return ret; -} - -uint8_t ble_uuid_add_service(void) -{ - osal_printk("[uuid server] ble uuid add service in\r\n"); - bt_uuid_t service_uuid = {0}; - stream_data_to_uuid(BLE_UUID_UUID_SERVER_SERVICE, &service_uuid); - gatts_add_service(g_server_id, &service_uuid, true); - osal_printk("[uuid server] ble uuid add service out\r\n"); - return ERRCODE_BT_SUCCESS; -} - -/* 初始化uuid server service */ -errcode_t ble_uuid_server_init(void) -{ - enable_ble(); - ble_uuid_server_register_callbacks(); - bt_uuid_t app_uuid = {0}; - app_uuid.uuid_len = sizeof(g_uuid_app_uuid); - if (memcpy_s(app_uuid.uuid, app_uuid.uuid_len, g_uuid_app_uuid, sizeof(g_uuid_app_uuid)) != EOK) { - return ERRCODE_BT_FAIL; - } - gatts_register_server(&app_uuid, &g_server_id); - ble_uuid_add_service(); - osal_printk("[uuid server] init ok\r\n"); - ble_start_adv(); - return ERRCODE_BT_SUCCESS; -} - -/* device通过uuid向host发送数据:report */ -errcode_t ble_uuid_server_send_report_by_uuid(const uint8_t *data, uint8_t len) -{ - gatts_ntf_ind_by_uuid_t param = {0}; - uint16_t conn_id = g_conn_hdl; - param.start_handle = 0; - param.end_handle = 0xffff; - stream_data_to_uuid(BLE_UUID_UUID_SERVER_REPORT, ¶m.chara_uuid); - param.value_len = len; - param.value = osal_vmalloc(len); - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[hid][ERROR]send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate_by_uuid(g_server_id, conn_id, ¶m); - osal_vfree(param.value); - return ERRCODE_BT_SUCCESS; -} - -/* device通过handle向host发送数据:report */ -errcode_t ble_uuid_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len) -{ - gatts_ntf_ind_t param = {0}; - uint16_t conn_id = g_conn_hdl; - - param.attr_handle = attr_handle; - param.value = osal_vmalloc(len); - param.value_len = len; - - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[hid][ERROR]send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate(g_server_id, conn_id, ¶m); - osal_vfree(param.value); - return ERRCODE_BT_SUCCESS; -} - -#define BLE_UUID_SERVER_TASK_PRIO 24 -#define BLE_UUID_SERVER_STACK_SIZE 0x2000 - -static void ble_uuid_server_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)ble_uuid_server_init, 0, "ble_uuid_server", - BLE_UUID_SERVER_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, BLE_UUID_SERVER_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(ble_uuid_server_entry); \ No newline at end of file diff --git a/application/samples/bt/ble/ble_gatt_server/src/ble_server_adv.c b/application/samples/bt/ble/ble_gatt_server/src/ble_server_adv.c deleted file mode 100755 index 92fc782..0000000 --- a/application/samples/bt/ble/ble_gatt_server/src/ble_server_adv.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: adv config for ble uuid server. - */ -#include -#include -#include -#include -#include "osal_addr.h" -#include "securec.h" -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "ble_server_adv.h" - -#define NAME_MAX_LENGTH 15 -#define EXT_ADV_OR_SCAN_RSP_DATA_LEN 251 -#define u16_low_u8(val) ((uint8_t)((uint16_t)(val) & 0xff)) -#define u16_high_u8(val) ((uint8_t)(((uint16_t)(val) >> 8) & 0xff)) - -uint8_t g_local_name[ NAME_MAX_LENGTH] = { 'b', 'l', 'e', '_', 'u', 'u', 'i', 'd', '_', 's', - 'e', 'r', 'v', 'e', 'r' }; - -static uint8_t ble_set_adv_flag_data(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - - ble_adv_flag adv_flags = { - .length = BLE_ADV_FLAG_LEN - BLE_GENERAL_BYTE_1, - .adv_data_type = 1, - .flags = BLE_ADV_FLAG_DATA, - }; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_flags, BLE_ADV_FLAG_LEN); - if (n_ret != EOK) { - return 0; - } - return BLE_ADV_FLAG_LEN; -} - -static uint8_t ble_set_adv_appearance(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - ble_appearance_st adv_appearance_data = { - .length = BLE_ADV_APPEARANCE_LENGTH - BLE_GENERAL_BYTE_1, - .adv_data_type = BLE_ADV_APPEARANCE_DATA_TYPE, - .catogory_id = { u16_low_u8(BLE_ADV_CATEGORY_KEYBOARD_VALUE), u16_high_u8(BLE_ADV_CATEGORY_KEYBOARD_VALUE) }, - }; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_appearance_data, BLE_ADV_APPEARANCE_LENGTH); - if (n_ret != EOK) { - return 0; - } - return BLE_ADV_APPEARANCE_LENGTH; -} - -static uint8_t ble_set_adv_name(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - uint8_t len; - ble_local_name_st adv_local_name_data = { 0 }; - adv_local_name_data.length = (uint8_t)(BLE_ADV_PARAM_DATATYPE_LENGTH + sizeof(g_local_name)); - adv_local_name_data.adv_data_type = BLE_ADV_LOCAL_NAME_DATA_TYPE; - len = BLE_ADV_PARAM_DATATYPE_LENGTH + BLE_ADV_PARAM_DATATYPE_LENGTH; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_local_name_data, len); - if (n_ret != EOK) { - return 0; - } - n_ret = memcpy_s((set_adv_data_position + len), (size_t)(max_len - len), g_local_name, sizeof(g_local_name)); - if (n_ret != EOK) { - return 0; - } - len = (uint8_t)(len + sizeof(g_local_name)); - return len; -} - -static uint8_t ble_set_adv_appearance_data(uint8_t *set_adv_data_position, uint8_t max_len) -{ - uint8_t idx = 0; - idx += ble_set_adv_appearance(set_adv_data_position, max_len); - idx += ble_set_adv_name(set_adv_data_position + idx, (max_len - idx)); - return idx; -} - -static uint16_t ble_uuid_server_set_adv_data(uint8_t *set_adv_data, uint8_t adv_data_max_len) -{ - uint8_t idx = 0; - - if ((set_adv_data == NULL) || (adv_data_max_len == 0)) { - return 0; - } - idx += ble_set_adv_flag_data(set_adv_data, adv_data_max_len); - idx += ble_set_adv_appearance_data(&set_adv_data[idx], adv_data_max_len - idx); - return idx; -} - -static uint16_t ble_set_scan_response_data(uint8_t *scan_rsp_data, uint8_t scan_rsp_data_max_len) -{ - uint8_t idx = 0; - errno_t n_ret; - - if (scan_rsp_data == NULL) { - return 0; - } - if (scan_rsp_data_max_len == 0) { - return 0; - } - - /* tx power level */ - ble_tx_power_level_st tx_power_level = { - .length = BLE_SCAN_RSP_TX_POWER_LEVEL_LEN - BLE_GENERAL_BYTE_1, - .adv_data_type = BLE_ADV_TX_POWER_LEVEL, - .tx_power_value = 0, - }; - - n_ret = memcpy_s(scan_rsp_data, scan_rsp_data_max_len, &tx_power_level, sizeof(ble_tx_power_level_st)); - if (n_ret != EOK) { - return 0; - } - idx += BLE_SCAN_RSP_TX_POWER_LEVEL_LEN; - - /* set local name */ - scan_rsp_data[idx++] = sizeof(g_local_name) + BLE_GENERAL_BYTE_1; - scan_rsp_data[idx++] = BLE_ADV_LOCAL_NAME_DATA_TYPE; - if ((idx + sizeof(g_local_name)) > scan_rsp_data_max_len) { - return 0; - } - n_ret = memcpy_s(&scan_rsp_data[idx], scan_rsp_data_max_len - idx, g_local_name, sizeof(g_local_name)); - if (n_ret != EOK) { - return 0; - } - idx += sizeof(g_local_name); - return idx; -} - -uint8_t ble_set_adv_data(void) -{ - errcode_t n_ret = 0; - uint16_t adv_data_len; - uint16_t scan_rsp_data_len; - uint8_t set_adv_data[EXT_ADV_OR_SCAN_RSP_DATA_LEN] = { 0 }; - uint8_t set_scan_rsp_data[EXT_ADV_OR_SCAN_RSP_DATA_LEN] = { 0 }; - gap_ble_config_adv_data_t cfg_adv_data; - - /* set adv data */ - adv_data_len = ble_uuid_server_set_adv_data(set_adv_data, EXT_ADV_OR_SCAN_RSP_DATA_LEN); - if ((adv_data_len > EXT_ADV_OR_SCAN_RSP_DATA_LEN) || (adv_data_len == 0)) { - return 0; - } - /* set scan response data */ - scan_rsp_data_len = ble_set_scan_response_data(set_scan_rsp_data, EXT_ADV_OR_SCAN_RSP_DATA_LEN); - if ((scan_rsp_data_len > EXT_ADV_OR_SCAN_RSP_DATA_LEN) || (scan_rsp_data_len == 0)) { - return 0; - } - cfg_adv_data.adv_data = set_adv_data; - cfg_adv_data.adv_length = adv_data_len; - - cfg_adv_data.scan_rsp_data = set_scan_rsp_data; - cfg_adv_data.scan_rsp_length = scan_rsp_data_len; - n_ret = gap_ble_set_adv_data(BTH_GAP_BLE_ADV_HANDLE_DEFAULT, &cfg_adv_data); - if (n_ret != 0) { - return 0; - } - return 0; -} - -uint8_t ble_start_adv(void) -{ - errcode_t n_ret = 0; - gap_ble_adv_params_t adv_para = {0}; - - ble_set_adv_data(); - - int adv_id = BTH_GAP_BLE_ADV_HANDLE_DEFAULT; - - adv_para.min_interval = BLE_ADV_MIN_INTERVAL; - adv_para.max_interval = BLE_ADV_MAX_INTERVAL; - adv_para.duration = BTH_GAP_BLE_ADV_FOREVER_DURATION; - adv_para.peer_addr.type = BLE_PUBLIC_DEVICE_ADDRESS; - /* 广播通道选择bitMap, 可参考BleAdvChannelMap */ - adv_para.channel_map = BLE_ADV_CHANNEL_MAP_CH_DEFAULT; - adv_para.adv_type = BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED; - adv_para.adv_filter_policy = BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY; - (void)memset_s(&adv_para.peer_addr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - n_ret = gap_ble_set_adv_param(adv_id, &adv_para); - if (n_ret != 0) { - return 0; - } - n_ret = gap_ble_start_adv(adv_id); - if (n_ret != 0) { - return 0; - } - return 0; -} diff --git a/application/samples/bt/ble/ble_speed_client/CMakeLists.txt b/application/samples/bt/ble/ble_speed_client/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/ble/ble_speed_client/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_speed_client/inc/ble_speed_client.h b/application/samples/bt/ble/ble_speed_client/inc/ble_speed_client.h deleted file mode 100755 index f42eeae..0000000 --- a/application/samples/bt/ble/ble_speed_client/inc/ble_speed_client.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: BLE SPEED Server module. - */ - -#ifndef BLE_SPEED_CLIENT_H -#define BLE_SPEED_CLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define DEFAULT_SCAN_INTERVAL 0x48 -#define DEFAULT_SCAN_INTERVAL 0x48 - -/** - * @if Eng - * @brief Use this funtion to init gatt client. - * @par Description:init gatt client. - * @attention NULL - * @param NULL - * @retval error code. - * @else - * @brief 初始化gatt 客户端。 - * @par 说明:初始化gatt 客户端。 - * @attention NULL - * @param NULL - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_gatt_client_init(void); - -/** - * @if Eng - * @brief discover all service, character and descriptor of remote device. - * @par Description:discover all service of remote device. - * @attention NULL - * @param conn_id connection ID - * @retval error code. - * @else - * @brief 发现对端设备所有服务、特征和描述符。 - * @par 说明:发现对端设备所有服务、特征和描述符。 - * @attention NULL - * @param conn_id 连接 ID - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id); - -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/bt/ble/ble_speed_client/src/CMakeLists.txt b/application/samples/bt/ble/ble_speed_client/src/CMakeLists.txt deleted file mode 100755 index d7b5ddf..0000000 --- a/application/samples/bt/ble/ble_speed_client/src/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/ble_speed_client.c" PARENT_SCOPE) diff --git a/application/samples/bt/ble/ble_speed_client/src/ble_speed_client.c b/application/samples/bt/ble/ble_speed_client/src/ble_speed_client.c deleted file mode 100755 index 46170c9..0000000 --- a/application/samples/bt/ble/ble_speed_client/src/ble_speed_client.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * Description: ble speed client sample. - */ - -#include -#include -#include -#include -#include "securec.h" -#include "app_init.h" -#include "systick.h" -#include "soc_osal.h" -#include "osal_list.h" -#include "common_def.h" - -#include "bts_le_gap.h" -#include "bts_gatt_client.h" -#include "ble_speed_client.h" - -#define UUID16_LEN 2 -#define TEMP_LINE_LEN 32 -static int g_recv_pkt_num = 0; -static uint64_t g_count_before_get_us; -static uint64_t g_count_after_get_us; -#define RECV_PKT_CNT 100 - -/* client id, invalid client id is "0" */ -static uint8_t g_client_id = 0; -/* client app uuid for test */ -static bt_uuid_t g_client_app_uuid = {UUID16_LEN, {0}}; - -bd_addr_t g_ble_speed_addr = { - .type = 0, - .addr = {0x11, 0x22, 0x33, 0x63, 0x88, 0x63}, -}; - -extern errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id); - -static void ble_gatt_client_discover_service_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_service_result_t *service, errcode_t status) -{ - gattc_discovery_character_param_t param = {0}; - osal_printk("[GATTClient]Discovery service----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" start handle:%d end handle:%d uuid_len:%d\n uuid:", - service->start_hdl, service->end_hdl, service->uuid.uuid_len); - for (uint8_t i = 0; i < service->uuid.uuid_len; i++) { - osal_printk("%02x", service->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); - param.service_handle = service->start_hdl; - param.uuid.uuid_len = 0; /* uuid length is zero, discover all character */ - gattc_discovery_character(g_client_id, conn_id, ¶m); -} - -static void ble_gatt_client_discover_character_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_result_t *character, errcode_t status) -{ - osal_printk("[GATTClient]Discovery character----client:%d conn_id:%d uuid_len:%d\n uuid:", - client_id, conn_id, character->uuid.uuid_len); - for (uint8_t i = 0; i < character->uuid.uuid_len; i++) { - osal_printk("%02x", character->uuid.uuid[i]); - } - osal_printk("\n declare handle:%d value handle:%d properties:%x\n", character->declare_handle, - character->value_handle, character->properties); - osal_printk(" status:%d\n", status); - gattc_discovery_descriptor(g_client_id, conn_id, character->declare_handle); -} - -static void ble_gatt_client_discover_descriptor_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_descriptor_result_t *descriptor, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, descriptor->uuid.uuid_len); - for (uint8_t i = 0; i < descriptor->uuid.uuid_len; i++) { - osal_printk("%02x", descriptor->uuid.uuid[i]); - } - osal_printk("\n descriptor handle:%d\n", descriptor->descriptor_hdl); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_service_compl_cbk(uint8_t client_id, uint16_t conn_id, bt_uuid_t *uuid, - errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery service complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, uuid->uuid_len); - for (uint8_t i = 0; i < uuid->uuid_len; i++) { - osal_printk("%02x", uuid->uuid[i]); - } - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_character_compl_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_param_t *param, errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery character complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n service handle:%d\n", param->service_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_discover_descriptor_compl_cbk(uint8_t client_id, uint16_t conn_id, - uint16_t character_handle, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" charatcer handle:%d\n", character_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_read_cfm_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, - gatt_status_t status) -{ - osal_printk("[GATTClient]Read result----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", read_result->handle, read_result->data_len); - for (uint8_t i = 0; i < read_result->data_len; i++) { - osal_printk("%02x", read_result->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_read_compl_cbk(uint8_t client_id, uint16_t conn_id, gattc_read_req_by_uuid_param_t *param, - errcode_t status) -{ - osal_printk("[GATTClient]Read by uuid complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("start handle:%d end handle:%d uuid len:%d\n uuid:", - param->start_hdl, param->end_hdl, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_write_cfm_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status) -{ - osal_printk("[GATTClient]Write result----client:%d conn_id:%d handle:%d\n", client_id, conn_id, handle); - osal_printk(" status:%d\n", status); -} - -static void ble_gatt_client_mtu_changed_cbk(uint8_t client_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - osal_printk("[GATTClient]Mtu changed----client:%d conn_id:%d mtu size:%d\n", client_id, conn_id, - mtu_size); - osal_printk(" status:%d\n", status); -} - -#define BLE_SPEED_HUNDRED 100 -static uint32_t get_float_int(float in) -{ - return (uint32_t)(((uint64_t)(in * BLE_SPEED_HUNDRED)) / BLE_SPEED_HUNDRED); -} - -static uint32_t get_float_dec(float in) -{ - return (uint32_t)(((uint64_t)(in * BLE_SPEED_HUNDRED)) % BLE_SPEED_HUNDRED); -} - -static void ble_gatt_client_notification_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - unused(status); - unused(conn_id); - unused(client_id); - - g_recv_pkt_num++; - if (g_recv_pkt_num == 1) { - g_count_before_get_us = uapi_systick_get_us(); - } else if (g_recv_pkt_num == RECV_PKT_CNT) { - g_count_after_get_us = uapi_systick_get_us(); - printf("count_us = %llu, recv %d pkt.\r\n", - g_count_after_get_us - g_count_before_get_us, RECV_PKT_CNT); - float time = (float)(g_count_after_get_us - g_count_before_get_us) / 1000000.0; /* 1s = 1000000.0us */ - printf("time = %d.%d s\r\n", get_float_int(time), get_float_dec(time)); - float speed = (data->data_len) * RECV_PKT_CNT * 8 / time; /* 1B = 8bits */ - printf("speed = %d.%d bps\r\n", get_float_int(speed), get_float_dec(speed)); - g_recv_pkt_num = 0; - } -} - -static void ble_gatt_client_indication_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - osal_printk("[GATTClient]Receive indication----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", data->handle, data->data_len); - for (uint8_t i = 0; i < data->data_len; i++) { - osal_printk("%02x", data->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_gatt_client_enable_cbk(errcode_t status) -{ - status = status; -} - -static int convert_ble_mac(uint8_t *dest_mac, uint16_t dest_len, uint8_t *src_mac, uint16_t src_len) -{ - if (dest_len != src_len) { - return -1; - } - for (uint8_t i = 0; i < src_len; i++) { - dest_mac[i] = src_mac[src_len - 1 - i]; - } - return 0; -} - -static void ble_gatt_client_scan_result_cbk(gap_scan_result_data_t *scan_result_data) -{ - uint8_t ble_mac[BD_ADDR_LEN] = {0}; - convert_ble_mac(ble_mac, BD_ADDR_LEN, g_ble_speed_addr.addr, BD_ADDR_LEN); - if (memcmp(scan_result_data->addr.addr, ble_mac, BD_ADDR_LEN) == 0) { - osal_printk("Find The Target Device.\n"); - gap_ble_stop_scan(); - bd_addr_t client_addr = { 0 }; - client_addr.type = scan_result_data->addr.type; - if (memcpy_s(client_addr.addr, BD_ADDR_LEN, scan_result_data->addr.addr, BD_ADDR_LEN) != EOK) { - osal_printk("%s add server app addr memcpy failed\r\n", __FUNCTION__); - return; - } - gap_ble_connect_remote_device(&client_addr); - } else { - osal_printk("\naddr:"); - for (uint8_t i = 0; i < BD_ADDR_LEN; i++) { - osal_printk(" %02x:", scan_result_data->addr.addr[i]); - } - } -} - -static void ble_gatt_client_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *addr, - gap_ble_conn_state_t conn_state, gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - osal_printk("%s connect state change conn_id: %d, status: %d, pair_status:%d, disc_reason %x\n", - __FUNCTION__, conn_id, conn_state, pair_state, disc_reason); - - if (conn_state == GAP_BLE_STATE_CONNECTED) { - gap_ble_pair_remote_device(addr); - } -} - -static void ble_gatt_client_pair_result_cbk(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - unused(addr); - osal_printk("%s pair result conn_id: %d,status: %d \n", __FUNCTION__, conn_id, status); - - ble_gatt_client_discover_all_service(conn_id); -} - -static void ble_gatt_client_conn_param_update_cbk(uint16_t conn_id, errcode_t status, - const gap_ble_conn_param_update_t *param) -{ - osal_printk("%s conn_param_update conn_id: %d,status: %d \n", __FUNCTION__, conn_id, status); - osal_printk("interval:%d latency:%d timeout:%d.\n", param->interval, param->latency, param->timeout); -} - -errcode_t ble_gatt_client_callback_register(void) -{ - errcode_t ret = ERRCODE_BT_UNHANDLED; - gap_ble_callbacks_t gap_cb = {0}; - gap_cb.ble_enable_cb = ble_gatt_client_enable_cbk; - gap_cb.scan_result_cb = ble_gatt_client_scan_result_cbk; - gap_cb.conn_state_change_cb = ble_gatt_client_conn_state_change_cbk; - gap_cb.pair_result_cb = ble_gatt_client_pair_result_cbk; - gap_cb.conn_param_update_cb = ble_gatt_client_conn_param_update_cbk; - ret |= gap_ble_register_callbacks(&gap_cb); - - gattc_callbacks_t cb = {0}; - cb.discovery_svc_cb = ble_gatt_client_discover_service_cbk; - cb.discovery_svc_cmp_cb = ble_gatt_client_discover_service_compl_cbk; - cb.discovery_chara_cb = ble_gatt_client_discover_character_cbk; - cb.discovery_chara_cmp_cb = ble_gatt_client_discover_character_compl_cbk; - cb.discovery_desc_cb = ble_gatt_client_discover_descriptor_cbk; - cb.discovery_desc_cmp_cb = ble_gatt_client_discover_descriptor_compl_cbk; - cb.read_cb = ble_gatt_client_read_cfm_cbk; - cb.read_cmp_cb = ble_gatt_client_read_compl_cbk; - cb.write_cb = ble_gatt_client_write_cfm_cbk; - cb.mtu_changed_cb = ble_gatt_client_mtu_changed_cbk; - cb.notification_cb = ble_gatt_client_notification_cbk; - cb.indication_cb = ble_gatt_client_indication_cbk; - ret |= gattc_register_callbacks(&cb); - return ret; -} - -void ble_speed_start_scan(void) -{ - gap_ble_scan_params_t ble_device_scan_params = { 0 }; - ble_device_scan_params.scan_interval = DEFAULT_SCAN_INTERVAL; - ble_device_scan_params.scan_window = DEFAULT_SCAN_INTERVAL; - ble_device_scan_params.scan_type = 0x00; - ble_device_scan_params.scan_phy = GAP_BLE_PHY_2M; - ble_device_scan_params.scan_filter_policy = 0x00; - gap_ble_set_scan_parameters(&ble_device_scan_params); - gap_ble_start_scan(); -} - -errcode_t ble_gatt_client_init(void) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - ret |= enable_ble(); - ret |= ble_gatt_client_callback_register(); - ret |= gattc_register_client(&g_client_app_uuid, &g_client_id); - osal_printk("[BLE Client] init ok.\n"); - ble_speed_start_scan(); - return ret; -} - -errcode_t ble_gatt_client_discover_all_service(uint16_t conn_id) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - bt_uuid_t service_uuid = {0}; /* uuid length is zero, discover all service */ - ret |= gattc_discovery_service(g_client_id, conn_id, &service_uuid); - return ret; -} - -#define BLE_SPEED_TASK_PRIO 26 -#define BLE_SPEED_STACK_SIZE 0x2000 - -static void ble_speed_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)ble_gatt_client_init, 0, "ble_speed", - BLE_SPEED_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, BLE_SPEED_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(ble_speed_entry); \ No newline at end of file diff --git a/application/samples/bt/ble/ble_speed_server/CMakeLists.txt b/application/samples/bt/ble/ble_speed_server/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/ble/ble_speed_server/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server.h b/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server.h deleted file mode 100755 index 632f9a1..0000000 --- a/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: BLE SPEED Server module. - */ - -/** - * @defgroup bluetooth_bts_hid_server HID SERVER API - * @ingroup - * @{ - */ -#ifndef BLE_SPEED_SERVER_H -#define BLE_SPEED_SERVER_H - -#include "bts_def.h" - -/* Service UUID */ -#define BLE_UUID_UUID_SERVER_SERVICE 0xABCD -/* Characteristic UUID */ -#define BLE_UUID_UUID_SERVER_REPORT 0xCDEF -/* Client Characteristic Configuration UUID */ -#define BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION 0x2902 -/* Server ID */ -#define BLE_UUID_SERVER_ID 1 - -/* Characteristic Property */ -#define UUID_SERVER_PROPERTIES (GATT_CHARACTER_PROPERTY_BIT_READ | GATT_CHARACTER_PROPERTY_BIT_NOTIFY) - -/** - * @if Eng - * @brief BLE server init. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE UUID服务器初始化。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_init(void); - -/** - * @if Eng - * @brief send data to peer device by uuid on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_send_report_by_uuid(uint8_t *data, uint16_t len); - -/** - * @if Eng - * @brief send data to peer device by handle on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_uuid_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len); - -#endif - diff --git a/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server_adv.h b/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server_adv.h deleted file mode 100755 index 052a6d3..0000000 --- a/application/samples/bt/ble/ble_speed_server/inc/ble_speed_server_adv.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * - * Description: BLE ADV Config. - */ - -/** - * @defgroup bluetooth_bts_ble_adv API - * @ingroup - * @{ - */ -#ifndef BLE_SERVER_ADV_H -#define BLE_SERVER_ADV_H - -#include "bts_def.h" - -/* Ble Adv type Flag length */ -#define BLE_ADV_FLAG_LEN 0x03 -/* Ble Adv data length */ -#define BLE_GENERAL_BYTE_1 1 -/* Ble Adv appearance length */ -#define BLE_ADV_APPEARANCE_LENGTH 4 -/* Ble Adv appearance type */ -#define BLE_ADV_APPEARANCE_DATA_TYPE 0x19 -/* Ble keyboard appearance type */ -#define BLE_ADV_CATEGORY_KEYBOARD_VALUE 0x0080 -/* Ble keyboard categorylength */ -#define BLE_ADV_CATEGORY_LEN 2 -/* Ble name adv param type length */ -#define BLE_ADV_PARAM_DATATYPE_LENGTH 1 -/* Ble name adv name type */ -#define BLE_ADV_LOCAL_NAME_DATA_TYPE 0x09 -/* Ble name adv tx power type */ -#define BLE_ADV_TX_POWER_LEVEL 0x0A -/* Ble name adv tx power response type */ -#define BLE_SCAN_RSP_TX_POWER_LEVEL_LEN 0x03 -/* Ble adv flag data */ -#define BLE_ADV_FLAG_DATA 0x05 - -/** - * @if Eng - * @brief Definitaion of BLE ADV data flag. - * @else - * @brief BLE 广播数据类型定义。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv data flag length. - @else 广播数据类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv data type. - @else 广播数据类型 */ - uint8_t flags; /*!< @if Eng adv data flag. - @else 广播数据标志 */ -} ble_adv_flag; - -/** - * @if Eng - * @brief Definitaion of BLE device appearance struct. - * @else - * @brief BLE 广播设备外观结构。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv appearance data length. - @else 设备外观数据类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv appearance data type. - @else 设备外观数据类型 */ - uint8_t catogory_id[BLE_ADV_CATEGORY_LEN]; /*!< @if Eng adv appearance data. - @else 设备外观数据 */ -} ble_appearance_st; - -/** - * @if Eng - * @brief Definitaion of BLE device name. - * @else - * @brief BLE 广播设备名称。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv device name length. - @else 广播设备名称类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv name data type. - @else 设备名称类型 */ - int8_t *name; /*!< @if Eng adv name data. - @else 设备名称数据指针 */ -} ble_local_name_st; - -/** - * @if Eng - * @brief Definitaion of BLE Tx power. - * @else - * @brief BLE 广播发送功率。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv tx power length. - @else 广播发送功率长度 */ - uint8_t adv_data_type; /*!< @if Eng adv tx power type. - @else 广播发送数据类型 */ - uint8_t tx_power_value; /*!< @if Eng adv tx power value. - @else 广播发送数据 */ -} ble_tx_power_level_st; - -/** - * @if Eng - * @brief Definitaion value range for typedef struct ble_adv_para.adv_filter_policy. - * @else - * @brief Ble adv filter policy定义值范围。 - * @endif - */ -typedef enum ble_adv_filter_policy { - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY = 0x00, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_ANY = 0x01, - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_WHITE_LIST = 0x02, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_WHITE_LIST = 0x03 -} ble_adv_filter_policy_t; - -/** - * @if Eng - * @brief Definitaion value range for adv type. - * @else - * @brief Ble adv 类型范围。 - * @endif - */ -typedef enum ble_adverting_type { - BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED = 0x00, - BLE_ADV_TYPE_CONNECTABLE_HIGH_DUTY_CYCLE_DIRECTED = 0x01, - BLE_ADV_TYPE_SCANNABLE_UNDIRECTED = 0x02, - BLE_ADV_TYPE_NON_CONNECTABLE_UNDIRECTED = 0x03, - BLE_ADV_TYPE_CONNECTABLE_LOW_DUTY_CYCLE_DIRECTED = 0x04 -} ble_adverting_type_t; - - -/** - * @if Eng - * @brief Definitaion value range for adv channel map. - * @else - * @brief Ble 广播信道范围。 - * @endif - */ -typedef enum ble_adv_channel_map { - BLE_ADV_CHANNEL_MAP_CH_37 = 0x01, - BLE_ADV_CHANNEL_MAP_CH_38 = 0x02, - BLE_ADV_CHANNEL_MAP_CH_39 = 0x04, - BLE_ADV_CHANNEL_MAP_CH_37_CH_38 = 0x03, - BLE_ADV_CHANNEL_MAP_CH_37_CH_39 = 0x05, - BLE_ADV_CHANNEL_MAP_CH_38_CH_39 = 0x06, - BLE_ADV_CHANNEL_MAP_CH_DEFAULT = 0x07 -} ble_adv_channel_map_t; - -/** - * @if Eng - * @brief Definitaion value range for adv addr type. - * @else - * @brief Ble 广播地址类型。 - * @endif - */ -typedef enum { - BLE_PUBLIC_DEVICE_ADDRESS = 0x00, - BLE_RANDOM_DEVICE_ADDRESS = 0x01, - BLE_PUBLIC_IDENTITY_ADDRESS = 0x02, - BLE_RANDOM_STATIC_IDENTITY_ADDRESS = 0x03 -} ble_address_type; - -/* Ble adv min interval */ -#define BLE_ADV_MIN_INTERVAL 0x30 -/* Ble adv max interval */ -#define BLE_ADV_MAX_INTERVAL 0x60 -/* Ble adv handle */ -#define BTH_GAP_BLE_ADV_HANDLE_DEFAULT 0x01 -/* Ble adv duration */ -#define BTH_GAP_BLE_ADV_FOREVER_DURATION 0 - -/** - * @if Eng - * @brief Enable BLE adv. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 使能BLE广播。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_start_adv(void); - -/** - * @if Eng - * @brief BLE adv data config. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE广播数据配置。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_set_adv_data(void); -#endif - diff --git a/application/samples/bt/ble/ble_speed_server/src/CMakeLists.txt b/application/samples/bt/ble/ble_speed_server/src/CMakeLists.txt deleted file mode 100755 index d5be614..0000000 --- a/application/samples/bt/ble/ble_speed_server/src/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_speed_server_adv.c" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_speed_server.c" - PARENT_SCOPE) diff --git a/application/samples/bt/ble/ble_speed_server/src/ble_speed_server.c b/application/samples/bt/ble/ble_speed_server/src/ble_speed_server.c deleted file mode 100755 index 992de51..0000000 --- a/application/samples/bt/ble/ble_speed_server/src/ble_speed_server.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * Description: ble speed server sample. - */ - -#include -#include -#include -#include -#include -#include "app_init.h" -#include "systick.h" -#include "soc_osal.h" -#include "cmsis_os2.h" -#include "securec.h" -#include "errcode.h" - -#include "osal_addr.h" -#include "bts_def.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "bts_gatt_stru.h" -#include "bts_gatt_server.h" -#include "bts_gatt_client.h" -#include "ble_speed_server_adv.h" -#include "ble_speed_server.h" - -uint8_t g_server_id = 0; - -/* server app uuid for test */ -char g_uuid_app_uuid[] = {0x0, 0x0}; - -/* ble indication att handle */ -uint16_t g_indication_characteristic_att_hdl = 0; - -/* ble notification att handle */ -uint16_t g_notification_characteristic_att_hdl = 0; - -/* ble connect handle */ -uint16_t g_conn_hdl = 0; - -#define OCTET_BIT_LEN 8 -#define UUID_LEN_2 2 - -bd_addr_t g_ble_speed_addr = { - .type = 0, - .addr = {0x11, 0x22, 0x33, 0x63, 0x88, 0x63}, -}; - -#define DATA_LEN 236 -unsigned char data[DATA_LEN]; -uint64_t g_count_before_get_us; -uint64_t g_count_after_get_us; -#define SEND_PKT_TIMES 8 -#define SEND_PKT_CNT 100 -#define DEFAULT_BLE_SPEED_MTU_SIZE 250 -#define GAP_MAX_TX_OCTETS 251 -#define GAP_MAX_TX_TIME 2000 -#define SPEED_DEFAULT_CONN_INTERVAL 0xA -#define SPPED_DEFAULT_SLAVE_LATENCY 0 -#define SPEED_DEFAULT_TIMEOUT_MULTIPLIER 0x1f4 - -#define BLE_SPEED_TASK_PRIO 26 -#define BLE_SPEED_STACK_SIZE 0x2000 - -void send_data_thread_function(void) -{ - printf("start send notify info.\n"); - gap_le_set_phy_t phy_param = { - .conn_handle = g_conn_hdl, - .all_phys = 0, - .tx_phys = 1, - .rx_phys = 1, - .phy_options = 0, - }; - gap_ble_set_phy(&phy_param); - - gap_le_set_data_length_t data_param = { - .conn_handle = g_conn_hdl, - .maxtxoctets = GAP_MAX_TX_OCTETS, - .maxtxtime = GAP_MAX_TX_TIME, - }; - gap_ble_set_data_length(&data_param); - - int i = 0; - g_count_before_get_us = uapi_systick_get_us(); - while (1) { - i++; - data[0] = (i >> 8) & 0xFF; /* offset 8bits */ - data[1] = i & 0xFF; - ble_uuid_server_send_report_by_uuid(data, DATA_LEN); - osal_msleep(1); /* 延时1ms 可使用BLE流控机制替换 */ - if (i == SEND_PKT_CNT) { - i = 0; - printf("[SYS INFO] send %d pkt: ", SEND_PKT_CNT); - LOS_MEM_POOL_STATUS status; - LOS_MemInfoGet(m_aucSysMem0, &status); - osal_printk(" mem: used:%u, free:%u.\r\n", status.uwTotalUsedSize, status.uwTotalFreeSize); - } - } -} - -/* 将uint16的uuid数字转化为bt_uuid_t */ -void stream_data_to_uuid(uint16_t uuid_data, bt_uuid_t *out_uuid) -{ - char uuid[] = {(uint8_t)(uuid_data >> OCTET_BIT_LEN), (uint8_t)uuid_data}; - out_uuid->uuid_len = UUID_LEN_2; - if (memcpy_s(out_uuid->uuid, out_uuid->uuid_len, uuid, UUID_LEN_2) != EOK) { - return; - } -} - -errcode_t compare_service_uuid(bt_uuid_t *uuid1, bt_uuid_t *uuid2) -{ - if (uuid1->uuid_len != uuid2->uuid_len) { - return ERRCODE_BT_FAIL; - } - if (memcmp(uuid1->uuid, uuid2->uuid, uuid1->uuid_len) != 0) { - return ERRCODE_BT_FAIL; - } - return ERRCODE_BT_SUCCESS; -} - -/* 添加描述符:客户端特性配置 */ -static void ble_uuid_server_add_descriptor_ccc(uint32_t server_id, uint32_t srvc_handle) -{ - bt_uuid_t ccc_uuid = {0}; - uint8_t ccc_data_val[] = {0x00, 0x00}; - - osal_printk("[uuid server] beginning add descriptors\r\n"); - stream_data_to_uuid(BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION, &ccc_uuid); - gatts_add_desc_info_t descriptor; - descriptor.desc_uuid = ccc_uuid; - descriptor.permissions = GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE; - descriptor.value_len = sizeof(ccc_data_val); - descriptor.value = ccc_data_val; - gatts_add_descriptor(server_id, srvc_handle, &descriptor); - osal_vfree(ccc_uuid.uuid); -} - -/* 添加HID服务的所有特征和描述符 */ -static void ble_uuid_server_add_characters_and_descriptors(uint32_t server_id, uint32_t srvc_handle) -{ - bt_uuid_t server_uuid = {0}; - uint8_t server_value[] = {0x12, 0x34}; - osal_printk("[uuid server] beginning add characteristic\r\n"); - stream_data_to_uuid(BLE_UUID_UUID_SERVER_REPORT, &server_uuid); - gatts_add_chara_info_t character; - character.chara_uuid = server_uuid; - character.properties = UUID_SERVER_PROPERTIES; - character.permissions = 0; - character.value_len = sizeof(server_value); - character.value = server_value; - gatts_add_characteristic(server_id, srvc_handle, &character); - ble_uuid_server_add_descriptor_ccc(server_id, srvc_handle); -} - -/* 服务添加回调 */ -static void ble_uuid_server_service_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t handle, errcode_t status) -{ - bt_uuid_t service_uuid = {0}; - osal_printk("[uuid server] add service cbk: server: %d, status: %d, srv_handle: %d, uuid_len: %d,uuid:", - server_id, status, handle, uuid->uuid_len); - for (int8_t i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); - stream_data_to_uuid(BLE_UUID_UUID_SERVER_SERVICE, &service_uuid); - if (compare_service_uuid(uuid, &service_uuid) == ERRCODE_BT_SUCCESS) { - ble_uuid_server_add_characters_and_descriptors(server_id, handle); - osal_printk("[uuid server] start service\r\n"); - gatts_start_service(server_id, handle); - } else { - osal_printk("[uuid server] unknown service uuid\r\n"); - return; - } -} - -/* 特征添加回调 */ -static void ble_uuid_server_characteristic_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - gatts_add_character_result_t *result, errcode_t status) -{ - int8_t i = 0; - osal_printk("[uuid server] add characteristic cbk: server: %d, status: %d, srv_hdl: %d "\ - "char_hdl: %x, char_val_hdl: %x, uuid_len: %d, uuid: ", - server_id, status, service_handle, result->handle, result->value_handle, uuid->uuid_len); - for (i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); - g_notification_characteristic_att_hdl = result->value_handle; -} - -/* 描述符添加回调 */ -static void ble_uuid_server_descriptor_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - uint16_t handle, errcode_t status) -{ - int8_t i = 0; - osal_printk("[uuid server] add descriptor cbk : server: %d, status: %d, srv_hdl: %d, desc_hdl: %x ,"\ - "uuid_len:%d, uuid: ", server_id, status, service_handle, handle, uuid->uuid_len); - for (i = 0; i < uuid->uuid_len ; i++) { - osal_printk("%02x", (uint8_t)uuid->uuid[i]); - } - osal_printk("\n"); -} - -/* 开始服务回调 */ -static void ble_uuid_server_service_start_cbk(uint8_t server_id, uint16_t handle, errcode_t status) -{ - osal_printk("[uuid server] start service cbk : server: %d status: %d srv_hdl: %d\n", - server_id, status, handle); -} - -static void ble_uuid_server_receive_write_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_write_cb_t *write_cb_para, errcode_t status) -{ - osal_printk("[uuid server]ReceiveWriteReqCallback--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_prep:%d\n", - write_cb_para->request_id, write_cb_para->handle, write_cb_para->offset, write_cb_para->need_rsp, - write_cb_para->need_authorize, write_cb_para->is_prep); - osal_printk("data_len:%d data:\n", write_cb_para->length); - for (uint8_t i = 0; i < write_cb_para->length; i++) { - osal_printk("%02x ", write_cb_para->value[i]); - } - osal_printk("\n"); - osal_printk("status:%d\n", status); -} - -static void ble_uuid_server_receive_read_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_read_cb_t *read_cb_para, errcode_t status) -{ - osal_printk("[uuid server]ReceiveReadReq--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_long:%d\n", - read_cb_para->request_id, read_cb_para->handle, read_cb_para->offset, read_cb_para->need_rsp, - read_cb_para->need_authorize, read_cb_para->is_long); - osal_printk("status:%d\n", status); -} - -static void ble_uuid_server_adv_enable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv enable adv_id: %d, status:%d\n", adv_id, status); -} - -static void ble_uuid_server_adv_disable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv disable adv_id: %d, status:%d\n", - adv_id, status); -} - -void ble_uuid_server_connect_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, - gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - osal_printk("connect state change conn_id: %d, status: %d, pair_status:%d, addr %x disc_reason %x\n", - conn_id, conn_state, pair_state, addr[0], disc_reason); - g_conn_hdl = conn_id; - - if (conn_state == GAP_BLE_STATE_CONNECTED) { - gattc_exchange_mtu_req(g_server_id, conn_id, DEFAULT_BLE_SPEED_MTU_SIZE); - - gap_conn_param_update_t conn_param = {0}; - conn_param.conn_handle = conn_id; - conn_param.interval_min = SPEED_DEFAULT_CONN_INTERVAL; - conn_param.interval_max = SPEED_DEFAULT_CONN_INTERVAL; - conn_param.slave_latency = SPPED_DEFAULT_SLAVE_LATENCY; - conn_param.timeout_multiplier = SPEED_DEFAULT_TIMEOUT_MULTIPLIER; - gap_ble_connect_param_update(&conn_param); - } else if (conn_state == GAP_BLE_STATE_DISCONNECTED) { - gap_ble_start_adv(BTH_GAP_BLE_ADV_HANDLE_DEFAULT); - } -} - -void ble_uuid_server_mtu_changed_cbk(uint8_t server_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - osal_printk("mtu change change server_id: %d, conn_id: %d, mtu_size: %d, status:%d \n", - server_id, conn_id, mtu_size, status); -} - -void ble_uuid_server_pair_result_cbk(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - osal_printk("pair state change conn_id: %d, status: %d, addr %x \n", - conn_id, status, addr[0]); - - if (status == 0) { - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)send_data_thread_function, 0, - "SpeedTask", BLE_SPEED_STACK_SIZE); - osal_kthread_set_priority(task_handle, BLE_SPEED_TASK_PRIO + 1); - if (task_handle != NULL) { - osal_kfree(task_handle); - } - osal_kthread_unlock(); - } -} - -static void ble_uuid_server_conn_param_update_cbk(uint16_t conn_id, errcode_t status, - const gap_ble_conn_param_update_t *param) -{ - osal_printk("%s conn_param_update conn_id: %d,status: %d \n", __FUNCTION__, conn_id, status); - osal_printk("interval:%d latency:%d timeout:%d.\n", param->interval, param->latency, param->timeout); -} - -static errcode_t ble_uuid_server_register_callbacks(void) -{ - errcode_t ret = 0; - - gap_ble_callbacks_t gap_cb = {0}; - gap_cb.start_adv_cb = ble_uuid_server_adv_enable_cbk; - gap_cb.stop_adv_cb = ble_uuid_server_adv_disable_cbk; - gap_cb.conn_state_change_cb = ble_uuid_server_connect_change_cbk; - gap_cb.pair_result_cb = ble_uuid_server_pair_result_cbk; - gap_cb.conn_param_update_cb = ble_uuid_server_conn_param_update_cbk; - ret |= gap_ble_register_callbacks(&gap_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[uuid server] reg gap cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - - gatts_callbacks_t service_cb = {0}; - service_cb.add_service_cb = ble_uuid_server_service_add_cbk; - service_cb.add_characteristic_cb = ble_uuid_server_characteristic_add_cbk; - service_cb.add_descriptor_cb = ble_uuid_server_descriptor_add_cbk; - service_cb.start_service_cb = ble_uuid_server_service_start_cbk; - service_cb.read_request_cb = ble_uuid_server_receive_read_req_cbk; - service_cb.write_request_cb = ble_uuid_server_receive_write_req_cbk; - service_cb.mtu_changed_cb = ble_uuid_server_mtu_changed_cbk; - ret |= gatts_register_callbacks(&service_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[uuid server] reg service cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - return ret; -} - -uint8_t ble_uuid_add_service(void) -{ - osal_printk("[uuid server] ble uuid add service in\r\n"); - bt_uuid_t service_uuid = {0}; - stream_data_to_uuid(BLE_UUID_UUID_SERVER_SERVICE, &service_uuid); - gatts_add_service(BLE_UUID_SERVER_ID, &service_uuid, true); - osal_printk("[uuid server] ble uuid add service out\r\n"); - return ERRCODE_BT_SUCCESS; -} - -static errcode_t ble_uuid_gatts_register_server(void) -{ - bt_uuid_t app_uuid = {0}; - app_uuid.uuid_len = sizeof(g_uuid_app_uuid); - if (memcpy_s(app_uuid.uuid, app_uuid.uuid_len, g_uuid_app_uuid, sizeof(g_uuid_app_uuid)) != EOK) { - return ERRCODE_BT_FAIL; - } - return gatts_register_server(&app_uuid, &g_server_id); -} - -/* 初始化uuid server service */ -errcode_t ble_uuid_server_init(void) -{ - (void)osal_msleep(1000); /* 延时1000ms,等待BLE初始化完毕 */ - enable_ble(); - ble_uuid_server_register_callbacks(); - ble_uuid_gatts_register_server(); - ble_uuid_add_service(); - gap_ble_set_local_addr(&g_ble_speed_addr); - osal_printk("[uuid server] init ok\r\n"); - ble_start_adv(); - osal_printk("[uuid server] adv ok\r\n"); - return ERRCODE_BT_SUCCESS; -} - -/* device通过uuid向host发送数据:report */ -errcode_t ble_uuid_server_send_report_by_uuid(uint8_t *data, uint16_t len) -{ - gatts_ntf_ind_by_uuid_t param = {0}; - uint16_t conn_id = g_conn_hdl; - param.start_handle = 0; - param.end_handle = 0xffff; - stream_data_to_uuid(BLE_UUID_UUID_SERVER_REPORT, ¶m.chara_uuid); - param.value_len = len; - param.value = data; - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate_by_uuid(BLE_UUID_SERVER_ID, conn_id, ¶m); - return ERRCODE_BT_SUCCESS; -} - -/* device通过handle向host发送数据:report */ -errcode_t ble_uuid_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len) -{ - gatts_ntf_ind_t param = {0}; - uint16_t conn_id = g_conn_hdl; - - param.attr_handle = attr_handle; - param.value = osal_vmalloc(len); - param.value_len = len; - - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[hid][ERROR]send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate(BLE_UUID_SERVER_ID, conn_id, ¶m); - osal_vfree(param.value); - return ERRCODE_BT_SUCCESS; -} - -static void ble_speed_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)ble_uuid_server_init, 0, "ble_speed", - BLE_SPEED_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, BLE_SPEED_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(ble_speed_entry); \ No newline at end of file diff --git a/application/samples/bt/ble/ble_speed_server/src/ble_speed_server_adv.c b/application/samples/bt/ble/ble_speed_server/src/ble_speed_server_adv.c deleted file mode 100755 index 77ac010..0000000 --- a/application/samples/bt/ble/ble_speed_server/src/ble_speed_server_adv.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: adv config for ble uuid server. - */ -#include -#include -#include -#include -#include "osal_addr.h" -#include "securec.h" -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "ble_speed_server_adv.h" - -#define NAME_MAX_LENGTH 15 -#define EXT_ADV_OR_SCAN_RSP_DATA_LEN 251 -static uint8_t u16_low_u8(uint16_t val) -{ - return (uint8_t)(val & 0xff); -} - -static uint8_t u16_high_u8(uint16_t val) -{ - return (uint8_t)((val >> 8) & 0xff); /* offset 8bits */ -} - -uint8_t g_local_name[ NAME_MAX_LENGTH] = { 'b', 'l', 'e', '_', 'u', 'u', 'i', 'd', '_', 's', - 'e', 'r', 'v', 'e', 'r' }; - -static uint8_t ble_set_adv_flag_data(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - - ble_adv_flag adv_flags = { - .length = BLE_ADV_FLAG_LEN - BLE_GENERAL_BYTE_1, - .adv_data_type = 1, - .flags = BLE_ADV_FLAG_DATA, - }; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_flags, BLE_ADV_FLAG_LEN); - if (n_ret != EOK) { - return 0; - } - return BLE_ADV_FLAG_LEN; -} - -static uint8_t ble_set_adv_appearance(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - ble_appearance_st adv_appearance_data = { - .length = BLE_ADV_APPEARANCE_LENGTH - BLE_GENERAL_BYTE_1, - .adv_data_type = BLE_ADV_APPEARANCE_DATA_TYPE, - .catogory_id = { u16_low_u8(BLE_ADV_CATEGORY_KEYBOARD_VALUE), u16_high_u8(BLE_ADV_CATEGORY_KEYBOARD_VALUE) }, - }; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_appearance_data, BLE_ADV_APPEARANCE_LENGTH); - if (n_ret != EOK) { - return 0; - } - return BLE_ADV_APPEARANCE_LENGTH; -} - -static uint8_t ble_set_adv_name(uint8_t *set_adv_data_position, uint8_t max_len) -{ - errno_t n_ret; - uint8_t len; - ble_local_name_st adv_local_name_data = { 0 }; - adv_local_name_data.length = (uint8_t)(BLE_ADV_PARAM_DATATYPE_LENGTH + sizeof(g_local_name)); - adv_local_name_data.adv_data_type = BLE_ADV_LOCAL_NAME_DATA_TYPE; - len = BLE_ADV_PARAM_DATATYPE_LENGTH + BLE_ADV_PARAM_DATATYPE_LENGTH; - n_ret = memcpy_s(set_adv_data_position, max_len, &adv_local_name_data, len); - if (n_ret != EOK) { - return 0; - } - n_ret = memcpy_s((set_adv_data_position + len), (size_t)(max_len - len), g_local_name, sizeof(g_local_name)); - if (n_ret != EOK) { - return 0; - } - len = (uint8_t)(len + sizeof(g_local_name)); - return len; -} - -static uint8_t ble_set_adv_appearance_data(uint8_t *set_adv_data_position, uint8_t max_len) -{ - uint8_t idx = 0; - idx += ble_set_adv_appearance(set_adv_data_position, max_len); - idx += ble_set_adv_name(set_adv_data_position + idx, (max_len - idx)); - return idx; -} - -static uint16_t ble_uuid_server_set_adv_data(uint8_t *set_adv_data, uint8_t adv_data_max_len) -{ - uint8_t idx = 0; - - if ((set_adv_data == NULL) || (adv_data_max_len == 0)) { - return 0; - } - idx += ble_set_adv_flag_data(set_adv_data, adv_data_max_len); - idx += ble_set_adv_appearance_data(&set_adv_data[idx], adv_data_max_len - idx); - return idx; -} - -static uint16_t ble_set_scan_response_data(uint8_t *scan_rsp_data, uint8_t scan_rsp_data_max_len) -{ - uint8_t idx = 0; - errno_t n_ret; - - if (scan_rsp_data == NULL) { - return 0; - } - if (scan_rsp_data_max_len == 0) { - return 0; - } - - /* tx power level */ - ble_tx_power_level_st tx_power_level = { - .length = BLE_SCAN_RSP_TX_POWER_LEVEL_LEN - BLE_GENERAL_BYTE_1, - .adv_data_type = BLE_ADV_TX_POWER_LEVEL, - .tx_power_value = 0, - }; - - n_ret = memcpy_s(scan_rsp_data, scan_rsp_data_max_len, &tx_power_level, sizeof(ble_tx_power_level_st)); - if (n_ret != EOK) { - return 0; - } - idx += BLE_SCAN_RSP_TX_POWER_LEVEL_LEN; - - /* set local name */ - scan_rsp_data[idx++] = sizeof(g_local_name) + BLE_GENERAL_BYTE_1; - scan_rsp_data[idx++] = BLE_ADV_LOCAL_NAME_DATA_TYPE; - if ((idx + sizeof(g_local_name)) > scan_rsp_data_max_len) { - return 0; - } - n_ret = memcpy_s(&scan_rsp_data[idx], scan_rsp_data_max_len - idx, g_local_name, sizeof(g_local_name)); - if (n_ret != EOK) { - return 0; - } - idx += sizeof(g_local_name); - return idx; -} - -uint8_t ble_set_adv_data(void) -{ - errcode_t n_ret = 0; - uint16_t adv_data_len; - uint16_t scan_rsp_data_len; - uint8_t set_adv_data[EXT_ADV_OR_SCAN_RSP_DATA_LEN] = { 0 }; - uint8_t set_scan_rsp_data[EXT_ADV_OR_SCAN_RSP_DATA_LEN] = { 0 }; - gap_ble_config_adv_data_t cfg_adv_data; - - /* set adv data */ - adv_data_len = ble_uuid_server_set_adv_data(set_adv_data, EXT_ADV_OR_SCAN_RSP_DATA_LEN); - if ((adv_data_len > EXT_ADV_OR_SCAN_RSP_DATA_LEN) || (adv_data_len == 0)) { - return 0; - } - /* set scan response data */ - scan_rsp_data_len = ble_set_scan_response_data(set_scan_rsp_data, EXT_ADV_OR_SCAN_RSP_DATA_LEN); - if ((scan_rsp_data_len > EXT_ADV_OR_SCAN_RSP_DATA_LEN) || (scan_rsp_data_len == 0)) { - return 0; - } - cfg_adv_data.adv_data = set_adv_data; - cfg_adv_data.adv_length = adv_data_len; - - cfg_adv_data.scan_rsp_data = set_scan_rsp_data; - cfg_adv_data.scan_rsp_length = scan_rsp_data_len; - n_ret = gap_ble_set_adv_data(BTH_GAP_BLE_ADV_HANDLE_DEFAULT, &cfg_adv_data); - if (n_ret != 0) { - return 0; - } - return 0; -} - -uint8_t ble_start_adv(void) -{ - errcode_t n_ret = 0; - gap_ble_adv_params_t adv_para = {0}; - int adv_id = BTH_GAP_BLE_ADV_HANDLE_DEFAULT; - - adv_para.min_interval = BLE_ADV_MIN_INTERVAL; - adv_para.max_interval = BLE_ADV_MAX_INTERVAL; - adv_para.duration = BTH_GAP_BLE_ADV_FOREVER_DURATION; - adv_para.peer_addr.type = BLE_PUBLIC_DEVICE_ADDRESS; - /* 广播通道选择bitMap, 可参考BleAdvChannelMap */ - adv_para.channel_map = BLE_ADV_CHANNEL_MAP_CH_DEFAULT; - adv_para.adv_type = BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED; - adv_para.adv_filter_policy = BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY; - (void)memset_s(&adv_para.peer_addr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - n_ret = gap_ble_set_adv_param(adv_id, &adv_para); - if (n_ret != 0) { - return 0; - } - n_ret = gap_ble_start_adv(adv_id); - if (n_ret != 0) { - return 0; - } - return 0; -} diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/CMakeLists.txt b/application/samples/bt/ble/ble_wifi_cfg_client/CMakeLists.txt deleted file mode 100755 index 6924cde..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. -#=============================================================================== - -add_subdirectory_if_exist(src) -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_client.h b/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_client.h deleted file mode 100755 index fae2fd4..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_client.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BT config wifi Service client module. - */ -#ifndef BLE_WIFI_CFG_CLIENT_H -#define BLE_WIFI_CFG_CLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @if Eng - * @brief Use this funtion to init gatt client. - * @par Description:init gatt client. - * @attention NULL - * @param NULL - * @retval error code. - * @else - * @brief 初始化gatt 客户端。 - * @par 说明:初始化gatt 客户端。 - * @attention NULL - * @param NULL - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_wifi_cfg_client_init(void); - -/** - * @if Eng - * @brief discover all service, character and descriptor of remote device. - * @par Description:discover all service of remote device. - * @attention NULL - * @param conn_id connection ID - * @retval error code. - * @else - * @brief 发现对端设备所有服务、特征和描述符。 - * @par 说明:发现对端设备所有服务、特征和描述符。 - * @attention NULL - * @param conn_id 连接 ID - * @retval 执行结果错误码。 - * @endif - */ -errcode_t ble_wifi_cfg_client_discover_all_service(uint16_t conn_id); - -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_scan.h b/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_scan.h deleted file mode 100755 index 49d3842..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/inc/ble_wifi_cfg_scan.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BLE config wifi client scan. - */ -#ifndef BLE_WIFI_CFG_SCAN_H -#define BLE_WIFI_CFG_SCAN_H - -#include "errcode.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -errcode_t ble_wifi_device_start_scan(void); - -errcode_t ble_wifi_set_scan_parameters(void); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/src/CMakeLists.txt b/application/samples/bt/ble/ble_wifi_cfg_client/src/CMakeLists.txt deleted file mode 100755 index 61a09cf..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/src/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. -#=============================================================================== - -set( - ble_wifi_cfg_src_list - ${CMAKE_CURRENT_SOURCE_DIR}/ble_wifi_cfg_client.c - ${CMAKE_CURRENT_SOURCE_DIR}/ble_wifi_cfg_scan.c -) -set(SOURCES "${SOURCES}" "${ble_wifi_cfg_src_list}" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_client.c b/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_client.c deleted file mode 100755 index 6ae1a0c..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_client.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BT config wifi Service client module. - */ -#include "securec.h" -#include "osal_list.h" -#include "osal_debug.h" -#include "bts_le_gap.h" -#include "bts_gatt_client.h" -#include "ble_wifi_cfg_scan.h" - -#define UUID16_LEN 2 - -#define BLE_WIFI_CFG_CLIENT_LOG "[ble wifi cfg client]" -#define BLE_WIFI_CFG_CLIENT_ERROR "[ble wifi cfg error]" - -/* client id, invalid client id is "0" */ -uint8_t g_ble_wifi_cfg_client_id = 0; - -static uint16_t g_ble_wifi_cfg_conn_id = 0; - -/* max transport unit, default is 100 */ -static uint16_t g_ble_wifi_cfg_mtu = 100; - -/* client app uuid for test */ -static bt_uuid_t g_ble_wifi_cfg_client_app = {UUID16_LEN, {0}}; - - -uint8_t ble_wifi_adv_data[31] = {0x02, 0x01, 0x02, 0x13, 0xFF, 0x7D, 0x02, 0x0E, 0x70, 0x80, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x01, 0x06, 0xCA, 0x2D, 0x28, 0xA0, 0x9D, 0xA3, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -#define HW_ADV_DATA_LEN 0x17 - -static void ble_wifi_cfg_client_discover_service_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_service_result_t *service, errcode_t status) -{ - gattc_discovery_character_param_t param = {0}; - osal_printk("[GATTClient]Discovery service----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("start handle:%d end handle:%d uuid_len:%d\n uuid:", - service->start_hdl, service->end_hdl, service->uuid.uuid_len); - for (uint8_t i = 0; i < service->uuid.uuid_len; i++) { - osal_printk("%02x", service->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); - param.service_handle = service->start_hdl; - param.uuid.uuid_len = 0; /* uuid length is zero, discover all character */ - gattc_discovery_character(g_ble_wifi_cfg_client_id, conn_id, ¶m); -} - -static void ble_wifi_cfg_client_discover_character_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_result_t *character, errcode_t status) -{ - osal_printk("[GATTClient]Discovery character----client:%d conn_id:%d uuid_len:%d\n uuid:", - client_id, conn_id, character->uuid.uuid_len); - for (uint8_t i = 0; i < character->uuid.uuid_len; i++) { - osal_printk("%02x", character->uuid.uuid[i]); - } - osal_printk("\n declare handle:%d value handle:%d properties:%x\n", character->declare_handle, - character->value_handle, character->properties); - osal_printk(" status:%d\n", status); - gattc_discovery_descriptor(g_ble_wifi_cfg_client_id, conn_id, character->declare_handle); -} - -static void ble_wifi_cfg_client_discover_descriptor_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_descriptor_result_t *descriptor, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, descriptor->uuid.uuid_len); - for (uint8_t i = 0; i < descriptor->uuid.uuid_len; i++) { - osal_printk("%02x", descriptor->uuid.uuid[i]); - } - osal_printk("\n descriptor handle:%d\n", descriptor->descriptor_hdl); - osal_printk(" status:%d\n", status); -} - -static void ble_wifi_cfg_client_discover_service_compl_cbk(uint8_t client_id, uint16_t conn_id, bt_uuid_t *uuid, - errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery service complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, uuid->uuid_len); - for (uint8_t i = 0; i < uuid->uuid_len; i++) { - osal_printk("%02x", uuid->uuid[i]); - } - osal_printk("status:%d\n", status); -} - -static void ble_wifi_cfg_client_discover_character_compl_cbk(uint8_t client_id, uint16_t conn_id, - gattc_discovery_character_param_t *param, errcode_t status) -{ - osal_printk( - "[GATTClient]Discovery character complete----client:%d conn_id:%d uuid len:%d\n uuid:", - client_id, conn_id, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n service handle:%d\n", param->service_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_wifi_cfg_client_discover_descriptor_compl_cbk(uint8_t client_id, uint16_t conn_id, - uint16_t character_handle, errcode_t status) -{ - osal_printk("[GATTClient]Discovery descriptor complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" charatcer handle:%d\n", character_handle); - osal_printk(" status:%d\n", status); -} - -static void ble_wifi_cfg_client_read_cfm_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, - gatt_status_t status) -{ - osal_printk("[GATTClient]Read result----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", read_result->handle, read_result->data_len); - for (uint8_t i = 0; i < read_result->data_len; i++) { - osal_printk("%02x", read_result->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_wifi_cfg_client_read_compl_cbk(uint8_t client_id, uint16_t conn_id, - gattc_read_req_by_uuid_param_t *param, errcode_t status) -{ - osal_printk("[GATTClient]Read by uuid complete----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("start handle:%d end handle:%d uuid len:%d\n uuid:", - param->start_hdl, param->end_hdl, param->uuid.uuid_len); - for (uint8_t i = 0; i < param->uuid.uuid_len; i++) { - osal_printk("%02x", param->uuid.uuid[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_wifi_cfg_client_write_cfm_cbk(uint8_t client_id, uint16_t conn_id, - uint16_t handle, gatt_status_t status) -{ - osal_printk("[GATTClient]Write result----client:%d conn_id:%d handle:%d\n", client_id, conn_id, handle); - osal_printk(" status:%d\n", status); -} - -static void ble_wifi_cfg_client_mtu_changed_cbk(uint8_t client_id, uint16_t conn_id, - uint16_t mtu_size, errcode_t status) -{ - osal_printk("[GATTClient]Mtu changed----client:%d conn_id:%d mtu size:%d\n", client_id, conn_id, - mtu_size); - osal_printk("status:%d\n", status); -} - -static void ble_wifi_cfg_client_notification_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - osal_printk("[GATTClient]Receive notification----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk("handle:%d data_len:%d\ndata:", data->handle, data->data_len); - for (uint8_t i = 0; i < data->data_len; i++) { - osal_printk("%02x", data->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -static void ble_wifi_cfg_client_indication_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, - errcode_t status) -{ - osal_printk("[GATTClient]Receive indication----client:%d conn_id:%d\n", client_id, conn_id); - osal_printk(" handle:%d data_len:%d\ndata:", data->handle, data->data_len); - for (uint8_t i = 0; i < data->data_len; i++) { - osal_printk("%02x", data->data[i]); - } - osal_printk("\n status:%d\n", status); -} - -/* ble client set scan param callback */ -void ble_wifi_cfg_set_scan_param_cbk(errcode_t status) -{ - osal_printk("%s set scan param status: %d\n", 0, status); - gap_ble_remove_all_pairs(); /* 配网业务无需多连接,因此扫描时需将其他设备断开, 然后扫描配对新设备 */ - ble_wifi_device_start_scan(); -} - -/* ble client scan result callback */ -void ble_wifi_cfg_scan_result_cbk(gap_scan_result_data_t *scan_result_data) -{ - if (memcmp(scan_result_data->adv_data, ble_wifi_adv_data, HW_ADV_DATA_LEN) == 0) { - gap_ble_stop_scan(); - osal_printk("\naddr:"); - for (uint8_t i = 0; i < BD_ADDR_LEN; i++) { - osal_printk(" %02x: ", scan_result_data->addr.addr[i]); - } - bd_addr_t client_addr = { 0 }; - client_addr.type = scan_result_data->addr.type; - if (memcpy_s(client_addr.addr, BD_ADDR_LEN, scan_result_data->addr.addr, BD_ADDR_LEN) != EOK) { - osal_printk("%s add server app addr memcpy failed\r\n", BLE_WIFI_CFG_CLIENT_ERROR); - return; - } - gap_ble_connect_remote_device(&client_addr); - } -} - -/* ble client connect state change callback */ -void ble_wifi_cfg_connect_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, - gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - bd_addr_t client_addr = { 0 }; - client_addr.type = addr->type; - g_ble_wifi_cfg_conn_id = conn_id; - if (memcpy_s(client_addr.addr, BD_ADDR_LEN, addr->addr, BD_ADDR_LEN) != EOK) { - osal_printk("%s add server app addr memcpy failed\r\n", BLE_WIFI_CFG_CLIENT_ERROR); - return; - } - osal_printk("%s connect state change conn_id: %d, status: %d, pair_status:%d, disc_reason %x\n", - 0, conn_id, conn_state, pair_state, disc_reason); - - if (conn_state == GAP_BLE_STATE_CONNECTED && pair_state == GAP_BLE_PAIR_NONE) { - osal_printk("%s connect change cbk conn_id =%d \n", 0, conn_id); - gattc_exchange_mtu_req(g_ble_wifi_cfg_client_id, g_ble_wifi_cfg_conn_id, g_ble_wifi_cfg_mtu); - } else if (conn_state == GAP_BLE_STATE_DISCONNECTED) { - osal_printk("%s connect change cbk conn disconnected \n", 0); - return; - } -} - -/* ble client pair result callback */ -void ble_wifi_cfg_pair_result_cb(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - osal_printk("%s pair result conn_id: %d,status: %d \n", 0, conn_id, status); - osal_printk("addr:\n"); - for (uint8_t i = 0; i < BD_ADDR_LEN; i++) { - osal_printk("%2x", addr->addr[i]); - } - osal_printk("\n"); - gattc_exchange_mtu_req(g_ble_wifi_cfg_client_id, g_ble_wifi_cfg_conn_id, - g_ble_wifi_cfg_mtu); -} - - -errcode_t ble_wifi_cfg_client_callback_register(void) -{ - errcode_t ret = ERRCODE_BT_UNHANDLED; - gap_ble_callbacks_t gap_cb = { 0 }; - gattc_callbacks_t cb = {0}; - - gap_cb.set_scan_param_cb = ble_wifi_cfg_set_scan_param_cbk; - gap_cb.scan_result_cb = ble_wifi_cfg_scan_result_cbk; - gap_cb.conn_state_change_cb = ble_wifi_cfg_connect_change_cbk; - gap_cb.pair_result_cb = ble_wifi_cfg_pair_result_cb; - ret = gap_ble_register_callbacks(&gap_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("%s reg gap cbk failed ret = %d\n", 0, ret); - } - - cb.discovery_svc_cb = ble_wifi_cfg_client_discover_service_cbk; - cb.discovery_svc_cmp_cb = ble_wifi_cfg_client_discover_service_compl_cbk; - cb.discovery_chara_cb = ble_wifi_cfg_client_discover_character_cbk; - cb.discovery_chara_cmp_cb = ble_wifi_cfg_client_discover_character_compl_cbk; - cb.discovery_desc_cb = ble_wifi_cfg_client_discover_descriptor_cbk; - cb.discovery_desc_cmp_cb = ble_wifi_cfg_client_discover_descriptor_compl_cbk; - cb.read_cb = ble_wifi_cfg_client_read_cfm_cbk; - cb.read_cmp_cb = ble_wifi_cfg_client_read_compl_cbk; - cb.write_cb = ble_wifi_cfg_client_write_cfm_cbk; - cb.mtu_changed_cb = ble_wifi_cfg_client_mtu_changed_cbk; - cb.notification_cb = ble_wifi_cfg_client_notification_cbk; - cb.indication_cb = ble_wifi_cfg_client_indication_cbk; - ret = gattc_register_callbacks(&cb); - - return ret; -} - -errcode_t ble_wifi_cfg_client_init(void) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - ret |= enable_ble(); - ret |= ble_wifi_cfg_client_callback_register(); - ret |= gattc_register_client(&g_ble_wifi_cfg_client_app, &g_ble_wifi_cfg_client_id); - return ret; -} - -errcode_t ble_wifi_cfg_client_discover_all_service(uint16_t conn_id) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - bt_uuid_t service_uuid = {0}; /* uuid length is zero, discover all service */ - ret |= gattc_discovery_service(g_ble_wifi_cfg_client_id, conn_id, &service_uuid); - return ret; -} - diff --git a/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_scan.c b/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_scan.c deleted file mode 100755 index 6934c38..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_client/src/ble_wifi_cfg_scan.c +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BLE config wifi client scan -*/ - -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "ble_wifi_cfg_scan.h" - -static uint16_t scan_interval = 0x48; -static uint16_t scan_window = 0x48; -static uint8_t scan_type = 0x00; -static uint8_t scan_phy = 0x01; -static uint8_t scan_filter_policy = 0x00; - -errcode_t ble_wifi_set_scan_parameters(void) -{ - gap_ble_scan_params_t ble_device_scan_params = { 0 }; - ble_device_scan_params.scan_interval = scan_interval; - ble_device_scan_params.scan_window = scan_window; - ble_device_scan_params.scan_type = scan_type; - ble_device_scan_params.scan_phy = scan_phy; - ble_device_scan_params.scan_filter_policy = scan_filter_policy; - return gap_ble_set_scan_parameters(&ble_device_scan_params); -} - -errcode_t ble_wifi_device_start_scan(void) -{ - return gap_ble_start_scan(); -} \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/CMakeLists.txt b/application/samples/bt/ble/ble_wifi_cfg_server/CMakeLists.txt deleted file mode 100755 index 6924cde..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. -#=============================================================================== - -add_subdirectory_if_exist(src) -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_adv.h b/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_adv.h deleted file mode 100755 index d661016..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_adv.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BLE ADV Config. - */ -#ifndef BLE_WIFI_CFG_ADV_H -#define BLE_WIFI_CFG_ADV_H - -#include "bts_def.h" - -/* Ble keyboard categorylength */ -#define BLE_ADV_CATEGORY_LEN 2 - -/** - * @if Eng - * @brief Definitaion of BLE device appearance struct. - * @else - * @brief BLE 广播设备外观结构。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv appearance data length. - @else 设备外观数据类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv appearance data type. - @else 设备外观数据类型 */ - uint8_t catogory_id[BLE_ADV_CATEGORY_LEN]; /*!< @if Eng adv appearance data. - @else 设备外观数据 */ -} ble_appearance_st; - -/** - * @if Eng - * @brief Definitaion of BLE device name. - * @else - * @brief BLE 广播设备名称。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv device name length. - @else 广播设备名称类型长度 */ - uint8_t adv_data_type; /*!< @if Eng adv name data type. - @else 设备名称类型 */ - int8_t *name; /*!< @if Eng adv name data. - @else 设备名称数据指针 */ -} ble_local_name_st; - -/** - * @if Eng - * @brief Definitaion of BLE Tx power. - * @else - * @brief BLE 广播发送功率。 - * @endif - */ -typedef struct { - uint8_t length; /*!< @if Eng adv tx power length. - @else 广播发送功率长度 */ - uint8_t adv_data_type; /*!< @if Eng adv tx power type. - @else 广播发送数据类型 */ - uint8_t tx_power_value; /*!< @if Eng adv tx power value. - @else 广播发送数据 */ -} ble_tx_power_level_st; - -/** - * @if Eng - * @brief Definitaion value range for typedef struct ble_adv_para.adv_filter_policy. - * @else - * @brief Ble adv filter policy定义值范围。 - * @endif - */ -typedef enum ble_adv_filter_policy { - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY = 0x00, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_ANY = 0x01, - BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_WHITE_LIST = 0x02, - BLE_ADV_FILTER_POLICY_SCAN_WHITE_LIST_CONNECT_WHITE_LIST = 0x03 -} ble_adv_filter_policy_t; - -/** - * @if Eng - * @brief Definitaion value range for adv type. - * @else - * @brief Ble adv 类型范围。 - * @endif - */ -typedef enum ble_adverting_type { - BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED = 0x00, - BLE_ADV_TYPE_CONNECTABLE_HIGH_DUTY_CYCLE_DIRECTED = 0x01, - BLE_ADV_TYPE_SCANNABLE_UNDIRECTED = 0x02, - BLE_ADV_TYPE_NON_CONNECTABLE_UNDIRECTED = 0x03, - BLE_ADV_TYPE_CONNECTABLE_LOW_DUTY_CYCLE_DIRECTED = 0x04 -} ble_adverting_type_t; - - -/** - * @if Eng - * @brief Definitaion value range for adv channel map. - * @else - * @brief Ble 广播信道范围。 - * @endif - */ -typedef enum ble_adv_channel_map { - BLE_ADV_CHANNEL_MAP_CH_37 = 0x01, - BLE_ADV_CHANNEL_MAP_CH_38 = 0x02, - BLE_ADV_CHANNEL_MAP_CH_39 = 0x04, - BLE_ADV_CHANNEL_MAP_CH_37_CH_38 = 0x03, - BLE_ADV_CHANNEL_MAP_CH_37_CH_39 = 0x05, - BLE_ADV_CHANNEL_MAP_CH_38_CH_39 = 0x06, - BLE_ADV_CHANNEL_MAP_CH_DEFAULT = 0x07 -} ble_adv_channel_map_t; - -/** - * @if Eng - * @brief Definitaion value range for adv addr type. - * @else - * @brief Ble 广播地址类型。 - * @endif - */ -typedef enum { - BLE_PUBLIC_DEVICE_ADDRESS = 0x00, - BLE_RANDOM_DEVICE_ADDRESS = 0x01, - BLE_PUBLIC_IDENTITY_ADDRESS = 0x02, - BLE_RANDOM_STATIC_IDENTITY_ADDRESS = 0x03 -} ble_address_type; - -/* Ble adv min interval */ -#define BLE_ADV_MIN_INTERVAL 0x20 -/* Ble adv max interval */ -#define BLE_ADV_MAX_INTERVAL 0x60 -/* Ble adv handle */ -#define BTH_GAP_BLE_ADV_HANDLE_DEFAULT 0x01 -/* Ble adv duration */ -#define BTH_GAP_BLE_ADV_FOREVER_DURATION 0 - -/** - * @if Eng - * @brief Enable BLE adv. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 使能BLE广播。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_start_adv(void); - -/** - * @if Eng - * @brief BLE adv data config. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE广播数据配置。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -uint8_t ble_set_adv_data(void); - -uint8_t ble_wifi_cfg_start_adv(void); -#endif - diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_server.h b/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_server.h deleted file mode 100755 index 5ef868f..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/inc/ble_wifi_cfg_server.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: BLE UUID Server module. - */ -#ifndef BLE_WIFI_CFG_SERVER_H -#define BLE_WIFI_CFG_SERVER_H - -#include "bts_def.h" - -/* Characteristic Property */ -#define BLE_WIFI_CFG_PROPERTIES (GATT_CHARACTER_PROPERTY_BIT_NOTIFY | GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP) - -/* Characteristic Property */ -#define UUID_SERVER_IND_PROPERTIES (GATT_CHARACTER_PROPERTY_BIT_INDICATE | GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP) - -/** - * @if Eng - * @brief BLE uuid server inir. - * @attention NULL - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief BLE UUID服务器初始化。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_wifi_cfg_server_init(void); - -/** - * @if Eng - * @brief send data to peer device by wifi server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过wifi server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_wifi_cfg_server_send_report_by_uuid(const uint8_t *data, uint32_t len); - -/** - * @if Eng - * @brief send data to peer device by handle on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval BT_STATUS_SUCCESS Excute successfully - * @retval BT_STATUS_FAIL Execute fail - * @par Dependency: - * @li bts_def.h - * @else - * @brief 通过wifi server 发送数据给对端。 - * @attention NULL - * @retval BT_STATUS_SUCCESS 执行成功 - * @retval BT_STATUS_FAIL 执行失败 - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t ble_wifi_cfg_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len); - -#endif \ No newline at end of file diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/src/CMakeLists.txt b/application/samples/bt/ble/ble_wifi_cfg_server/src/CMakeLists.txt deleted file mode 100755 index edf0641..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. -#=============================================================================== - -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_wifi_cfg_adv.c" - "${CMAKE_CURRENT_SOURCE_DIR}/ble_wifi_cfg_server.c" - PARENT_SCOPE) diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_adv.c b/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_adv.c deleted file mode 100755 index 2aed169..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_adv.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: adv config for ble uuid server. - */ -#include -#include -#include -#include -#include "osal_addr.h" -#include "osal_debug.h" -#include "securec.h" -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "ble_wifi_cfg_adv.h" - -#define NAME_MAX_LENGTH 15 -#define EXT_ADV_OR_SCAN_RSP_DATA_LEN 251 -#define HW_ADV_DATA_LEN 0x17 - -/* Ble Adv data length */ -#define BLE_GENERAL_BYTE_1 1 -/* Ble name adv name type */ -#define BLE_ADV_LOCAL_NAME_DATA_TYPE 0x09 -/* Ble name adv tx power type */ -#define BLE_ADV_TX_POWER_LEVEL 0x0A -/* Ble name adv tx power response type */ -#define BLE_SCAN_RSP_TX_POWER_LEVEL_LEN 0x03 - -uint8_t g_device_name[ NAME_MAX_LENGTH] = { 'b', 'l', 'e', '_', 'w', 'i', 'f', 'i', '_', 'c', - 'o', 'n', 'f', 'i', 'g' }; - -uint8_t g_adv_data[31] = {0x02, 0x01, 0x02, 0x13, 0xFF, 0x7D, 0x02, 0x0E, 0x70, 0x80, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x01, 0x06, 0xCA, 0x2D, 0x28, 0xA0, 0x9D, 0xA3, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static uint16_t ble_set_scan_response_data(uint8_t *scan_rsp_data, uint8_t scan_rsp_data_max_len) -{ - uint8_t idx = 0; - errno_t n_ret; - - if (scan_rsp_data == NULL) { - return 0; - } - if (scan_rsp_data_max_len == 0) { - return 0; - } - - /* tx power level */ - ble_tx_power_level_st tx_power_level = { - .length = BLE_SCAN_RSP_TX_POWER_LEVEL_LEN - BLE_GENERAL_BYTE_1, - .adv_data_type = BLE_ADV_TX_POWER_LEVEL, - .tx_power_value = 0, - }; - - n_ret = memcpy_s(scan_rsp_data, scan_rsp_data_max_len, &tx_power_level, sizeof(ble_tx_power_level_st)); - if (n_ret != EOK) { - return 0; - } - idx += BLE_SCAN_RSP_TX_POWER_LEVEL_LEN; - - /* set local name */ - scan_rsp_data[idx++] = sizeof(g_device_name) + BLE_GENERAL_BYTE_1; - scan_rsp_data[idx++] = BLE_ADV_LOCAL_NAME_DATA_TYPE; - if ((idx + sizeof(g_device_name)) > scan_rsp_data_max_len) { - return 0; - } - n_ret = memcpy_s(&scan_rsp_data[idx], scan_rsp_data_max_len - idx, g_device_name, sizeof(g_device_name)); - if (n_ret != EOK) { - return 0; - } - idx += sizeof(g_device_name); - return idx; -} - -uint8_t ble_wifi_cfg_set_adv_data(void) -{ - errcode_t n_ret = 0; - uint16_t scan_rsp_data_len; - uint8_t set_scan_rsp_data[EXT_ADV_OR_SCAN_RSP_DATA_LEN] = { 0 }; - gap_ble_config_adv_data_t cfg_adv_data; - - /* set scan response data */ - scan_rsp_data_len = ble_set_scan_response_data(set_scan_rsp_data, EXT_ADV_OR_SCAN_RSP_DATA_LEN); - if ((scan_rsp_data_len > EXT_ADV_OR_SCAN_RSP_DATA_LEN) || (scan_rsp_data_len == 0)) { - return 0; - } - cfg_adv_data.adv_data = g_adv_data; - cfg_adv_data.adv_length = HW_ADV_DATA_LEN; - - cfg_adv_data.scan_rsp_data = set_scan_rsp_data; - cfg_adv_data.scan_rsp_length = scan_rsp_data_len; - - osal_printk("[uplus][debug] uplus_ble_gap_adv_data_set adv_length=%x, adv_data=", - cfg_adv_data.adv_length); - for (int i = 0; i < cfg_adv_data.adv_length; i++) { - osal_printk(" %02x", cfg_adv_data.adv_data[i]); - } - osal_printk("\n[uplus][debug] uplus_ble_gap_adv_data_set scan_rsp_length=%x, scan_rsp_data=", - cfg_adv_data.scan_rsp_length); - for (int i = 0; i < cfg_adv_data.scan_rsp_length; i++) { - osal_printk(" %02x", cfg_adv_data.scan_rsp_data[i]); - } - osal_printk("\n"); - n_ret = gap_ble_set_adv_data(BTH_GAP_BLE_ADV_HANDLE_DEFAULT, &cfg_adv_data); - if (n_ret != 0) { - return 0; - } - return 0; -} - -uint8_t ble_wifi_cfg_start_adv(void) -{ - errcode_t n_ret = 0; - gap_ble_adv_params_t adv_para = {0}; - - ble_wifi_cfg_set_adv_data(); - adv_para.min_interval = BLE_ADV_MIN_INTERVAL; - adv_para.max_interval = BLE_ADV_MAX_INTERVAL; - adv_para.duration = BTH_GAP_BLE_ADV_FOREVER_DURATION; - adv_para.peer_addr.type = BLE_PUBLIC_DEVICE_ADDRESS; - /* 广播通道选择bitMap, 可参考BleAdvChannelMap */ - adv_para.channel_map = BLE_ADV_CHANNEL_MAP_CH_DEFAULT; - adv_para.adv_type = BLE_ADV_TYPE_CONNECTABLE_UNDIRECTED; - adv_para.adv_filter_policy = BLE_ADV_FILTER_POLICY_SCAN_ANY_CONNECT_ANY; - (void)memset_s(&adv_para.peer_addr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - n_ret = gap_ble_set_adv_param(BTH_GAP_BLE_ADV_HANDLE_DEFAULT, &adv_para); - if (n_ret != 0) { - return 0; - } - n_ret = gap_ble_start_adv(BTH_GAP_BLE_ADV_HANDLE_DEFAULT); - if (n_ret != 0) { - return 0; - } - return 0; -} diff --git a/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_server.c b/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_server.c deleted file mode 100755 index 60e0aa0..0000000 --- a/application/samples/bt/ble/ble_wifi_cfg_server/src/ble_wifi_cfg_server.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: ble wifi config server sample. - */ - -#include -#include -#include -#include -#include "osal_addr.h" -#include "osal_debug.h" -#include "bts_def.h" -#include "securec.h" -#include "errcode.h" -#include "bts_def.h" -#include "bts_le_gap.h" -#include "bts_gatt_stru.h" -#include "bts_gatt_server.h" -#include "ble_wifi_cfg_server.h" - -/* server app uuid for test */ -char g_app_uuid[] = {0x0, 0x0}; - -/* ble service att handle */ -uint16_t g_service_hdl; - -/* ble chara handle trans wifi cfg info */ -uint16_t g_chara_cfg_hdl = 0; - -/* ble chara handle trans wifi list req&resp */ -uint16_t g_chara_wifi_list_hdl = 0; - -/* ble indication att handle */ -uint16_t g_ind_crt_att_hdl = 0; - -/* ble notification att handle */ -uint16_t g_ntf_crt_att_hdl = 0; - -uint16_t g_descriptor_report_hdl = 0; -uint16_t g_descriptor_ctrl_hdl = 0; -uint16_t g_descriptor_cfg_hdl = 0; - -/* ble connect handle */ -uint16_t g_conn_handle = 0; - -#define OCTET_BIT_LEN 8 -#define UUID_LEN_2 2 -#define CCC_UUID 0x2902 - -/* Service UUID */ -#define BLE_WIFI_CFG_SERVICE 0xfd5c -/* Characteristic Control Information UUID */ -#define BLE_WIFI_CFG_CONTROL_INFO 0xfd5d -/* Client Characteristic Configuration Wi-Fi Information UUID */ -#define BLE_WIFI_CFG_INFORMATION 0xfd5e -/* Client AP Lists Req/Resp Configuration UUID */ -#define BLE_WIFI_CFG_REQ_REPORT 0xfd5f - -/* Client Characteristic Configuration UUID */ -#define BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION 0x2902 - -/* Server ID */ -#define BLE_WIFI_CFG_SERVER_ID 1 -/* Wifi Configure Write Characteristic */ -#define BLE_WIFI_CFG_CHARACTER_VALUE_1 0x12 -#define BLE_WIFI_CFG_CHARACTER_VALUE_2 0x34 -#define BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_0 0X00 -#define BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_2 0X02 - -extern void set_wifi_cfg_info(uint8_t *info, uint16_t info_len); -extern int bgwc_wifi_list_resp_send(uint16_t handle); - -/* 将uint16的uuid数字转化为bt_uuid_t */ -void streams_data_to_uuid(uint16_t uuid_data, bt_uuid_t *out_uuid) -{ - char uuid[] = {(uint8_t)(uuid_data >> OCTET_BIT_LEN), (uint8_t)uuid_data}; - out_uuid->uuid_len = UUID_LEN_2; - if (memcpy_s(out_uuid->uuid, out_uuid->uuid_len, uuid, UUID_LEN_2) != EOK) { - return; - } -} - -errcode_t service_uuid_compare(bt_uuid_t *uuid1, bt_uuid_t *uuid2) -{ - if (uuid1->uuid_len != uuid2->uuid_len) { - return ERRCODE_BT_FAIL; - } - if (memcmp(uuid1->uuid, uuid2->uuid, uuid1->uuid_len) != 0) { - return ERRCODE_BT_FAIL; - } - return ERRCODE_BT_SUCCESS; -} - -/* 开始服务回调 */ -static void ble_wifi_cfg_server_service_start_cbk(uint8_t server_id, uint16_t handle, errcode_t status) -{ - osal_printk("[wifi_cfg_server] start service cbk : server: %d status: %d srv_hdl: %d\n", server_id, status, - handle); -} - -static void ble_wifi_cfg_server_receive_write_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_write_cb_t *write_cb_para, errcode_t status) -{ - osal_printk("[wifi_cfg_server]ReceiveWriteReqCallback--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_prep:%d\n", - write_cb_para->request_id, write_cb_para->handle, write_cb_para->offset, write_cb_para->need_rsp, - write_cb_para->need_authorize, write_cb_para->is_prep); - osal_printk("data_len:%d data:\n", write_cb_para->length); - for (uint8_t i = 0; i < write_cb_para->length; i++) { - osal_printk("%02x ", write_cb_para->value[i]); - } - osal_printk("\n"); - osal_printk("status:%d\n", status); - - if (write_cb_para->handle == g_chara_cfg_hdl) { - set_wifi_cfg_info(write_cb_para->value, write_cb_para->length); - } - if (write_cb_para->handle == g_chara_wifi_list_hdl) { - bgwc_wifi_list_resp_send(write_cb_para->handle); - } -} - -static void ble_wifi_cfg_server_receive_read_req_cbk(uint8_t server_id, uint16_t conn_id, - gatts_req_read_cb_t *read_cb_para, errcode_t status) -{ - osal_printk("[wifi_cfg_server]ReceiveReadReq--server_id:%d conn_id:%d\n", server_id, conn_id); - osal_printk("request_id:%d att_handle:%d offset:%d need_rsp:%d need_authorize:%d is_long:%d\n", - read_cb_para->request_id, read_cb_para->handle, read_cb_para->offset, read_cb_para->need_rsp, - read_cb_para->need_authorize, read_cb_para->is_long); - osal_printk("status:%d\n", status); -} - -static void ble_wifi_cfg_server_adv_enable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv enable adv_id: %d, status:%d\n", adv_id, status); -} - -static void ble_wifi_cfg_server_adv_disable_cbk(uint8_t adv_id, adv_status_t status) -{ - osal_printk("adv disable adv_id: %d, status:%d\n", adv_id, status); -} - -void ble_wifi_cfg_server_connect_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, - gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) -{ - osal_printk("connect state change conn_id: %d, status: %d, pair_status:%d, addr %x disc_reason %x\n", - conn_id, conn_state, pair_state, addr[0], disc_reason); - g_conn_handle = conn_id; -} - -void ble_wifi_cfg_server_mtu_changed_cbk(uint8_t server_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - osal_printk("mtu change change server_id: %d, conn_id: %d, mtu_size: %d, status:%d \n", server_id, conn_id, - mtu_size, status); -} - -void ble_wifi_cfg_server_enable_cbk(errcode_t status) -{ - osal_printk("enable status: %d\n", status); -} - -static errcode_t ble_wifi_cfg_server_register_callbacks(void) -{ - errcode_t ret; - gap_ble_callbacks_t gap_cb = { 0 }; - gatts_callbacks_t service_cb = { 0 }; - - gap_cb.start_adv_cb = ble_wifi_cfg_server_adv_enable_cbk; - gap_cb.stop_adv_cb = ble_wifi_cfg_server_adv_disable_cbk; - gap_cb.conn_state_change_cb = ble_wifi_cfg_server_connect_change_cbk; - gap_cb.ble_enable_cb = ble_wifi_cfg_server_enable_cbk; - ret = gap_ble_register_callbacks(&gap_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[wifi_cfg_server] reg gap cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - - service_cb.start_service_cb = ble_wifi_cfg_server_service_start_cbk; - service_cb.read_request_cb = ble_wifi_cfg_server_receive_read_req_cbk; - service_cb.write_request_cb = ble_wifi_cfg_server_receive_write_req_cbk; - service_cb.mtu_changed_cb = ble_wifi_cfg_server_mtu_changed_cbk; - ret = gatts_register_callbacks(&service_cb); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[wifi_cfg_server] reg service cbk failed\r\n"); - return ERRCODE_BT_FAIL; - } - return ret; -} - -static void wifi_cfg_add_character_control_point(uint8_t server_id, uint16_t srvc_handle) -{ - gatts_add_chara_info_t character = { 0 }; - gatts_add_character_result_t add_character_result = { 0 }; - uint8_t character_value[] = {BLE_WIFI_CFG_CHARACTER_VALUE_1, BLE_WIFI_CFG_CHARACTER_VALUE_2}; - uint8_t ccc_value_indicate[UUID_LEN_2] = {BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_2, - BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_0}; - gatts_add_desc_info_t ccc = { { UUID_LEN_2, { 0 } }, - GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE, - UUID_LEN_2, - NULL }; - streams_data_to_uuid(BLE_WIFI_CFG_CONTROL_INFO, &character.chara_uuid); - character.properties = BLE_WIFI_CFG_PROPERTIES; - character.permissions = 0; - character.value_len = sizeof(character_value); - character.value = character_value; - gatts_add_characteristic_sync(server_id, srvc_handle, &character, &add_character_result); - - ccc.desc_uuid.uuid[0] = BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION >> 8; /* 8: octet bit num */ - ccc.desc_uuid.uuid[1] = (uint8_t)BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION; - ccc.value = ccc_value_indicate; - gatts_add_descriptor_sync(server_id, srvc_handle, &ccc, &g_descriptor_ctrl_hdl); -} - -static void wifi_cfg_add_character_cfg_info(uint8_t server_id, uint16_t srvc_handle) -{ - gatts_add_chara_info_t character = { 0 }; - gatts_add_character_result_t add_character_result = { 0 }; - uint8_t character_value[] = {BLE_WIFI_CFG_CHARACTER_VALUE_1, BLE_WIFI_CFG_CHARACTER_VALUE_2}; - uint8_t ccc_value_indicate[UUID_LEN_2] = {BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_2, - BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_0}; - gatts_add_desc_info_t ccc = { { UUID_LEN_2, { 0 } }, - GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE, - UUID_LEN_2, - NULL }; - - streams_data_to_uuid(BLE_WIFI_CFG_INFORMATION, &character.chara_uuid); - character.properties = UUID_SERVER_IND_PROPERTIES; - character.permissions = 0; - character.value_len = sizeof(character_value); - character.value = character_value; - gatts_add_characteristic_sync(server_id, srvc_handle, &character, &add_character_result); - g_chara_cfg_hdl = add_character_result.value_handle; - - ccc.desc_uuid.uuid[0] = BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION >> 8; /* 8: octet bit num */ - ccc.desc_uuid.uuid[1] = (uint8_t)BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION; - ccc.value = ccc_value_indicate; - gatts_add_descriptor_sync(server_id, srvc_handle, &ccc, &g_descriptor_cfg_hdl); -} - -static void wifi_cfg_add_character_req_report(uint8_t server_id, uint16_t srvc_handle) -{ - gatts_add_chara_info_t character = { 0 }; - gatts_add_character_result_t add_character_result = { 0 }; - uint8_t character_value[] = {BLE_WIFI_CFG_CHARACTER_VALUE_1, BLE_WIFI_CFG_CHARACTER_VALUE_2}; - uint8_t ccc_value_indicate[UUID_LEN_2] = {BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_2, - BLE_WIFI_CFG_CHARACTER_VALUE_INDICATE_0}; - gatts_add_desc_info_t ccc = { { UUID_LEN_2, { 0 } }, - GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE, - UUID_LEN_2, - NULL }; - streams_data_to_uuid(BLE_WIFI_CFG_REQ_REPORT, &character.chara_uuid); - character.properties = BLE_WIFI_CFG_PROPERTIES; - character.permissions = 0; - character.value_len = sizeof(character_value); - character.value = character_value; - gatts_add_characteristic_sync(server_id, srvc_handle, &character, &add_character_result); - g_chara_wifi_list_hdl = add_character_result.value_handle; - - ccc.desc_uuid.uuid[0] = BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION >> 8; /* 8: octet bit num */ - ccc.desc_uuid.uuid[1] = (uint8_t)BLE_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION; - ccc.value = ccc_value_indicate; - gatts_add_descriptor_sync(server_id, srvc_handle, &ccc, &g_descriptor_report_hdl); -} - -errcode_t wifi_cfg_server_service(void) -{ - errcode_t ret; - osal_printk("[wifi_cfg_server] ble uuid add service in\r\n"); - - /* Add Wifi Configure Service */ - bt_uuid_t service_uuid = { 0 }; - streams_data_to_uuid(BLE_WIFI_CFG_SERVICE, &service_uuid); - ret = gatts_add_service_sync(BLE_WIFI_CFG_SERVER_ID, &service_uuid, true, &g_service_hdl); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[wifi_cfg_server_service] reg service failed, ret=%x\r\n", ret); - return ret; - } - - /* Configure Trans Control Info Characteristic */ - wifi_cfg_add_character_control_point(BLE_WIFI_CFG_SERVER_ID, g_service_hdl); - /* Configure Trans Wi-Fi Info Characteristic */ - wifi_cfg_add_character_cfg_info(BLE_WIFI_CFG_SERVER_ID, g_service_hdl); - /* Configure Trans Wi-Fi Req/Resp info Characteristic */ - wifi_cfg_add_character_req_report(BLE_WIFI_CFG_SERVER_ID, g_service_hdl); - - gatts_start_service(BLE_WIFI_CFG_SERVER_ID, g_service_hdl); - osal_printk("[wifi_cfg_server] ble uuid add service out\r\n"); - return ERRCODE_BT_SUCCESS; -} - -errcode_t ble_wifi_gatts_register_server(void) -{ - uint8_t server_handle; - bt_uuid_t app_uuid = { 0 }; - app_uuid.uuid_len = sizeof(g_app_uuid); - if (memcpy_s(app_uuid.uuid, app_uuid.uuid_len, g_app_uuid, sizeof(g_app_uuid)) != EOK) { - return ERRCODE_BT_FAIL; - } - - osal_printk("[wifi_cfg_server] gatts_register_server begin\r\n"); - return gatts_register_server(&app_uuid, &server_handle); -} - -/* 初始化ble wifi cfg server service */ -errcode_t ble_wifi_cfg_server_init(void) -{ - errcode_t ret = ERRCODE_BT_SUCCESS; - ret |= enable_ble(); - ret |= ble_wifi_cfg_server_register_callbacks(); - ret |= ble_wifi_gatts_register_server(); - ret |= wifi_cfg_server_service(); - if (ret != ERRCODE_BT_SUCCESS) { - osal_printk("[wifi_cfg_server] init fail.\r\n"); - } else { - osal_printk("[wifi_cfg_server] init ok\r\n"); - } - return ret; -} - -/* device通过uuid向host发送数据:report */ -errcode_t ble_wifi_cfg_server_send_report_by_uuid(const uint8_t *data, uint32_t len) -{ - gatts_ntf_ind_by_uuid_t param = { 0 }; - uint16_t conn_id = g_conn_handle; - param.start_handle = 0; - param.end_handle = 0xffff; - streams_data_to_uuid(BLE_WIFI_CFG_CONTROL_INFO, ¶m.chara_uuid); - param.value_len = len; - param.value = osal_vmalloc(len); - - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[hid][ERROR]send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate_by_uuid(BLE_WIFI_CFG_SERVER_ID, conn_id, ¶m); - osal_vfree(param.value); - return ERRCODE_BT_SUCCESS; -} - -/* device通过handle向host发送数据:report */ -errcode_t ble_wifi_cfg_server_send_report_by_handle(uint16_t attr_handle, const uint8_t *data, uint8_t len) -{ - gatts_ntf_ind_t param = { 0 }; - uint16_t conn_id = g_conn_handle; - - param.attr_handle = attr_handle; - param.value = osal_vmalloc(len); - param.value_len = len; - - if (param.value == NULL) { - osal_printk("[hid][ERROR]send report new fail\r\n"); - return ERRCODE_BT_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[hid][ERROR]send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_BT_FAIL; - } - gatts_notify_indicate(BLE_WIFI_CFG_SERVER_ID, conn_id, ¶m); - osal_vfree(param.value); - return ERRCODE_BT_SUCCESS; -} diff --git a/application/samples/bt/sle/CMakeLists.txt b/application/samples/bt/sle/CMakeLists.txt deleted file mode 100755 index 3c3094e..0000000 --- a/application/samples/bt/sle/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_UUID_SERVER_SAMPLE) - add_subdirectory_if_exist(sle_uuid_server) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_UUID_CLIENT_SAMPLE) - add_subdirectory_if_exist(sle_uuid_client) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_SPEED_SERVER_SAMPLE) - add_subdirectory_if_exist(sle_speed_server) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SLE_SPEED_CLIENT_SAMPLE) - add_subdirectory_if_exist(sle_speed_client) -endif() - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/sle/Kconfig b/application/samples/bt/sle/Kconfig deleted file mode 100755 index 1e51278..0000000 --- a/application/samples/bt/sle/Kconfig +++ /dev/null @@ -1,31 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== - -choice - prompt "SLE Sample" - -config SAMPLE_SUPPORT_SLE_UUID_SERVER_SAMPLE - bool "Support SLE UUID Server Sample." - -config SAMPLE_SUPPORT_SLE_UUID_CLIENT_SAMPLE - bool "Support SLE UUID Client Sample." - -config SAMPLE_SUPPORT_SLE_SPEED_SERVER_SAMPLE - bool "Support SLE Throughput Server Sample." - -config LARGE_THROUGHPUT_SERVER - bool "server large throughput." - default y - depends on SAMPLE_SUPPORT_SLE_SPEED_SERVER_SAMPLE - -config SAMPLE_SUPPORT_SLE_SPEED_CLIENT_SAMPLE - bool "Support SLE Throughput Client Sample." - -config LARGE_THROUGHPUT_CLIENT - bool "client large throughput." - default y - depends on SAMPLE_SUPPORT_SLE_SPEED_CLIENT_SAMPLE - -endchoice \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_client/CMakeLists.txt b/application/samples/bt/sle/sle_speed_client/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/sle/sle_speed_client/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_client/inc/sle_speed_client.h b/application/samples/bt/sle/sle_speed_client/inc/sle_speed_client.h deleted file mode 100755 index 4132e6f..0000000 --- a/application/samples/bt/sle/sle_speed_client/inc/sle_speed_client.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: SLE private service register sample of client. - */ - -/** - * @defgroup SLE UUID CLIENT API - * @ingroup - * @{ - */ - -#ifndef SLE_CLIENT_ADV_H -#define SLE_CLIENT_ADV_H - -/** - * @if Eng - * @brief sle uuid client init. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle uuid客户端初始化。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -void sle_client_init(ssapc_notification_callback notification_cb, ssapc_indication_callback indication_cb); - -/** - * @if Eng - * @brief sle start scan. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle启动扫描。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -void sle_start_scan(void); - -#endif \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_client/src/CMakeLists.txt b/application/samples/bt/sle/sle_speed_client/src/CMakeLists.txt deleted file mode 100755 index 47489b8..0000000 --- a/application/samples/bt/sle/sle_speed_client/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_speed_client.c" - PARENT_SCOPE) diff --git a/application/samples/bt/sle/sle_speed_client/src/sle_speed_client.c b/application/samples/bt/sle/sle_speed_client/src/sle_speed_client.c deleted file mode 100755 index a4c5abf..0000000 --- a/application/samples/bt/sle/sle_speed_client/src/sle_speed_client.c +++ /dev/null @@ -1,376 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: SLE private service register sample of client. - */ -#include "app_init.h" -#include "systick.h" -#include "tcxo.h" -#include "los_memory.h" -#include "securec.h" -#include "soc_osal.h" -#include "common_def.h" - -#include "sle_device_discovery.h" -#include "sle_connection_manager.h" -#include "sle_ssap_client.h" - -#include "sle_speed_client.h" - -#undef THIS_FILE_ID -#define THIS_FILE_ID BTH_GLE_SAMPLE_UUID_CLIENT - -#define SLE_MTU_SIZE_DEFAULT 1500 -#define SLE_SEEK_INTERVAL_DEFAULT 100 -#define SLE_SEEK_WINDOW_DEFAULT 100 -#define UUID_16BIT_LEN 2 -#define UUID_128BIT_LEN 16 -#define SLE_SPEED_HUNDRED 100 /* 100 */ -#define SPEED_DEFAULT_CONN_INTERVAL 0x14 -#define SPEED_DEFAULT_TIMEOUT_MULTIPLIER 0x1f4 -#define SPEED_DEFAULT_SCAN_INTERVAL 400 -#define SPEED_DEFAULT_SCAN_WINDOW 20 - -static int g_recv_pkt_num = 0; -static uint64_t g_count_before_get_us; -static uint64_t g_count_after_get_us; - -#ifdef CONFIG_LARGE_THROUGHPUT_CLIENT -#define RECV_PKT_CNT 1000 -#else -#define RECV_PKT_CNT 1 -#endif -static int g_rssi_sum = 0; -static int g_rssi_number = 0; - -static sle_announce_seek_callbacks_t g_seek_cbk = {0}; -static sle_connection_callbacks_t g_connect_cbk = {0}; -static ssapc_callbacks_t g_ssapc_cbk = {0}; -static sle_addr_t g_remote_addr = {0}; -static uint16_t g_conn_id = 0; -static ssapc_find_service_result_t g_find_service_result = {0}; - -void sle_sample_sle_enable_cbk(errcode_t status) -{ - if (status == 0) { - sle_start_scan(); - } -} - -void sle_sample_seek_enable_cbk(errcode_t status) -{ - if (status == 0) { - return; - } -} - -void sle_sample_seek_disable_cbk(errcode_t status) -{ - if (status == 0) { - sle_connect_remote_device(&g_remote_addr); - } -} - -void sle_sample_seek_result_info_cbk(sle_seek_result_info_t *seek_result_data) -{ - if (seek_result_data != NULL) { - uint8_t mac[SLE_ADDR_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; - if (memcmp(seek_result_data->addr.addr, mac, SLE_ADDR_LEN) == 0) { - (void)memcpy_s(&g_remote_addr, sizeof(sle_addr_t), &seek_result_data->addr, sizeof(sle_addr_t)); - sle_stop_seek(); - } - } -} - -static uint32_t get_float_int(float in) -{ - return (uint32_t)(((uint64_t)(in * SLE_SPEED_HUNDRED)) / SLE_SPEED_HUNDRED); -} - -static uint32_t get_float_dec(float in) -{ - return (uint32_t)(((uint64_t)(in * SLE_SPEED_HUNDRED)) % SLE_SPEED_HUNDRED); -} - -static void sle_speed_notification_cb(uint8_t client_id, uint16_t conn_id, ssapc_handle_value_t *data, - errcode_t status) -{ - unused(client_id); - unused(status); - sle_read_remote_device_rssi(conn_id); // 用于统计rssi均值 - - if (g_recv_pkt_num == 0) { - g_count_before_get_us = uapi_tcxo_get_us(); - } else if (g_recv_pkt_num == RECV_PKT_CNT) { - g_count_after_get_us = uapi_tcxo_get_us(); - printf("g_count_after_get_us = %llu, g_count_before_get_us = %llu, data_len = %d\r\n", - g_count_after_get_us, g_count_before_get_us, data->data_len); - float time = (float)(g_count_after_get_us - g_count_before_get_us) / 1000000.0; /* 1s = 1000000.0us */ - printf("time = %d.%d s\r\n", get_float_int(time), get_float_dec(time)); - uint16_t len = data->data_len; - float speed = len * RECV_PKT_CNT * 8 / time; /* 1B = 8bits */ - printf("speed = %d.%d bps\r\n", get_float_int(speed), get_float_dec(speed)); - g_recv_pkt_num = 0; - g_count_before_get_us = g_count_after_get_us; - } - g_recv_pkt_num++; -} - -static void sle_speed_indication_cb(uint8_t client_id, uint16_t conn_id, ssapc_handle_value_t *data, - errcode_t status) -{ - unused(status); - unused(conn_id); - unused(client_id); - osal_printk("\n sle_speed_indication_cb sle uart recived data : %s\r\n", data->data); -} - -void sle_sample_seek_cbk_register(void) -{ - g_seek_cbk.sle_enable_cb = sle_sample_sle_enable_cbk; - g_seek_cbk.seek_enable_cb = sle_sample_seek_enable_cbk; - g_seek_cbk.seek_disable_cb = sle_sample_seek_disable_cbk; - g_seek_cbk.seek_result_cb = sle_sample_seek_result_info_cbk; -} - -void sle_sample_connect_state_changed_cbk(uint16_t conn_id, const sle_addr_t *addr, - sle_acb_state_t conn_state, sle_pair_state_t pair_state, sle_disc_reason_t disc_reason) -{ - osal_printk("[ssap client] conn state changed conn_id:%d, addr:%02x***%02x%02x\n", conn_id, addr->addr[0], - addr->addr[4], addr->addr[5]); /* 0 4 5: addr index */ - osal_printk("[ssap client] conn state changed disc_reason:0x%x\n", disc_reason); - if (conn_state == SLE_ACB_STATE_CONNECTED) { - if (pair_state == SLE_PAIR_NONE) { - sle_pair_remote_device(&g_remote_addr); - } - g_conn_id = conn_id; - } -} - -void sle_sample_pair_complete_cbk(uint16_t conn_id, const sle_addr_t *addr, errcode_t status) -{ - osal_printk("[ssap client] pair complete conn_id:%d, addr:%02x***%02x%02x\n", conn_id, addr->addr[0], - addr->addr[4], addr->addr[5]); /* 0 4 5: addr index */ - if (status == 0) { - ssap_exchange_info_t info = {0}; - info.mtu_size = SLE_MTU_SIZE_DEFAULT; - info.version = 1; - ssapc_exchange_info_req(1, g_conn_id, &info); - } -} - -void sle_sample_update_cbk(uint16_t conn_id, errcode_t status, const sle_connection_param_update_evt_t *param) -{ - unused(status); - osal_printk("[ssap client] updat state changed conn_id:%d, interval = %02x\n", conn_id, param->interval); -} - -void sle_sample_update_req_cbk(uint16_t conn_id, errcode_t status, const sle_connection_param_update_req_t *param) -{ - unused(conn_id); - unused(status); - osal_printk("[ssap client] sle_sample_update_req_cbk interval_min = %02x, interval_max = %02x\n", - param->interval_min, param->interval_max); -} - -void sle_sample_read_rssi_cbk(uint16_t conn_id, int8_t rssi, errcode_t status) -{ - unused(conn_id); - unused(status); - g_rssi_sum = g_rssi_sum + rssi; - g_rssi_number++; - if (g_rssi_number == RECV_PKT_CNT) { - osal_printk("rssi average = %d dbm\r\n", g_rssi_sum / g_rssi_number); - g_rssi_sum = 0; - g_rssi_number = 0; - } -} - -void sle_sample_connect_cbk_register(void) -{ - g_connect_cbk.connect_state_changed_cb = sle_sample_connect_state_changed_cbk; - g_connect_cbk.pair_complete_cb = sle_sample_pair_complete_cbk; - g_connect_cbk.connect_param_update_req_cb = sle_sample_update_req_cbk; - g_connect_cbk.connect_param_update_cb = sle_sample_update_cbk; - g_connect_cbk.read_rssi_cb = sle_sample_read_rssi_cbk; -} - -void sle_sample_exchange_info_cbk(uint8_t client_id, uint16_t conn_id, ssap_exchange_info_t *param, - errcode_t status) -{ - osal_printk("[ssap client] pair complete client id:%d status:%d\n", client_id, status); - osal_printk("[ssap client] exchange mtu, mtu size: %d, version: %d.\n", - param->mtu_size, param->version); - - ssapc_find_structure_param_t find_param = {0}; - find_param.type = SSAP_FIND_TYPE_PRIMARY_SERVICE; - find_param.start_hdl = 1; - find_param.end_hdl = 0xFFFF; - ssapc_find_structure(0, conn_id, &find_param); -} - -void sle_sample_find_structure_cbk(uint8_t client_id, uint16_t conn_id, ssapc_find_service_result_t *service, - errcode_t status) -{ - osal_printk("[ssap client] find structure cbk client: %d conn_id:%d status: %d \n", - client_id, conn_id, status); - osal_printk("[ssap client] find structure start_hdl:[0x%02x], end_hdl:[0x%02x], uuid len:%d\r\n", - service->start_hdl, service->end_hdl, service->uuid.len); - if (service->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] structure uuid:[0x%02x][0x%02x]\r\n", - service->uuid.uuid[14], service->uuid.uuid[15]); /* 14 15: uuid index */ - } else { - for (uint8_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] structure uuid[%d]:[0x%02x]\r\n", idx, service->uuid.uuid[idx]); - } - } - g_find_service_result.start_hdl = service->start_hdl; - g_find_service_result.end_hdl = service->end_hdl; - memcpy_s(&g_find_service_result.uuid, sizeof(sle_uuid_t), &service->uuid, sizeof(sle_uuid_t)); -} - -void sle_sample_find_structure_cmp_cbk(uint8_t client_id, uint16_t conn_id, - ssapc_find_structure_result_t *structure_result, errcode_t status) -{ - osal_printk("[ssap client] find structure cmp cbk client id:%d status:%d type:%d uuid len:%d \r\n", - client_id, status, structure_result->type, structure_result->uuid.len); - if (structure_result->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] find structure cmp cbk structure uuid:[0x%02x][0x%02x]\r\n", - structure_result->uuid.uuid[14], structure_result->uuid.uuid[15]); /* 14 15: uuid index */ - } else { - for (uint8_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] find structure cmp cbk structure uuid[%d]:[0x%02x]\r\n", idx, - structure_result->uuid.uuid[idx]); - } - } - uint8_t data[] = {0x11, 0x22, 0x33, 0x44}; - uint8_t len = sizeof(data); - ssapc_write_param_t param = {0}; - param.handle = g_find_service_result.start_hdl; - param.type = SSAP_PROPERTY_TYPE_VALUE; - param.data_len = len; - param.data = data; - ssapc_write_req(0, conn_id, ¶m); -} - -void sle_sample_find_property_cbk(uint8_t client_id, uint16_t conn_id, - ssapc_find_property_result_t *property, errcode_t status) -{ - osal_printk("[ssap client] find property cbk, client id: %d, conn id: %d, operate ind: %d, " - "descriptors count: %d status:%d.\n", client_id, conn_id, property->operate_indication, - property->descriptors_count, status); - for (uint16_t idx = 0; idx < property->descriptors_count; idx++) { - osal_printk("[ssap client] find property cbk, descriptors type [%d]: 0x%02x.\n", - idx, property->descriptors_type[idx]); - } - if (property->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] find property cbk, uuid: %02x %02x.\n", - property->uuid.uuid[14], property->uuid.uuid[15]); /* 14 15: uuid index */ - } else if (property->uuid.len == UUID_128BIT_LEN) { - for (uint16_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] find property cbk, uuid [%d]: %02x.\n", - idx, property->uuid.uuid[idx]); - } - } -} - -void sle_sample_write_cfm_cbk(uint8_t client_id, uint16_t conn_id, ssapc_write_result_t *write_result, - errcode_t status) -{ - osal_printk("[ssap client] write cfm cbk, client id: %d status:%d.\n", client_id, status); - ssapc_read_req(0, conn_id, write_result->handle, write_result->type); -} - -void sle_sample_read_cfm_cbk(uint8_t client_id, uint16_t conn_id, ssapc_handle_value_t *read_data, - errcode_t status) -{ - osal_printk("[ssap client] read cfm cbk client id: %d conn id: %d status: %d\n", - client_id, conn_id, status); - osal_printk("[ssap client] read cfm cbk handle: %d, type: %d , len: %d\n", - read_data->handle, read_data->type, read_data->data_len); - for (uint16_t idx = 0; idx < read_data->data_len; idx++) { - osal_printk("[ssap client] read cfm cbk[%d] 0x%02x\r\n", idx, read_data->data[idx]); - } -} - -void sle_sample_ssapc_cbk_register(ssapc_notification_callback notification_cb, - ssapc_notification_callback indication_cb) -{ - g_ssapc_cbk.exchange_info_cb = sle_sample_exchange_info_cbk; - g_ssapc_cbk.find_structure_cb = sle_sample_find_structure_cbk; - g_ssapc_cbk.find_structure_cmp_cb = sle_sample_find_structure_cmp_cbk; - g_ssapc_cbk.ssapc_find_property_cbk = sle_sample_find_property_cbk; - g_ssapc_cbk.write_cfm_cb = sle_sample_write_cfm_cbk; - g_ssapc_cbk.read_cfm_cb = sle_sample_read_cfm_cbk; - g_ssapc_cbk.notification_cb = notification_cb; - g_ssapc_cbk.indication_cb = indication_cb; -} - -void sle_speed_connect_param_init(void) -{ - sle_default_connect_param_t param = {0}; - param.enable_filter_policy = 0; - param.gt_negotiate = 0; - param.initiate_phys = 1; - param.max_interval = SPEED_DEFAULT_CONN_INTERVAL; - param.min_interval = SPEED_DEFAULT_CONN_INTERVAL; - param.scan_interval = SPEED_DEFAULT_SCAN_INTERVAL; - param.scan_window = SPEED_DEFAULT_SCAN_WINDOW; - param.timeout = SPEED_DEFAULT_TIMEOUT_MULTIPLIER; - sle_default_connection_param_set(¶m); -} - -void sle_client_init(ssapc_notification_callback notification_cb, ssapc_indication_callback indication_cb) -{ - uint8_t local_addr[SLE_ADDR_LEN] = {0x13, 0x67, 0x5c, 0x07, 0x00, 0x51}; - sle_addr_t local_address; - local_address.type = 0; - (void)memcpy_s(local_address.addr, SLE_ADDR_LEN, local_addr, SLE_ADDR_LEN); - sle_sample_seek_cbk_register(); - sle_speed_connect_param_init(); - sle_sample_connect_cbk_register(); - sle_sample_ssapc_cbk_register(notification_cb, indication_cb); - sle_announce_seek_register_callbacks(&g_seek_cbk); - sle_connection_register_callbacks(&g_connect_cbk); - ssapc_register_callbacks(&g_ssapc_cbk); - enable_sle(); - sle_set_local_addr(&local_address); -} - -void sle_start_scan() -{ - sle_seek_param_t param = {0}; - param.own_addr_type = 0; - param.filter_duplicates = 0; - param.seek_filter_policy = 0; - param.seek_phys = 1; - param.seek_type[0] = 0; - param.seek_interval[0] = SLE_SEEK_INTERVAL_DEFAULT; - param.seek_window[0] = SLE_SEEK_WINDOW_DEFAULT; - sle_set_seek_param(¶m); - sle_start_seek(); -} - -int sle_speed_init(void) -{ - osal_msleep(1000); /* sleep 1000ms */ - sle_client_init(sle_speed_notification_cb, sle_speed_indication_cb); - return 0; -} - -#define SLE_SPEED_TASK_PRIO 26 -#define SLE_SPEED_STACK_SIZE 0x2000 -static void sle_speed_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)sle_speed_init, 0, "RadarTask", SLE_SPEED_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SLE_SPEED_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the blinky_entry. */ -app_run(sle_speed_entry); \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_server/CMakeLists.txt b/application/samples/bt/sle/sle_speed_server/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/sle/sle_speed_server/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server.h b/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server.h deleted file mode 100755 index 3f15bbe..0000000 --- a/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: SLE UUID Server module. - */ - -/** - * @defgroup SLE UUID SERVER API - * @ingroup - * @{ - */ -#ifndef SLE_UUID_SERVER_H -#define SLE_UUID_SERVER_H - -#include "sle_ssap_server.h" - -/* Service UUID */ -#define SLE_UUID_SERVER_SERVICE 0xABCD - -/* Property UUID */ -#define SLE_UUID_SERVER_NTF_REPORT 0x1122 - -/* Property Property */ -#define SLE_UUID_TEST_PROPERTIES (SSAP_PERMISSION_READ | SSAP_PERMISSION_WRITE) - -/* Descriptor Property */ -#define SLE_UUID_TEST_DESCRIPTOR (SSAP_PERMISSION_READ | SSAP_PERMISSION_WRITE) - -/** - * @if Eng - * @brief SLE uuid server inir. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief SLE UUID服务器初始化。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_init(void); - -/** - * @if Eng - * @brief send data to peer device by uuid on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_send_report_by_uuid(uint8_t *data, uint16_t len); - -/** - * @if Eng - * @brief send data to peer device by handle on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_send_report_by_handle(const uint8_t *data, uint8_t len); -#endif diff --git a/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server_adv.h b/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server_adv.h deleted file mode 100755 index 9f3515f..0000000 --- a/application/samples/bt/sle/sle_speed_server/inc/sle_speed_server_adv.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * - * Description: SLE ADV Config. - */ - -/** - * @defgroup bluetooth_sle_adv API - * @ingroup - * @{ - */ - -#ifndef SLE_SERVER_ADV_H -#define SLE_SERVER_ADV_H - -/* 广播ID */ -#define SLE_ADV_HANDLE_DEFAULT 1 - -/** - * @if Eng - * @brief Definitaion of BLE ADV 通用广播结构. - * @else - * @brief SLE 广播普通数据结构。 - * @endif - */ -struct sle_adv_common_value { - uint8_t length; - uint8_t type; - uint8_t value; -}; - -/** - * @if Eng - * @brief Definitaion of BLE ADV Channel mapping. - * @else - * @brief SLE 广播信道映射。 - * @endif - */ -typedef enum { - SLE_ADV_CHANNEL_MAP_77 = 0x01, - SLE_ADV_CHANNEL_MAP_78 = 0x02, - SLE_ADV_CHANNEL_MAP_79 = 0x04, - SLE_ADV_CHANNEL_MAP_DEFAULT = 0x07 -} sle_adv_channel_map; - -/** - * @if Eng - * @brief Definitaion of SLE ADV Data Type. - * @else - * @brief SLE 广播数据类型 - * @endif - */ -typedef enum { - SLE_ADV_DATA_TYPE_DISCOVERY_LEVEL = 0x01, /*!< 发现等级 */ - SLE_ADV_DATA_TYPE_ACCESS_MODE = 0x02, /*!< 接入层能力 */ - SLE_ADV_DATA_TYPE_SERVICE_DATA_16BIT_UUID = 0x03, /*!< 标准服务数据信息 */ - SLE_ADV_DATA_TYPE_SERVICE_DATA_128BIT_UUID = 0x04, /*!< 自定义服务数据信息 */ - SLE_ADV_DATA_TYPE_COMPLETE_LIST_OF_16BIT_SERVICE_UUIDS = 0x05, /*!< 完整标准服务标识列表 */ - SLE_ADV_DATA_TYPE_COMPLETE_LIST_OF_128BIT_SERVICE_UUIDS = 0x06, /*!< 完整自定义服务标识列表 */ - SLE_ADV_DATA_TYPE_INCOMPLETE_LIST_OF_16BIT_SERVICE_UUIDS = 0x07, /*!< 部分标准服务标识列表 */ - SLE_ADV_DATA_TYPE_INCOMPLETE_LIST_OF_128BIT_SERVICE_UUIDS = 0x08, /*!< 部分自定义服务标识列表 */ - SLE_ADV_DATA_TYPE_SERVICE_STRUCTURE_HASH_VALUE = 0x09, /*!< 服务结构散列值 */ - SLE_ADV_DATA_TYPE_SHORTENED_LOCAL_NAME = 0x0A, /*!< 设备缩写本地名称 */ - SLE_ADV_DATA_TYPE_COMPLETE_LOCAL_NAME = 0x0B, /*!< 设备完整本地名称 */ - SLE_ADV_DATA_TYPE_TX_POWER_LEVEL = 0x0C, /*!< 广播发送功率 */ - SLE_ADV_DATA_TYPE_SLB_COMMUNICATION_DOMAIN = 0x0D, /*!< SLB通信域域名 */ - SLE_ADV_DATA_TYPE_SLB_MEDIA_ACCESS_LAYER_ID = 0x0E, /*!< SLB媒体接入层标识 */ - SLE_ADV_DATA_TYPE_EXTENDED = 0xFE, /*!< 数据类型扩展 */ - SLE_ADV_DATA_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF /*!< 厂商自定义信息 */ -} sle_adv_data_type; - - -/** - * @if Eng - * @brief sle adv data config. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle广播数据配置。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -errcode_t sle_uuid_server_adv_init(void); -#endif \ No newline at end of file diff --git a/application/samples/bt/sle/sle_speed_server/src/CMakeLists.txt b/application/samples/bt/sle/sle_speed_server/src/CMakeLists.txt deleted file mode 100755 index 9a6d6eb..0000000 --- a/application/samples/bt/sle/sle_speed_server/src/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_speed_server_adv.c" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_speed_server.c" - PARENT_SCOPE) diff --git a/application/samples/bt/sle/sle_speed_server/src/sle_speed_server.c b/application/samples/bt/sle/sle_speed_server/src/sle_speed_server.c deleted file mode 100755 index f0179d6..0000000 --- a/application/samples/bt/sle/sle_speed_server/src/sle_speed_server.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: sle uuid server sample. - */ -#include "app_init.h" -#include "watchdog.h" -#include "tcxo.h" -#include "systick.h" -#include "los_memory.h" -#include "securec.h" -#include "errcode.h" -#include "osal_addr.h" -#include "soc_osal.h" -#include "common_def.h" - -#include "sle_common.h" -#include "sle_errcode.h" -#include "sle_ssap_server.h" -#include "sle_connection_manager.h" -#include "sle_device_discovery.h" -#include "sle_transmition_manager.h" -#include "nv.h" - -#include "sle_speed_server_adv.h" -#include "sle_speed_server.h" - -#define OCTET_BIT_LEN 8 -#define UUID_LEN_2 2 -#define BT_INDEX_4 4 -#define BT_INDEX_5 5 -#define BT_INDEX_0 0 -extern void send_data_thread_function(void); -#define encode2byte_little(_ptr, data) \ - do { \ - *(uint8_t *)((_ptr) + 1) = (uint8_t)((data) >> 8); \ - *(uint8_t *)(_ptr) = (uint8_t)(data); \ - } while (0) - -/* sle server app uuid for test */ -static char g_sle_uuid_app_uuid[UUID_LEN_2] = {0x0, 0x0}; -/* server notify property uuid for test */ -static char g_sle_property_value[OCTET_BIT_LEN] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; -/* sle connect acb handle */ -static uint16_t g_sle_conn_hdl = 0; -/* sle server handle */ -static uint8_t g_server_id = 0; -/* sle service handle */ -static uint16_t g_service_handle = 0; -/* sle ntf property handle */ -static uint16_t g_property_handle = 0; -#ifdef SLE_QOS_FLOWCTRL_FUNCTION_SWITCH -static sle_link_qos_state_t g_sle_link_state = 0; /* sle link state */ -#endif - -#ifdef CONFIG_LARGE_THROUGHPUT_SERVER -#define PKT_DATA_LEN 1200 -#define SPEED_DEFAULT_CONN_INTERVAL 0x14 -#else -#define PKT_DATA_LEN 600 -#define SPEED_DEFAULT_CONN_INTERVAL 0xA0 -#endif - -#define SPEED_DEFAULT_KTHREAD_SIZE 0x2000 -#define SPEED_DEFAULT_KTHREAD_PROI 26 -#define DEFAULT_SLE_SPEED_DATA_LEN 1500 -#define DEFAULT_SLE_SPEED_MTU_SIZE 1500 -#define SPEED_DEFAULT_TIMEOUT_MULTIPLIER 0x1f4 -#define SPEED_DEFAULT_SCAN_INTERVAL 400 -#define SPEED_DEFAULT_SCAN_WINDOW 20 -static unsigned char data[PKT_DATA_LEN]; - -static uint8_t sle_uuid_base[] = { 0x37, 0xBE, 0xA8, 0x80, 0xFC, 0x70, 0x11, 0xEA, \ - 0xB7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static void sle_uuid_set_base(sle_uuid_t *out) -{ - (void)memcpy_s(out->uuid, SLE_UUID_LEN, sle_uuid_base, SLE_UUID_LEN); - out->len = UUID_LEN_2; -} - -static void sle_uuid_setu2(uint16_t u2, sle_uuid_t *out) -{ - sle_uuid_set_base(out); - out->len = UUID_LEN_2; - encode2byte_little(&out->uuid[14], u2); -} - -static void ssaps_read_request_cbk(uint8_t server_id, uint16_t conn_id, ssaps_req_read_cb_t *read_cb_para, - errcode_t status) -{ - osal_printk("[speed server] ssaps read request cbk server_id:%x, conn_id:%x, handle:%x, status:%x\r\n", - server_id, conn_id, read_cb_para->handle, status); - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)send_data_thread_function, - 0, "RadarTask", SPEED_DEFAULT_KTHREAD_SIZE); - osal_kthread_set_priority(task_handle, SPEED_DEFAULT_KTHREAD_PROI + 1); - if (task_handle != NULL) { - osal_kfree(task_handle); - } - osal_kthread_unlock(); - printf("kthread success\r\n"); -} - -static void ssaps_write_request_cbk(uint8_t server_id, uint16_t conn_id, ssaps_req_write_cb_t *write_cb_para, - errcode_t status) -{ - osal_printk("[speed server] ssaps write request cbk server_id:%d, conn_id:%d, handle:%d, status:%d\r\n", - server_id, conn_id, write_cb_para->handle, status); -} - -static void ssaps_mtu_changed_cbk(uint8_t server_id, uint16_t conn_id, ssap_exchange_info_t *mtu_size, - errcode_t status) -{ - osal_printk("[speed server] ssaps write request cbk server_id:%d, conn_id:%d, mtu_size:%d, status:%d\r\n", - server_id, conn_id, mtu_size->mtu_size, status); -} - -static void ssaps_start_service_cbk(uint8_t server_id, uint16_t handle, errcode_t status) -{ - osal_printk("[speed server] start service cbk server_id:%d, handle:%d, status:%d\r\n", - server_id, handle, status); -} - -static void sle_ssaps_register_cbks(void) -{ - ssaps_callbacks_t ssaps_cbk = {0}; - ssaps_cbk.start_service_cb = ssaps_start_service_cbk; - ssaps_cbk.mtu_changed_cb = ssaps_mtu_changed_cbk; - ssaps_cbk.read_request_cb = ssaps_read_request_cbk; - ssaps_cbk.write_request_cb = ssaps_write_request_cbk; - ssaps_register_callbacks(&ssaps_cbk); -} - -errcode_t sle_uuid_server_send_report_by_handle_id(uint8_t *data, uint16_t len, uint16_t connect_id) -{ - ssaps_ntf_ind_t param = {0}; - param.handle = g_property_handle; - param.type = SSAP_PROPERTY_TYPE_VALUE; - param.value = data; - param.value_len = len; - ssaps_notify_indicate(g_server_id, connect_id, ¶m); - return ERRCODE_SLE_SUCCESS; -} - -#ifdef SLE_QOS_FLOWCTRL_FUNCTION_SWITCH -static void sle_send_data_cbk(uint16_t conn_id, sle_link_qos_state_t link_state) -{ - conn_id = conn_id; - g_sle_link_state = link_state; - printf("%s enter, gle_tx_acb_data_num_get:%d.\n", __FUNCTION__, link_state); -} - -static void sle_transmission_register_cbks(void) -{ - sle_transmission_callbacks_t trans_cbk = {0}; - trans_cbk.send_data_cb = sle_send_data_cbk; - sle_transmission_register_callbacks(&trans_cbk); -} -#else -extern uint8_t gle_tx_acb_data_num_get(void); -#endif - -uint8_t sle_flow_ctrl_flag(void) -{ -#ifdef SLE_QOS_FLOWCTRL_FUNCTION_SWITCH - return (g_sle_link_state <= SLE_QOS_FLOWCTRL) ? 1 : 0; -#else - return gle_tx_acb_data_num_get(); -#endif -} - -void send_data_thread_function(void) -{ - sle_set_data_len(g_sle_conn_hdl, DEFAULT_SLE_SPEED_DATA_LEN); -#ifdef CONFIG_LARGE_THROUGHPUT_SERVER -#define DEFAULT_SLE_SPEED_MCS 10 - sle_set_phy_t phy_parm = { - .tx_format = SLE_RADIO_FRAME_2, - .rx_format = SLE_RADIO_FRAME_2, - .tx_phy = SLE_PHY_4M, - .rx_phy = SLE_PHY_4M, - .tx_pilot_density = SLE_PHY_PILOT_DENSITY_16_TO_1, - .rx_pilot_density = SLE_PHY_PILOT_DENSITY_16_TO_1, - .g_feedback = 0, - .t_feedback = 0, - }; - sle_set_phy_param(g_sle_conn_hdl, &phy_parm); - sle_set_mcs(g_sle_conn_hdl, DEFAULT_SLE_SPEED_MCS); - osal_printk("code: ploar MCS10, PHY 4MHZ, power: 20dbm \r\n"); -#else - osal_printk("code: GFSK, PHY 1MHZ, power: 20dbm \r\n"); -#endif - int i = 0; - while (1) { - if (sle_flow_ctrl_flag() > 0) { - i++; - data[0] = (i >> 8) & 0xFF; /* offset 8bits */ - data[1] = i & 0xFF; - sle_uuid_server_send_report_by_handle_id(data, PKT_DATA_LEN, g_sle_conn_hdl); - } -#ifndef CONFIG_LARGE_THROUGHPUT_SERVER - osal_msleep(1000); /* sleep 1000ms */ - i = 0; -#endif - } -} - -static errcode_t sle_uuid_server_service_add(void) -{ - errcode_t ret; - sle_uuid_t service_uuid = {0}; - sle_uuid_setu2(SLE_UUID_SERVER_SERVICE, &service_uuid); - ret = ssaps_add_service_sync(g_server_id, &service_uuid, 1, &g_service_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[speed server] sle uuid add service fail, ret:%x\r\n", ret); - return ERRCODE_SLE_FAIL; - } - return ERRCODE_SLE_SUCCESS; -} - -static errcode_t sle_uuid_server_property_add(void) -{ - errcode_t ret; - ssaps_property_info_t property = {0}; - ssaps_desc_info_t descriptor = {0}; - uint8_t ntf_value[] = {0x01, 0x0}; - - property.permissions = SLE_UUID_TEST_PROPERTIES; - sle_uuid_setu2(SLE_UUID_SERVER_NTF_REPORT, &property.uuid); - property.value = osal_vmalloc(sizeof(g_sle_property_value)); - property.operate_indication = SSAP_OPERATE_INDICATION_BIT_READ | SSAP_OPERATE_INDICATION_BIT_NOTIFY; - if (property.value == NULL) { - osal_printk("[speed server] sle property mem fail\r\n"); - return ERRCODE_SLE_FAIL; - } - if (memcpy_s(property.value, sizeof(g_sle_property_value), g_sle_property_value, - sizeof(g_sle_property_value)) != EOK) { - osal_vfree(property.value); - osal_printk("[speed server] sle property mem cpy fail\r\n"); - return ERRCODE_SLE_FAIL; - } - ret = ssaps_add_property_sync(g_server_id, g_service_handle, &property, &g_property_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[speed server] sle uuid add property fail, ret:%x\r\n", ret); - osal_vfree(property.value); - return ERRCODE_SLE_FAIL; - } - descriptor.permissions = SLE_UUID_TEST_DESCRIPTOR; - descriptor.operate_indication = SSAP_OPERATE_INDICATION_BIT_READ | SSAP_OPERATE_INDICATION_BIT_WRITE; - descriptor.type = SSAP_DESCRIPTOR_USER_DESCRIPTION; - descriptor.value = ntf_value; - descriptor.value_len = sizeof(ntf_value); - - ret = ssaps_add_descriptor_sync(g_server_id, g_service_handle, g_property_handle, &descriptor); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[speed server] sle uuid add descriptor fail, ret:%x\r\n", ret); - osal_vfree(property.value); - return ERRCODE_SLE_FAIL; - } - osal_vfree(property.value); - return ERRCODE_SLE_SUCCESS; -} - -static errcode_t sle_uuid_server_add(void) -{ - errcode_t ret; - sle_uuid_t app_uuid = {0}; - - osal_printk("[speed server] sle uuid add service in\r\n"); - app_uuid.len = sizeof(g_sle_uuid_app_uuid); - if (memcpy_s(app_uuid.uuid, app_uuid.len, g_sle_uuid_app_uuid, sizeof(g_sle_uuid_app_uuid)) != EOK) { - return ERRCODE_SLE_FAIL; - } - ssaps_register_server(&app_uuid, &g_server_id); - - if (sle_uuid_server_service_add() != ERRCODE_SLE_SUCCESS) { - ssaps_unregister_server(g_server_id); - return ERRCODE_SLE_FAIL; - } - - if (sle_uuid_server_property_add() != ERRCODE_SLE_SUCCESS) { - ssaps_unregister_server(g_server_id); - return ERRCODE_SLE_FAIL; - } - osal_printk("[speed server] sle uuid add service, server_id:%x, service_handle:%x, property_handle:%x\r\n", - g_server_id, g_service_handle, g_property_handle); - ret = ssaps_start_service(g_server_id, g_service_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[speed server] sle uuid add service fail, ret:%x\r\n", ret); - return ERRCODE_SLE_FAIL; - } - osal_printk("[speed server] sle uuid add service out\r\n"); - return ERRCODE_SLE_SUCCESS; -} - -static void sle_connect_state_changed_cbk(uint16_t conn_id, const sle_addr_t *addr, - sle_acb_state_t conn_state, sle_pair_state_t pair_state, sle_disc_reason_t disc_reason) -{ - osal_printk("[speed server] connect state changed conn_id:0x%02x, conn_state:0x%x, pair_state:0x%x, \ - disc_reason:0x%x\r\n", conn_id, conn_state, pair_state, disc_reason); - osal_printk("[speed server] connect state changed addr:%02x:**:**:**:%02x:%02x\r\n", - addr->addr[BT_INDEX_0], addr->addr[BT_INDEX_4], addr->addr[BT_INDEX_5]); - g_sle_conn_hdl = conn_id; - sle_connection_param_update_t parame = {0}; - parame.conn_id = conn_id; - parame.interval_min = SPEED_DEFAULT_CONN_INTERVAL; - parame.interval_max = SPEED_DEFAULT_CONN_INTERVAL; - parame.max_latency = 0; - parame.supervision_timeout = SPEED_DEFAULT_TIMEOUT_MULTIPLIER; - if (conn_state == SLE_ACB_STATE_CONNECTED) { - sle_update_connect_param(¶me); - } else if (conn_state == SLE_ACB_STATE_DISCONNECTED) { - sle_start_announce(SLE_ADV_HANDLE_DEFAULT); - } -} - -static void sle_pair_complete_cbk(uint16_t conn_id, const sle_addr_t *addr, errcode_t status) -{ - osal_printk("[speed server] pair complete conn_id:%02x, status:%x\r\n", - conn_id, status); - osal_printk("[speed server] pair complete addr:%02x:**:**:**:%02x:%02x\r\n", - addr->addr[BT_INDEX_0], addr->addr[BT_INDEX_4], addr->addr[BT_INDEX_5]); -} - -void sle_sample_update_cbk(uint16_t conn_id, errcode_t status, const sle_connection_param_update_evt_t *param) -{ - unused(status); - osal_printk("[ssap server] updat state changed conn_id:%d, interval = %02x\n", conn_id, param->interval); -} - -void sle_sample_update_req_cbk(uint16_t conn_id, errcode_t status, const sle_connection_param_update_req_t *param) -{ - unused(conn_id); - unused(status); - osal_printk("[ssap server] sle_sample_update_req_cbk interval_min:%02x, interval_max:%02x\n", - param->interval_min, param->interval_max); -} - -void sle_sample_rssi_cbk(uint16_t conn_id, int8_t rssi, errcode_t status) -{ - osal_printk("[ssap server] conn_id:%d, rssi = %c, status = %x\n", conn_id, rssi, status); -} - -static void sle_conn_register_cbks(void) -{ - sle_connection_callbacks_t conn_cbks = {0}; - conn_cbks.connect_state_changed_cb = sle_connect_state_changed_cbk; - conn_cbks.pair_complete_cb = sle_pair_complete_cbk; - conn_cbks.connect_param_update_req_cb = sle_sample_update_req_cbk; - conn_cbks.connect_param_update_cb = sle_sample_update_cbk; - conn_cbks.read_rssi_cb = sle_sample_rssi_cbk; - sle_connection_register_callbacks(&conn_cbks); -} - -void sle_ssaps_set_info(void) -{ - ssap_exchange_info_t info = {0}; - info.mtu_size = DEFAULT_SLE_SPEED_MTU_SIZE; - info.version = 1; - ssaps_set_info(g_server_id, &info); -} - -void sle_speed_connect_param_init(void) -{ - sle_default_connect_param_t param = {0}; - param.enable_filter_policy = 0; - param.gt_negotiate = 0; - param.initiate_phys = 1; - param.max_interval = SPEED_DEFAULT_CONN_INTERVAL; - param.min_interval = SPEED_DEFAULT_CONN_INTERVAL; - param.scan_interval = SPEED_DEFAULT_SCAN_INTERVAL; - param.scan_window = SPEED_DEFAULT_SCAN_WINDOW; - param.timeout = SPEED_DEFAULT_TIMEOUT_MULTIPLIER; - sle_default_connection_param_set(¶m); -} - -void sle_set_local_addr_init(void) -{ - sle_addr_t addr = {0}; - uint8_t mac[SLE_ADDR_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; - addr.type = 0; - memcpy_s(addr.addr, SLE_ADDR_LEN, mac, SLE_ADDR_LEN); - sle_set_local_addr(&addr); -} - -void sle_speed_server_set_nv(void) -{ - uint16_t nv_value_len = 0; - uint8_t nv_value = 0; - uapi_nv_read(0x20A0, sizeof(uint16_t), &nv_value_len, &nv_value); - if (nv_value != 7) { // 7:btc功率档位 - nv_value = 7; // 7:btc功率档位 - uapi_nv_write(0x20A0, (uint8_t *)&(nv_value), sizeof(nv_value)); - } - osal_printk("[speed server] The value of nv is set to %d.\r\n", nv_value); -} - -/* 初始化speed server */ -errcode_t sle_speed_server_init(void) -{ - uapi_watchdog_disable(); - enable_sle(); - printf("sle enable\r\n"); - sle_speed_server_set_nv(); - sle_conn_register_cbks(); - sle_ssaps_register_cbks(); - sle_uuid_server_add(); - sle_uuid_server_adv_init(); - sle_ssaps_set_info(); -#ifdef SLE_QOS_FLOWCTRL_FUNCTION_SWITCH - sle_transmission_register_cbks(); -#endif - sle_speed_connect_param_init(); - sle_set_local_addr_init(); - osal_printk("[speed server] init ok\r\n"); - return ERRCODE_SLE_SUCCESS; -} - -int sle_speed_init(void) -{ - for (int i = 0; i < PKT_DATA_LEN; i++) { - data[i] = 'A'; - data[PKT_DATA_LEN - 1] = '\0'; - } - osal_msleep(1000); /* sleep 1000ms */ - sle_speed_server_init(); - return 0; -} - -static void sle_speed_entry(void) -{ - osal_task *task_handle1 = NULL; - osal_kthread_lock(); - task_handle1= osal_kthread_create((osal_kthread_handler)sle_speed_init, 0, "speed", SPEED_DEFAULT_KTHREAD_SIZE); - if (task_handle1 != NULL) { - osal_kthread_set_priority(task_handle1, SPEED_DEFAULT_KTHREAD_PROI); - osal_kfree(task_handle1); - } - osal_kthread_unlock(); -} - -/* Run the blinky_entry. */ -app_run(sle_speed_entry); - diff --git a/application/samples/bt/sle/sle_speed_server/src/sle_speed_server_adv.c b/application/samples/bt/sle/sle_speed_server/src/sle_speed_server_adv.c deleted file mode 100755 index 6fc9ff2..0000000 --- a/application/samples/bt/sle/sle_speed_server/src/sle_speed_server_adv.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023. All rights reserved. - * Description: sle adv config for sle uuid server. - */ -#include "securec.h" -#include "errcode.h" -#include "osal_addr.h" -#include "osal_debug.h" -#include "sle_common.h" -#include "sle_device_discovery.h" -#include "sle_connection_manager.h" -#include "sle_errcode.h" -#include "sle_speed_server_adv.h" - -/* sle device name */ -#define NAME_MAX_LENGTH 15 -/* 连接调度间隔12.5ms,单位125us */ -#define SLE_CONN_INTV_MIN_DEFAULT 0xA -/* 连接调度间隔12.5ms,单位125us */ -#define SLE_CONN_INTV_MAX_DEFAULT 0xA -/* 连接调度间隔25ms,单位125us */ -#define SLE_ADV_INTERVAL_MIN_DEFAULT 0xC8 -/* 连接调度间隔25ms,单位125us */ -#define SLE_ADV_INTERVAL_MAX_DEFAULT 0xC8 -/* 超时时间5000ms,单位10ms */ -#define SLE_CONN_SUPERVISION_TIMEOUT_DEFAULT 0x1F4 -/* 超时时间4990ms,单位10ms */ -#define SLE_CONN_MAX_LATENCY 0x1F3 -/* 广播发送功率 */ -#define SLE_ADV_TX_POWER 20 -/* 最大广播数据长度 */ -#define SLE_ADV_DATA_LEN_MAX 251 - -uint8_t sle_local_name[ NAME_MAX_LENGTH] = "sle_uart_server"; - -static uint16_t sle_set_adv_local_name(uint8_t *adv_data, uint16_t max_len) -{ - errno_t ret; - uint8_t index = 0; - - uint8_t *local_name = sle_local_name; - uint8_t local_name_len = (uint8_t)strlen((char *)local_name); - for (uint8_t i = 0; i < local_name_len; i++) { - osal_printk("local_name[%d] = 0x%02x\r\n", i, local_name[i]); - } - - adv_data[index++] = local_name_len + 1; - adv_data[index++] = SLE_ADV_DATA_TYPE_COMPLETE_LOCAL_NAME; - ret = memcpy_s(&adv_data[index], max_len - index, local_name, local_name_len); - if (ret != EOK) { - osal_printk("memcpy fail\r\n"); - return 0; - } - return (uint16_t)index + local_name_len; -} - -static uint16_t sle_set_adv_data(uint8_t *adv_data) -{ - size_t len = 0; - uint16_t idx = 0; - errno_t ret = 0; - - len = sizeof(struct sle_adv_common_value); - struct sle_adv_common_value adv_disc_level = { - .length = len - 1, - .type = SLE_ADV_DATA_TYPE_DISCOVERY_LEVEL, - .value = SLE_ANNOUNCE_LEVEL_NORMAL, - }; - ret = memcpy_s(&adv_data[idx], SLE_ADV_DATA_LEN_MAX - idx, &adv_disc_level, len); - if (ret != EOK) { - osal_printk("adv_disc_level memcpy fail\r\n"); - return 0; - } - idx += len; - - len = sizeof(struct sle_adv_common_value); - struct sle_adv_common_value adv_access_mode = { - .length = len - 1, - .type = SLE_ADV_DATA_TYPE_ACCESS_MODE, - .value = 0, - }; - ret = memcpy_s(&adv_data[idx], SLE_ADV_DATA_LEN_MAX - idx, &adv_access_mode, len); - if (ret != EOK) { - osal_printk("memcpy fail\r\n"); - return 0; - } - idx += len; - return idx; -} - -static uint16_t sle_set_scan_response_data(uint8_t *scan_rsp_data) -{ - uint16_t idx = 0; - errno_t ret; - size_t scan_rsp_data_len = sizeof(struct sle_adv_common_value); - - struct sle_adv_common_value tx_power_level = { - .length = scan_rsp_data_len - 1, - .type = SLE_ADV_DATA_TYPE_TX_POWER_LEVEL, - .value = SLE_ADV_TX_POWER, - }; - ret = memcpy_s(scan_rsp_data, SLE_ADV_DATA_LEN_MAX, &tx_power_level, scan_rsp_data_len); - if (ret != EOK) { - osal_printk("sle scan response data memcpy fail\r\n"); - return 0; - } - idx += scan_rsp_data_len; - - /* set local name */ - idx += sle_set_adv_local_name(&scan_rsp_data[idx], SLE_ADV_DATA_LEN_MAX - idx); - return idx; -} - -static int sle_set_default_announce_param(void) -{ - sle_announce_param_t param = {0}; - uint8_t mac[SLE_ADDR_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; - param.announce_mode = SLE_ANNOUNCE_MODE_CONNECTABLE_SCANABLE; - param.announce_handle = SLE_ADV_HANDLE_DEFAULT; - param.announce_gt_role = SLE_ANNOUNCE_ROLE_T_CAN_NEGO; - param.announce_level = SLE_ANNOUNCE_LEVEL_NORMAL; - param.announce_channel_map = SLE_ADV_CHANNEL_MAP_DEFAULT; - param.announce_interval_min = SLE_ADV_INTERVAL_MIN_DEFAULT; - param.announce_interval_max = SLE_ADV_INTERVAL_MAX_DEFAULT; - param.conn_interval_min = SLE_CONN_INTV_MIN_DEFAULT; - param.conn_interval_max = SLE_CONN_INTV_MAX_DEFAULT; - param.conn_max_latency = SLE_CONN_MAX_LATENCY; - param.conn_supervision_timeout = SLE_CONN_SUPERVISION_TIMEOUT_DEFAULT; - param.announce_tx_power = SLE_ADV_TX_POWER; - param.own_addr.type = 0; - memcpy_s(param.own_addr.addr, SLE_ADDR_LEN, mac, SLE_ADDR_LEN); - return sle_set_announce_param(param.announce_handle, ¶m); -} - -static int sle_set_default_announce_data(void) -{ - errcode_t ret; - uint8_t announce_data_len = 0; - uint8_t seek_data_len = 0; - sle_announce_data_t data = {0}; - uint8_t adv_handle = SLE_ADV_HANDLE_DEFAULT; - uint8_t announce_data[SLE_ADV_DATA_LEN_MAX] = {0}; - uint8_t seek_rsp_data[SLE_ADV_DATA_LEN_MAX] = {0}; - - osal_printk("set adv data default\r\n"); - announce_data_len = sle_set_adv_data(announce_data); - data.announce_data = announce_data; - data.announce_data_len = announce_data_len; - - seek_data_len = sle_set_scan_response_data(seek_rsp_data); - data.seek_rsp_data = seek_rsp_data; - data.seek_rsp_data_len = seek_data_len; - - ret = sle_set_announce_data(adv_handle, &data); - if (ret == ERRCODE_SLE_SUCCESS) { - osal_printk("[SLE DD SDK] set announce data success."); - } else { - osal_printk("[SLE DD SDK] set adv param fail."); - } - return ERRCODE_SLE_SUCCESS; -} - -void sle_announce_enable_cbk(uint32_t announce_id, errcode_t status) -{ - osal_printk("sle announce enable id:%02x, state:%02x\r\n", announce_id, status); -} - -void sle_announce_disable_cbk(uint32_t announce_id, errcode_t status) -{ - osal_printk("sle announce disable id:%02x, state:%02x\r\n", announce_id, status); -} - -void sle_announce_terminal_cbk(uint32_t announce_id) -{ - osal_printk("sle announce terminal id:%02x\r\n", announce_id); -} - -void sle_enable_cbk(errcode_t status) -{ - osal_printk("sle enable status:%02x\r\n", status); -} - -void sle_announce_register_cbks(void) -{ - sle_announce_seek_callbacks_t seek_cbks = {0}; - seek_cbks.announce_enable_cb = sle_announce_enable_cbk; - seek_cbks.announce_disable_cb = sle_announce_disable_cbk; - seek_cbks.announce_terminal_cb = sle_announce_terminal_cbk; - seek_cbks.sle_enable_cb = sle_enable_cbk; - sle_announce_seek_register_callbacks(&seek_cbks); -} - -errcode_t sle_uuid_server_adv_init(void) -{ - osal_printk("sle_uuid_server_adv_init in\r\n"); - - sle_announce_register_cbks(); - sle_set_default_announce_param(); - sle_set_default_announce_data(); - sle_start_announce(SLE_ADV_HANDLE_DEFAULT); - osal_printk("sle_uuid_server_adv_init out\r\n"); - return ERRCODE_SLE_SUCCESS; -} diff --git a/application/samples/bt/sle/sle_uuid_client/CMakeLists.txt b/application/samples/bt/sle/sle_uuid_client/CMakeLists.txt deleted file mode 100755 index 6e00cb6..0000000 --- a/application/samples/bt/sle/sle_uuid_client/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/sle/sle_uuid_client/inc/sle_uuid_client.h b/application/samples/bt/sle/sle_uuid_client/inc/sle_uuid_client.h deleted file mode 100755 index f7d9957..0000000 --- a/application/samples/bt/sle/sle_uuid_client/inc/sle_uuid_client.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: SLE private service register sample of client. - */ - -/** - * @defgroup SLE UUID CLIENT API - * @ingroup - * @{ - */ - -#ifndef SLE_CLIENT_ADV_H -#define SLE_CLIENT_ADV_H - -/** - * @if Eng - * @brief sle uuid client init. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle uuid客户端初始化。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -void sle_client_init(void); - -/** - * @if Eng - * @brief sle start scan. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle启动扫描。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -void sle_start_scan(void); - -#endif \ No newline at end of file diff --git a/application/samples/bt/sle/sle_uuid_client/src/CMakeLists.txt b/application/samples/bt/sle/sle_uuid_client/src/CMakeLists.txt deleted file mode 100755 index c74179a..0000000 --- a/application/samples/bt/sle/sle_uuid_client/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_uuid_client.c" - PARENT_SCOPE) diff --git a/application/samples/bt/sle/sle_uuid_client/src/sle_uuid_client.c b/application/samples/bt/sle/sle_uuid_client/src/sle_uuid_client.c deleted file mode 100755 index eb82473..0000000 --- a/application/samples/bt/sle/sle_uuid_client/src/sle_uuid_client.c +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022. All rights reserved. - * - * Description: SLE private service register sample of client. - */ -#include "securec.h" -#include "soc_osal.h" -#include "app_init.h" -#include "sle_device_discovery.h" -#include "sle_connection_manager.h" -#include "sle_ssap_client.h" -#include "sle_uuid_client.h" - -#undef THIS_FILE_ID -#define THIS_FILE_ID BTH_GLE_SAMPLE_UUID_CLIENT - -#define SLE_MTU_SIZE_DEFAULT 300 -#define SLE_SEEK_INTERVAL_DEFAULT 100 -#define SLE_SEEK_WINDOW_DEFAULT 100 -#define UUID_16BIT_LEN 2 -#define UUID_128BIT_LEN 16 - -sle_announce_seek_callbacks_t g_seek_cbk = {0}; -sle_connection_callbacks_t g_connect_cbk = {0}; -ssapc_callbacks_t g_ssapc_cbk = {0}; -sle_addr_t g_remote_addr = {0}; -uint16_t g_conn_id = 0; -ssapc_find_service_result_t g_find_service_result = {0}; - -void sle_sample_sle_enable_cbk(errcode_t status) -{ - if (status == 0) { - sle_start_scan(); - } -} - -void sle_sample_seek_enable_cbk(errcode_t status) -{ - if (status == 0) { - return; - } -} - -void sle_sample_seek_disable_cbk(errcode_t status) -{ - if (status == 0) { - sle_connect_remote_device(&g_remote_addr); - } -} - -void sle_sample_seek_result_info_cbk(sle_seek_result_info_t *seek_result_data) -{ - if (seek_result_data != NULL) { - (void)memcpy_s(&g_remote_addr, sizeof(sle_addr_t), &seek_result_data->addr, sizeof(sle_addr_t)); - sle_stop_seek(); - } -} - -void sle_sample_seek_cbk_register(void) -{ - g_seek_cbk.sle_enable_cb = sle_sample_sle_enable_cbk; - g_seek_cbk.seek_enable_cb = sle_sample_seek_enable_cbk; - g_seek_cbk.seek_disable_cb = sle_sample_seek_disable_cbk; - g_seek_cbk.seek_result_cb = sle_sample_seek_result_info_cbk; -} - -void sle_sample_connect_state_changed_cbk(uint16_t conn_id, const sle_addr_t *addr, - sle_acb_state_t conn_state, sle_pair_state_t pair_state, sle_disc_reason_t disc_reason) -{ - osal_printk("[ssap client] conn state changed conn_id:%d, addr:%02x***%02x%02x\n", conn_id, addr->addr[0], - addr->addr[4], addr->addr[5]); /* 0 4 5: addr index */ - osal_printk("[ssap client] conn state changed disc_reason:0x%x\n", disc_reason); - if (conn_state == SLE_ACB_STATE_CONNECTED) { - if (pair_state == SLE_PAIR_NONE) { - sle_pair_remote_device(&g_remote_addr); - } - g_conn_id = conn_id; - } -} - -void sle_sample_pair_complete_cbk(uint16_t conn_id, const sle_addr_t *addr, errcode_t status) -{ - osal_printk("[ssap client] pair complete conn_id:%d, addr:%02x***%02x%02x\n", conn_id, addr->addr[0], - addr->addr[4], addr->addr[5]); /* 0 4 5: addr index */ - if (status == 0) { - ssap_exchange_info_t info = {0}; - info.mtu_size = SLE_MTU_SIZE_DEFAULT; - info.version = 1; - ssapc_exchange_info_req(1, g_conn_id, &info); - } -} - -void sle_sample_connect_cbk_register(void) -{ - g_connect_cbk.connect_state_changed_cb = sle_sample_connect_state_changed_cbk; - g_connect_cbk.pair_complete_cb = sle_sample_pair_complete_cbk; -} - -void sle_sample_exchange_info_cbk(uint8_t client_id, uint16_t conn_id, ssap_exchange_info_t *param, - errcode_t status) -{ - osal_printk("[ssap client] pair complete client id:%d status:%d\n", client_id, status); - osal_printk("[ssap client] exchange mtu, mtu size: %d, version: %d.\n", - param->mtu_size, param->version); - - ssapc_find_structure_param_t find_param = {0}; - find_param.type = SSAP_FIND_TYPE_PRIMARY_SERVICE; - find_param.start_hdl = 1; - find_param.end_hdl = 0xFFFF; - ssapc_find_structure(0, conn_id, &find_param); -} - -void sle_sample_find_structure_cbk(uint8_t client_id, uint16_t conn_id, ssapc_find_service_result_t *service, - errcode_t status) -{ - osal_printk("[ssap client] find structure cbk client: %d conn_id:%d status: %d \n", - client_id, conn_id, status); - osal_printk("[ssap client] find structure start_hdl:[0x%02x], end_hdl:[0x%02x], uuid len:%d\r\n", - service->start_hdl, service->end_hdl, service->uuid.len); - if (service->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] structure uuid:[0x%02x][0x%02x]\r\n", - service->uuid.uuid[14], service->uuid.uuid[15]); /* 14 15: uuid index */ - } else { - for (uint8_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] structure uuid[%d]:[0x%02x]\r\n", idx, service->uuid.uuid[idx]); - } - } - g_find_service_result.start_hdl = service->start_hdl; - g_find_service_result.end_hdl = service->end_hdl; - memcpy_s(&g_find_service_result.uuid, sizeof(sle_uuid_t), &service->uuid, sizeof(sle_uuid_t)); -} - -void sle_sample_find_structure_cmp_cbk(uint8_t client_id, uint16_t conn_id, - ssapc_find_structure_result_t *structure_result, errcode_t status) -{ - osal_printk("[ssap client] find structure cmp cbk client id:%d status:%d type:%d uuid len:%d \r\n", - client_id, status, structure_result->type, structure_result->uuid.len); - if (structure_result->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] find structure cmp cbk structure uuid:[0x%02x][0x%02x]\r\n", - structure_result->uuid.uuid[14], structure_result->uuid.uuid[15]); /* 14 15: uuid index */ - } else { - for (uint8_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] find structure cmp cbk structure uuid[%d]:[0x%02x]\r\n", idx, - structure_result->uuid.uuid[idx]); - } - } - uint8_t data[] = {0x11, 0x22, 0x33, 0x44}; - uint8_t len = sizeof(data); - ssapc_write_param_t param = {0}; - param.handle = g_find_service_result.start_hdl; - param.type = SSAP_PROPERTY_TYPE_VALUE; - param.data_len = len; - param.data = data; - ssapc_write_req(0, conn_id, ¶m); -} - -void sle_sample_find_property_cbk(uint8_t client_id, uint16_t conn_id, - ssapc_find_property_result_t *property, errcode_t status) -{ - osal_printk("[ssap client] find property cbk, client id: %d, conn id: %d, operate ind: %d, " - "descriptors count: %d status:%d.\n", client_id, conn_id, property->operate_indication, - property->descriptors_count, status); - for (uint16_t idx = 0; idx < property->descriptors_count; idx++) { - osal_printk("[ssap client] find property cbk, descriptors type [%d]: 0x%02x.\n", - idx, property->descriptors_type[idx]); - } - if (property->uuid.len == UUID_16BIT_LEN) { - osal_printk("[ssap client] find property cbk, uuid: %02x %02x.\n", - property->uuid.uuid[14], property->uuid.uuid[15]); /* 14 15: uuid index */ - } else if (property->uuid.len == UUID_128BIT_LEN) { - for (uint16_t idx = 0; idx < UUID_128BIT_LEN; idx++) { - osal_printk("[ssap client] find property cbk, uuid [%d]: %02x.\n", - idx, property->uuid.uuid[idx]); - } - } -} - -void sle_sample_write_cfm_cbk(uint8_t client_id, uint16_t conn_id, ssapc_write_result_t *write_result, - errcode_t status) -{ - osal_printk("[ssap client] write cfm cbk, client id: %d status:%d.\n", client_id, status); - ssapc_read_req(0, conn_id, write_result->handle, write_result->type); -} - -void sle_sample_read_cfm_cbk(uint8_t client_id, uint16_t conn_id, ssapc_handle_value_t *read_data, - errcode_t status) -{ - osal_printk("[ssap client] read cfm cbk client id: %d conn id: %d status: %d\n", - client_id, conn_id, status); - osal_printk("[ssap client] read cfm cbk handle: %d, type: %d , len: %d\n", - read_data->handle, read_data->type, read_data->data_len); - for (uint16_t idx = 0; idx < read_data->data_len; idx++) { - osal_printk("[ssap client] read cfm cbk[%d] 0x%02x\r\n", idx, read_data->data[idx]); - } -} - -void sle_sample_ssapc_cbk_register(void) -{ - g_ssapc_cbk.exchange_info_cb = sle_sample_exchange_info_cbk; - g_ssapc_cbk.find_structure_cb = sle_sample_find_structure_cbk; - g_ssapc_cbk.find_structure_cmp_cb = sle_sample_find_structure_cmp_cbk; - g_ssapc_cbk.ssapc_find_property_cbk = sle_sample_find_property_cbk; - g_ssapc_cbk.write_cfm_cb = sle_sample_write_cfm_cbk; - g_ssapc_cbk.read_cfm_cb = sle_sample_read_cfm_cbk; -} - -void sle_client_init() -{ - sle_sample_seek_cbk_register(); - sle_sample_connect_cbk_register(); - sle_sample_ssapc_cbk_register(); - sle_announce_seek_register_callbacks(&g_seek_cbk); - sle_connection_register_callbacks(&g_connect_cbk); - ssapc_register_callbacks(&g_ssapc_cbk); - enable_sle(); -} - -void sle_start_scan() -{ - sle_seek_param_t param = {0}; - param.own_addr_type = 0; - param.filter_duplicates = 0; - param.seek_filter_policy = 0; - param.seek_phys = 1; - param.seek_type[0] = 0; - param.seek_interval[0] = SLE_SEEK_INTERVAL_DEFAULT; - param.seek_window[0] = SLE_SEEK_WINDOW_DEFAULT; - sle_set_seek_param(¶m); - sle_start_seek(); -} - -#define SLE_UUID_CLIENT_TASK_PRIO 26 -#define SLE_UUID_CLIENT_STACK_SIZE 0x2000 - -static void sle_uuid_client_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)sle_client_init, 0, "sle_gatt_client", - SLE_UUID_CLIENT_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SLE_UUID_CLIENT_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(sle_uuid_client_entry); \ No newline at end of file diff --git a/application/samples/bt/sle/sle_uuid_server/CMakeLists.txt b/application/samples/bt/sle/sle_uuid_server/CMakeLists.txt deleted file mode 100755 index be2e0bc..0000000 --- a/application/samples/bt/sle/sle_uuid_server/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(src) - -set(SOURCES "${SOURCES}" PARENT_SCOPE) -set(PUBLIC_HEADER "${PUBLIC_HEADER}" "${CMAKE_CURRENT_SOURCE_DIR}/inc" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/bt/sle/sle_uuid_server/inc/sle_server_adv.h b/application/samples/bt/sle/sle_uuid_server/inc/sle_server_adv.h deleted file mode 100755 index 8e34f7e..0000000 --- a/application/samples/bt/sle/sle_uuid_server/inc/sle_server_adv.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.. 2023. All rights reserved. - * - * Description: SLE ADV Config. - */ - -/** - * @defgroup bluetooth_sle_adv API - * @ingroup - * @{ - */ - -#ifndef SLE_SERVER_ADV_H -#define SLE_SERVER_ADV_H - -/* 广播ID */ -#define SLE_ADV_HANDLE_DEFAULT 1 - -/** - * @if Eng - * @brief Definitaion of BLE ADV 通用广播结构. - * @else - * @brief SLE 广播普通数据结构。 - * @endif - */ -struct sle_adv_common_value { - uint8_t length; - uint8_t type; - uint8_t value; -}; - -/** - * @if Eng - * @brief Definitaion of BLE ADV Channel mapping. - * @else - * @brief SLE 广播信道映射。 - * @endif - */ -typedef enum { - SLE_ADV_CHANNEL_MAP_77 = 0x01, - SLE_ADV_CHANNEL_MAP_78 = 0x02, - SLE_ADV_CHANNEL_MAP_79 = 0x04, - SLE_ADV_CHANNEL_MAP_DEFAULT = 0x07 -} sle_adv_channel_map; - -/** - * @if Eng - * @brief Definitaion of SLE ADV Data Type. - * @else - * @brief SLE 广播数据类型 - * @endif - */ -typedef enum { - SLE_ADV_DATA_TYPE_DISCOVERY_LEVEL = 0x01, /*!< 发现等级 */ - SLE_ADV_DATA_TYPE_ACCESS_MODE = 0x02, /*!< 接入层能力 */ - SLE_ADV_DATA_TYPE_SERVICE_DATA_16BIT_UUID = 0x03, /*!< 标准服务数据信息 */ - SLE_ADV_DATA_TYPE_SERVICE_DATA_128BIT_UUID = 0x04, /*!< 自定义服务数据信息 */ - SLE_ADV_DATA_TYPE_COMPLETE_LIST_OF_16BIT_SERVICE_UUIDS = 0x05, /*!< 完整标准服务标识列表 */ - SLE_ADV_DATA_TYPE_COMPLETE_LIST_OF_128BIT_SERVICE_UUIDS = 0x06, /*!< 完整自定义服务标识列表 */ - SLE_ADV_DATA_TYPE_INCOMPLETE_LIST_OF_16BIT_SERVICE_UUIDS = 0x07, /*!< 部分标准服务标识列表 */ - SLE_ADV_DATA_TYPE_INCOMPLETE_LIST_OF_128BIT_SERVICE_UUIDS = 0x08, /*!< 部分自定义服务标识列表 */ - SLE_ADV_DATA_TYPE_SERVICE_STRUCTURE_HASH_VALUE = 0x09, /*!< 服务结构散列值 */ - SLE_ADV_DATA_TYPE_SHORTENED_LOCAL_NAME = 0x0A, /*!< 设备缩写本地名称 */ - SLE_ADV_DATA_TYPE_COMPLETE_LOCAL_NAME = 0x0B, /*!< 设备完整本地名称 */ - SLE_ADV_DATA_TYPE_TX_POWER_LEVEL = 0x0C, /*!< 广播发送功率 */ - SLE_ADV_DATA_TYPE_SLB_COMMUNICATION_DOMAIN = 0x0D, /*!< SLB通信域域名 */ - SLE_ADV_DATA_TYPE_SLB_MEDIA_ACCESS_LAYER_ID = 0x0E, /*!< SLB媒体接入层标识 */ - SLE_ADV_DATA_TYPE_EXTENDED = 0xFE, /*!< 数据类型扩展 */ - SLE_ADV_DATA_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF /*!< 厂商自定义信息 */ -} sle_adv_data_type; - - -/** - * @if Eng - * @brief sle adv data config. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li NULL - * @else - * @brief sle广播数据配置。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li NULL - * @endif - */ -errcode_t sle_uuid_server_adv_init(void); -#endif \ No newline at end of file diff --git a/application/samples/bt/sle/sle_uuid_server/inc/sle_uuid_server.h b/application/samples/bt/sle/sle_uuid_server/inc/sle_uuid_server.h deleted file mode 100755 index 1c514d2..0000000 --- a/application/samples/bt/sle/sle_uuid_server/inc/sle_uuid_server.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.. 2022. All rights reserved. - * - * Description: SLE UUID Server module. - */ - -/** - * @defgroup SLE UUID SERVER API - * @ingroup - * @{ - */ -#ifndef SLE_UUID_SERVER_H -#define SLE_UUID_SERVER_H - -#include "sle_ssap_server.h" - -/* Service UUID */ -#define SLE_UUID_SERVER_SERVICE 0xABCD - -/* Property UUID */ -#define SLE_UUID_SERVER_NTF_REPORT 0x1122 - -/* Property Property */ -#define SLE_UUID_TEST_PROPERTIES (SSAP_PERMISSION_READ | SSAP_PERMISSION_WRITE) - -/* Descriptor Property */ -#define SLE_UUID_TEST_DESCRIPTOR (SSAP_PERMISSION_READ | SSAP_PERMISSION_WRITE) - -/** - * @if Eng - * @brief SLE uuid server inir. - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief SLE UUID服务器初始化。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_init(void); - -/** - * @if Eng - * @brief send data to peer device by uuid on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_send_report_by_uuid(const uint8_t *data, uint16_t len); - -/** - * @if Eng - * @brief send data to peer device by handle on uuid server. - * @attention NULL - * @param [in] value send value. - * @param [in] len Length of send value。 - * @retval ERRCODE_SLE_SUCCESS Excute successfully - * @retval ERRCODE_SLE_FAIL Execute fail - * @par Dependency: - * @li sle_ssap_server.h - * @else - * @brief 通过uuid server 发送数据给对端。 - * @attention NULL - * @retval ERRCODE_SLE_SUCCESS 执行成功 - * @retval ERRCODE_SLE_FAIL 执行失败 - * @par 依赖: - * @li sle_ssap_server.h - * @endif - */ -errcode_t sle_uuid_server_send_report_by_handle(const uint8_t *data, uint8_t len); -#endif diff --git a/application/samples/bt/sle/sle_uuid_server/src/CMakeLists.txt b/application/samples/bt/sle/sle_uuid_server/src/CMakeLists.txt deleted file mode 100755 index d8c7be3..0000000 --- a/application/samples/bt/sle/sle_uuid_server/src/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_server_adv.c" - "${CMAKE_CURRENT_SOURCE_DIR}/sle_uuid_server.c" - PARENT_SCOPE) diff --git a/application/samples/bt/sle/sle_uuid_server/src/sle_server_adv.c b/application/samples/bt/sle/sle_uuid_server/src/sle_server_adv.c deleted file mode 100755 index e48495e..0000000 --- a/application/samples/bt/sle/sle_uuid_server/src/sle_server_adv.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.. 2023. All rights reserved. - * Description: sle adv config for sle uuid server. - */ -#include "securec.h" -#include "errcode.h" -#include "osal_addr.h" -#include "osal_debug.h" -#include "sle_common.h" -#include "sle_device_discovery.h" -#include "sle_errcode.h" -#include "sle_server_adv.h" - -/* sle device name */ -#define NAME_MAX_LENGTH 15 -/* 连接调度间隔12.5ms,单位125us */ -#define SLE_CONN_INTV_MIN_DEFAULT 0x64 -/* 连接调度间隔12.5ms,单位125us */ -#define SLE_CONN_INTV_MAX_DEFAULT 0x64 -/* 连接调度间隔25ms,单位125us */ -#define SLE_ADV_INTERVAL_MIN_DEFAULT 0xC8 -/* 连接调度间隔25ms,单位125us */ -#define SLE_ADV_INTERVAL_MAX_DEFAULT 0xC8 -/* 超时时间5000ms,单位10ms */ -#define SLE_CONN_SUPERVISION_TIMEOUT_DEFAULT 0x1F4 -/* 超时时间4990ms,单位10ms */ -#define SLE_CONN_MAX_LATENCY 0x1F3 -/* 广播发送功率 */ -#define SLE_ADV_TX_POWER 10 -/* 最大广播数据长度 */ -#define SLE_ADV_DATA_LEN_MAX 251 -/* 广播名称 */ -uint8_t sle_local_name[ NAME_MAX_LENGTH] = { 's', 'l', 'e', '_', 'u', 'u', 'i', 'd', '_', 's', - 'e', 'r', 'v', 'e', 'r' }; - -static uint16_t sle_set_adv_local_name(uint8_t *adv_data, uint16_t max_len) -{ - errno_t ret; - uint8_t index = 0; - - uint8_t *local_name = sle_local_name; - uint8_t local_name_len = (uint8_t)strlen((char *)local_name); - for (uint8_t i = 0; i < local_name_len; i++) { - osal_printk("local_name[%d] = 0x%02x\r\n", i, local_name[i]); - } - - adv_data[index++] = local_name_len + 1; - adv_data[index++] = SLE_ADV_DATA_TYPE_COMPLETE_LOCAL_NAME; - ret = memcpy_s(&adv_data[index], max_len - index, local_name, local_name_len); - if (ret != EOK) { - osal_printk("memcpy fail\r\n"); - return 0; - } - return (uint16_t)index + local_name_len; -} - -static uint16_t sle_set_adv_data(uint8_t *adv_data) -{ - size_t len = 0; - uint16_t idx = 0; - errno_t ret = 0; - - len = sizeof(struct sle_adv_common_value); - struct sle_adv_common_value adv_disc_level = { - .length = len - 1, - .type = SLE_ADV_DATA_TYPE_DISCOVERY_LEVEL, - .value = SLE_ANNOUNCE_LEVEL_NORMAL, - }; - ret = memcpy_s(&adv_data[idx], SLE_ADV_DATA_LEN_MAX - idx, &adv_disc_level, len); - if (ret != EOK) { - osal_printk("adv_disc_level memcpy fail\r\n"); - return 0; - } - idx += len; - - len = sizeof(struct sle_adv_common_value); - struct sle_adv_common_value adv_access_mode = { - .length = len - 1, - .type = SLE_ADV_DATA_TYPE_ACCESS_MODE, - .value = 0, - }; - ret = memcpy_s(&adv_data[idx], SLE_ADV_DATA_LEN_MAX - idx, &adv_access_mode, len); - if (ret != EOK) { - osal_printk("memcpy fail\r\n"); - return 0; - } - idx += len; - return idx; -} - -static uint16_t sle_set_scan_response_data(uint8_t *scan_rsp_data) -{ - uint16_t idx = 0; - errno_t ret; - size_t scan_rsp_data_len = sizeof(struct sle_adv_common_value); - - struct sle_adv_common_value tx_power_level = { - .length = scan_rsp_data_len - 1, - .type = SLE_ADV_DATA_TYPE_TX_POWER_LEVEL, - .value = SLE_ADV_TX_POWER, - }; - ret = memcpy_s(scan_rsp_data, SLE_ADV_DATA_LEN_MAX, &tx_power_level, scan_rsp_data_len); - if (ret != EOK) { - osal_printk("sle scan response data memcpy fail\r\n"); - return 0; - } - idx += scan_rsp_data_len; - - /* set local name */ - idx += sle_set_adv_local_name(&scan_rsp_data[idx], SLE_ADV_DATA_LEN_MAX - idx); - return idx; -} - -static int sle_set_default_announce_param(void) -{ - sle_announce_param_t param = {0}; - param.announce_mode = SLE_ANNOUNCE_MODE_CONNECTABLE_SCANABLE; - param.announce_handle = SLE_ADV_HANDLE_DEFAULT; - param.announce_gt_role = SLE_ANNOUNCE_ROLE_T_CAN_NEGO; - param.announce_level = SLE_ANNOUNCE_LEVEL_NORMAL; - param.announce_channel_map = SLE_ADV_CHANNEL_MAP_DEFAULT; - param.announce_interval_min = SLE_ADV_INTERVAL_MIN_DEFAULT; - param.announce_interval_max = SLE_ADV_INTERVAL_MAX_DEFAULT; - param.conn_interval_min = SLE_CONN_INTV_MIN_DEFAULT; - param.conn_interval_max = SLE_CONN_INTV_MAX_DEFAULT; - param.conn_max_latency = SLE_CONN_MAX_LATENCY; - param.conn_supervision_timeout = SLE_CONN_SUPERVISION_TIMEOUT_DEFAULT; - return sle_set_announce_param(param.announce_handle, ¶m); -} - -static int sle_set_default_announce_data(void) -{ - errcode_t ret; - uint8_t announce_data_len = 0; - uint8_t seek_data_len = 0; - sle_announce_data_t data = {0}; - uint8_t adv_handle = SLE_ADV_HANDLE_DEFAULT; - uint8_t announce_data[SLE_ADV_DATA_LEN_MAX] = {0}; - uint8_t seek_rsp_data[SLE_ADV_DATA_LEN_MAX] = {0}; - - osal_printk("set adv data default\r\n"); - announce_data_len = sle_set_adv_data(announce_data); - data.announce_data = announce_data; - data.announce_data_len = announce_data_len; - - seek_data_len = sle_set_scan_response_data(seek_rsp_data); - data.seek_rsp_data = seek_rsp_data; - data.seek_rsp_data_len = seek_data_len; - - ret = sle_set_announce_data(adv_handle, &data); - if (ret == ERRCODE_SLE_SUCCESS) { - osal_printk("[SLE DD SDK] set announce data success."); - } else { - osal_printk("[SLE DD SDK] set adv param fail."); - } - return ERRCODE_SLE_SUCCESS; -} - -void sle_announce_enable_cbk(uint32_t announce_id, errcode_t status) -{ - osal_printk("sle announce enable id:%02x, state:%02x\r\n", announce_id, status); -} - -void sle_announce_disable_cbk(uint32_t announce_id, errcode_t status) -{ - osal_printk("sle announce disable id:%02x, state:%02x\r\n", announce_id, status); -} - -void sle_announce_terminal_cbk(uint32_t announce_id) -{ - osal_printk("sle announce terminal id:%02x\r\n", announce_id); -} - -void sle_enable_cbk(errcode_t status) -{ - osal_printk("sle enable status:%02x\r\n", status); -} - -void sle_announce_register_cbks(void) -{ - sle_announce_seek_callbacks_t seek_cbks = {0}; - seek_cbks.announce_enable_cb = sle_announce_enable_cbk; - seek_cbks.announce_disable_cb = sle_announce_disable_cbk; - seek_cbks.announce_terminal_cb = sle_announce_terminal_cbk; - seek_cbks.sle_enable_cb = sle_enable_cbk; - sle_announce_seek_register_callbacks(&seek_cbks); -} - -errcode_t sle_uuid_server_adv_init(void) -{ - osal_printk("sle_uuid_server_adv_init in\r\n"); - sle_announce_register_cbks(); - sle_set_default_announce_param(); - sle_set_default_announce_data(); - sle_start_announce(SLE_ADV_HANDLE_DEFAULT); - osal_printk("sle_uuid_server_adv_init out\r\n"); - return ERRCODE_SLE_SUCCESS; -} diff --git a/application/samples/bt/sle/sle_uuid_server/src/sle_uuid_server.c b/application/samples/bt/sle/sle_uuid_server/src/sle_uuid_server.c deleted file mode 100755 index cd25dc1..0000000 --- a/application/samples/bt/sle/sle_uuid_server/src/sle_uuid_server.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd.. 2023. All rights reserved. - * Description: sle uuid server sample. - */ -#include "securec.h" -#include "errcode.h" -#include "osal_addr.h" -#include "soc_osal.h" -#include "app_init.h" -#include "sle_common.h" -#include "sle_errcode.h" -#include "sle_ssap_server.h" -#include "sle_connection_manager.h" -#include "sle_device_discovery.h" -#include "sle_server_adv.h" -#include "sle_uuid_server.h" - -#define OCTET_BIT_LEN 8 -#define UUID_LEN_2 2 -#define BT_INDEX_4 4 -#define BT_INDEX_5 5 -#define BT_INDEX_0 0 - -#define encode2byte_little(_ptr, data) \ - do { \ - *(uint8_t *)((_ptr) + 1) = (uint8_t)((data) >> 8); \ - *(uint8_t *)(_ptr) = (uint8_t)(data); \ - } while (0) - -/* sle server app uuid for test */ -char g_sle_uuid_app_uuid[UUID_LEN_2] = {0x0, 0x0}; -/* server notify property uuid for test */ -char g_sle_property_value[OCTET_BIT_LEN] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; -/* sle connect acb handle */ -uint16_t g_sle_conn_hdl = 0; -/* sle server handle */ -uint8_t g_server_id = 0; -/* sle service handle */ -uint16_t g_service_handle = 0; -/* sle ntf property handle */ -uint16_t g_property_handle = 0; - -static uint8_t sle_uuid_base[] = { 0x37, 0xBE, 0xA8, 0x80, 0xFC, 0x70, 0x11, 0xEA, \ - 0xB7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static void sle_uuid_set_base(sle_uuid_t *out) -{ - (void)memcpy_s(out->uuid, SLE_UUID_LEN, sle_uuid_base, SLE_UUID_LEN); - out->len = UUID_LEN_2; -} - -static void sle_uuid_setu2(uint16_t u2, sle_uuid_t *out) -{ - sle_uuid_set_base(out); - out->len = UUID_LEN_2; - encode2byte_little(&out->uuid[14], u2); -} - -static void ssaps_read_request_cbk(uint8_t server_id, uint16_t conn_id, ssaps_req_read_cb_t *read_cb_para, - errcode_t status) -{ - osal_printk("[uuid server] ssaps read request cbk server_id:%x, conn_id:%x, handle:%x, status:%x\r\n", - server_id, conn_id, read_cb_para->handle, status); -} - -static void ssaps_write_request_cbk(uint8_t server_id, uint16_t conn_id, ssaps_req_write_cb_t *write_cb_para, - errcode_t status) -{ - osal_printk("[uuid server] ssaps write request cbk server_id:%x, conn_id:%x, handle:%x, status:%x\r\n", - server_id, conn_id, write_cb_para->handle, status); -} - -static void ssaps_mtu_changed_cbk(uint8_t server_id, uint16_t conn_id, ssap_exchange_info_t *mtu_size, - errcode_t status) -{ - osal_printk("[uuid server] ssaps write request cbk server_id:%x, conn_id:%x, mtu_size:%x, status:%x\r\n", - server_id, conn_id, mtu_size->mtu_size, status); -} - -static void ssaps_start_service_cbk(uint8_t server_id, uint16_t handle, errcode_t status) -{ - osal_printk("[uuid server] start service cbk server_id:%x, handle:%x, status:%x\r\n", - server_id, handle, status); -} - -static void sle_ssaps_register_cbks(void) -{ - ssaps_callbacks_t ssaps_cbk = {0}; - ssaps_cbk.start_service_cb = ssaps_start_service_cbk; - ssaps_cbk.mtu_changed_cb = ssaps_mtu_changed_cbk; - ssaps_cbk.read_request_cb = ssaps_read_request_cbk; - ssaps_cbk.write_request_cb = ssaps_write_request_cbk; - ssaps_register_callbacks(&ssaps_cbk); -} - -static errcode_t sle_uuid_server_service_add(void) -{ - errcode_t ret; - sle_uuid_t service_uuid = {0}; - sle_uuid_setu2(SLE_UUID_SERVER_SERVICE, &service_uuid); - ret = ssaps_add_service_sync(g_server_id, &service_uuid, 1, &g_service_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[uuid server] sle uuid add service fail, ret:%x\r\n", ret); - return ERRCODE_SLE_FAIL; - } - return ERRCODE_SLE_SUCCESS; -} - -static errcode_t sle_uuid_server_property_add(void) -{ - errcode_t ret; - ssaps_property_info_t property = {0}; - ssaps_desc_info_t descriptor = {0}; - uint8_t ntf_value[] = {0x01, 0x0}; - - property.permissions = SLE_UUID_TEST_PROPERTIES; - sle_uuid_setu2(SLE_UUID_SERVER_NTF_REPORT, &property.uuid); - property.value = osal_vmalloc(sizeof(g_sle_property_value)); - if (property.value == NULL) { - osal_printk("[uuid server] sle property mem fail\r\n"); - return ERRCODE_SLE_FAIL; - } - if (memcpy_s(property.value, sizeof(g_sle_property_value), g_sle_property_value, - sizeof(g_sle_property_value)) != EOK) { - osal_vfree(property.value); - osal_printk("[uuid server] sle property mem cpy fail\r\n"); - return ERRCODE_SLE_FAIL; - } - ret = ssaps_add_property_sync(g_server_id, g_service_handle, &property, &g_property_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[uuid server] sle uuid add property fail, ret:%x\r\n", ret); - osal_vfree(property.value); - return ERRCODE_SLE_FAIL; - } - descriptor.permissions = SLE_UUID_TEST_DESCRIPTOR; - descriptor.value = osal_vmalloc(sizeof(ntf_value)); - if (descriptor.value == NULL) { - osal_printk("[uuid server] sle descriptor mem fail\r\n"); - osal_vfree(property.value); - return ERRCODE_SLE_FAIL; - } - if (memcpy_s(descriptor.value, sizeof(ntf_value), ntf_value, sizeof(ntf_value)) != EOK) { - osal_printk("[uuid server] sle descriptor mem cpy fail\r\n"); - osal_vfree(property.value); - osal_vfree(descriptor.value); - return ERRCODE_SLE_FAIL; - } - ret = ssaps_add_descriptor_sync(g_server_id, g_service_handle, g_property_handle, &descriptor); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[uuid server] sle uuid add descriptor fail, ret:%x\r\n", ret); - osal_vfree(property.value); - osal_vfree(descriptor.value); - return ERRCODE_SLE_FAIL; - } - osal_vfree(property.value); - osal_vfree(descriptor.value); - return ERRCODE_SLE_SUCCESS; -} - -static errcode_t sle_uuid_server_add(void) -{ - errcode_t ret; - sle_uuid_t app_uuid = {0}; - - osal_printk("[uuid server] sle uuid add service in\r\n"); - app_uuid.len = sizeof(g_sle_uuid_app_uuid); - if (memcpy_s(app_uuid.uuid, app_uuid.len, g_sle_uuid_app_uuid, sizeof(g_sle_uuid_app_uuid)) != EOK) { - return ERRCODE_SLE_FAIL; - } - ssaps_register_server(&app_uuid, &g_server_id); - - if (sle_uuid_server_service_add() != ERRCODE_SLE_SUCCESS) { - ssaps_unregister_server(g_server_id); - return ERRCODE_SLE_FAIL; - } - - if (sle_uuid_server_property_add() != ERRCODE_SLE_SUCCESS) { - ssaps_unregister_server(g_server_id); - return ERRCODE_SLE_FAIL; - } - osal_printk("[uuid server] sle uuid add service, server_id:%x, service_handle:%x, property_handle:%x\r\n", - g_server_id, g_service_handle, g_property_handle); - ret = ssaps_start_service(g_server_id, g_service_handle); - if (ret != ERRCODE_SLE_SUCCESS) { - osal_printk("[uuid server] sle uuid add service fail, ret:%x\r\n", ret); - return ERRCODE_SLE_FAIL; - } - osal_printk("[uuid server] sle uuid add service out\r\n"); - return ERRCODE_SLE_SUCCESS; -} - -/* device通过uuid向host发送数据:report */ -errcode_t sle_uuid_server_send_report_by_uuid(const uint8_t *data, uint16_t len) -{ - ssaps_ntf_ind_by_uuid_t param = {0}; - param.type = SSAP_PROPERTY_TYPE_VALUE; - param.start_handle = g_service_handle; - param.end_handle = g_property_handle; - param.value_len = len; - param.value = osal_vmalloc(len); - if (param.value == NULL) { - osal_printk("[uuid server] send report new fail\r\n"); - return ERRCODE_SLE_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[uuid server] send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_SLE_FAIL; - } - sle_uuid_setu2(SLE_UUID_SERVER_NTF_REPORT, ¶m.uuid); - ssaps_notify_indicate_by_uuid(g_server_id, g_sle_conn_hdl, ¶m); - osal_vfree(param.value); - return ERRCODE_SLE_SUCCESS; -} - -/* device通过handle向host发送数据:report */ -errcode_t sle_uuid_server_send_report_by_handle(const uint8_t *data, uint8_t len) -{ - ssaps_ntf_ind_t param = {0}; - - param.handle = g_property_handle; - param.type = SSAP_PROPERTY_TYPE_VALUE; - param.value = osal_vmalloc(len); - param.value_len = len; - if (param.value == NULL) { - osal_printk("[uuid server] send report new fail\r\n"); - return ERRCODE_SLE_FAIL; - } - if (memcpy_s(param.value, param.value_len, data, len) != EOK) { - osal_printk("[uuid server] send input report memcpy fail\r\n"); - osal_vfree(param.value); - return ERRCODE_SLE_FAIL; - } - ssaps_notify_indicate(g_server_id, g_sle_conn_hdl, ¶m); - osal_vfree(param.value); - return ERRCODE_SLE_SUCCESS; -} - -static void sle_connect_state_changed_cbk(uint16_t conn_id, const sle_addr_t *addr, - sle_acb_state_t conn_state, sle_pair_state_t pair_state, sle_disc_reason_t disc_reason) -{ - osal_printk("[uuid server] connect state changed conn_id:0x%02x, conn_state:0x%x, pair_state:0x%x, \ - disc_reason:0x%x\r\n", conn_id, conn_state, pair_state, disc_reason); - osal_printk("[uuid server] connect state changed addr:%02x:**:**:**:%02x:%02x\r\n", - addr->addr[BT_INDEX_0], addr->addr[BT_INDEX_4], addr->addr[BT_INDEX_5]); - g_sle_conn_hdl = conn_id; - if (conn_state == SLE_ACB_STATE_DISCONNECTED) { - sle_start_announce(SLE_ADV_HANDLE_DEFAULT); - } -} - -static void sle_pair_complete_cbk(uint16_t conn_id, const sle_addr_t *addr, errcode_t status) -{ - osal_printk("[uuid server] pair complete conn_id:%02x, status:%x\r\n", - conn_id, status); - osal_printk("[uuid server] pair complete addr:%02x:**:**:**:%02x:%02x\r\n", - addr->addr[BT_INDEX_0], addr->addr[BT_INDEX_4], addr->addr[BT_INDEX_5]); -} - -static void sle_conn_register_cbks(void) -{ - sle_connection_callbacks_t conn_cbks = {0}; - conn_cbks.connect_state_changed_cb = sle_connect_state_changed_cbk; - conn_cbks.pair_complete_cb = sle_pair_complete_cbk; - sle_connection_register_callbacks(&conn_cbks); -} - -/* 初始化uuid server */ -errcode_t sle_uuid_server_init(void) -{ - enable_sle(); - sle_conn_register_cbks(); - sle_ssaps_register_cbks(); - sle_uuid_server_add(); - sle_uuid_server_adv_init(); - osal_printk("[uuid server] init ok\r\n"); - return ERRCODE_SLE_SUCCESS; -} - -#define SLE_UUID_SERVER_TASK_PRIO 26 -#define SLE_UUID_SERVER_STACK_SIZE 0x2000 - -static void sle_uuid_server_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle= osal_kthread_create((osal_kthread_handler)sle_uuid_server_init, 0, "sle_uuid_server", - SLE_UUID_SERVER_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SLE_UUID_SERVER_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the app entry. */ -app_run(sle_uuid_server_entry); \ No newline at end of file diff --git a/application/samples/peripheral/CMakeLists.txt b/application/samples/peripheral/CMakeLists.txt deleted file mode 100755 index 1fe94e5..0000000 --- a/application/samples/peripheral/CMakeLists.txt +++ /dev/null @@ -1,116 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_AMIC) - add_subdirectory_if_exist(amic) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BLINKY) - add_subdirectory_if_exist(blinky) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_BUTTON) - add_subdirectory_if_exist(button) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_TASKS) - add_subdirectory_if_exist(tasks) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_TCXO) - add_subdirectory_if_exist(tcxo) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_DMA) - add_subdirectory_if_exist(dma) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2C) - add_subdirectory_if_exist(i2c) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2S) - add_subdirectory_if_exist(i2s) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_KEYSCAN) - add_subdirectory_if_exist(keyscan) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_PDM) - add_subdirectory_if_exist(pdm) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_PDM_AMIC) - add_subdirectory_if_exist(pdm_amic) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_PINCTRL) - add_subdirectory_if_exist(pinctrl) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_QDEC) - add_subdirectory_if_exist(qdec) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SFC) - add_subdirectory_if_exist(sfc) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SPI) - add_subdirectory_if_exist(spi) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_SYSTICK) - add_subdirectory_if_exist(systick) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_WDT) - add_subdirectory_if_exist(watchdog) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_PWM) - add_subdirectory_if_exist(pwm) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_UART) - add_subdirectory_if_exist(uart) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_ADC) - add_subdirectory_if_exist(adc) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_RTC) - add_subdirectory_if_exist(rtc) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_TIMER) - add_subdirectory_if_exist(timer) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_EFLASH) - add_subdirectory_if_exist(eflash) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_CALENDAR) - add_subdirectory_if_exist(calendar) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2S_DMA) - add_subdirectory_if_exist(i2s_dma) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2S_DMA_LLI) - add_subdirectory_if_exist(i2s_dma_lli) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_CAN) - add_subdirectory_if_exist(can) -endif() - -if(DEFINED CONFIG_SAMPLE_SUPPORT_CLOCKS) - add_subdirectory_if_exist(clocks) -endif() -set(SOURCES "${SOURCES}" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/Kconfig b/application/samples/peripheral/Kconfig deleted file mode 100755 index 9e3783c..0000000 --- a/application/samples/peripheral/Kconfig +++ /dev/null @@ -1,406 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config ENABLE_ALL_PERIPHERAL_SAMPLE - bool - prompt "Enable all the sample of peripheral, it's just for build." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - select SAMPLE_SUPPORT_ADC - select SAMPLE_SUPPORT_AMIC if ADC_SUPPORT_AMIC - select SAMPLE_SUPPORT_BLINKY - select SAMPLE_SUPPORT_BUTTON - select SAMPLE_SUPPORT_CALENDAR - select SAMPLE_SUPPORT_CLOCKS - select SAMPLE_SUPPORT_DMA - select SAMPLE_SUPPORT_EFLASH - select SAMPLE_SUPPORT_I2C - select SAMPLE_SUPPORT_I2S - select SAMPLE_SUPPORT_I2S_DMA - select SAMPLE_SUPPORT_I2S_DMA_LLI - select SAMPLE_SUPPORT_KEYSCAN - select SAMPLE_SUPPORT_PDM - select SAMPLE_SUPPORT_PDM_AMIC if ADC_SUPPORT_AMIC - select SAMPLE_SUPPORT_PINCTRL - select SAMPLE_SUPPORT_PWM - select SAMPLE_SUPPORT_QDEC - select SAMPLE_SUPPORT_RTC - select SAMPLE_SUPPORT_SPI - select SAMPLE_SUPPORT_SYSTICK - select SAMPLE_SUPPORT_TASKS - select SAMPLE_SUPPORT_TCXO - select SAMPLE_SUPPORT_TIMER - select SAMPLE_SUPPORT_UART - select SAMPLE_SUPPORT_WDT - help - This option means enable all the sample of peripheral, it is just for build. - -config SAMPLE_SUPPORT_ADC - bool - prompt "Support ADC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support ADC Sample. - -if SAMPLE_SUPPORT_ADC -menu "ADC Sample Configuration" - osource "application/samples/peripheral/adc/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_AMIC - bool - prompt "Support AMIC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support AMIC Sample. - -if SAMPLE_SUPPORT_AMIC -menu "AFE Sample Configuration" - osource "application/samples/peripheral/amic/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_BLINKY - bool - prompt "Support BLINKY Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support BLINKY Sample. - -if SAMPLE_SUPPORT_BLINKY -menu "Blinky Sample Configuration" - osource "application/samples/peripheral/blinky/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_BUTTON - bool - prompt "Support BUTTON Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support BUTTON Sample. -if SAMPLE_SUPPORT_BUTTON -menu "BUTTON Sample Configuration" - osource "application/samples/peripheral/button/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_CALENDAR - bool - prompt "Support CALENDAR Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support CALENDAR Sample. - -if SAMPLE_SUPPORT_CALENDAR -menu "CALENDAR Sample Configuration" - osource "application/samples/peripheral/calendar/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_CAN - bool - prompt "Support CAN Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - select DRIVER_SUPPORT_CAN_FD - help - This option means support CAN Sample. - -if SAMPLE_SUPPORT_CAN -menu "CAN Sample Configuration" - osource "application/samples/peripheral/can/Kconfig" -endmenu -endif -config SAMPLE_SUPPORT_CLOCKS - bool - prompt "Support CLOCKS Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support CLOCKS Sample. - -if SAMPLE_SUPPORT_CLOCKS -menu "CLOCKS Sample Configuration" - osource "application/samples/peripheral/clocks/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_DMA - bool - prompt "Support DMA Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support DMA Sample. - -if SAMPLE_SUPPORT_DMA -menu "DMA Sample Configuration" - osource "application/samples/peripheral/dma/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_EFLASH - bool - prompt "Support EFLASH Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support EFLASH Sample. - -if SAMPLE_SUPPORT_EFLASH -menu "EFLASH Sample Configuration" - osource "application/samples/peripheral/eflash/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_I2C - bool - prompt "Support I2C Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support I2C Sample. - -if SAMPLE_SUPPORT_I2C -menu "I2C Sample Configuration" - osource "application/samples/peripheral/i2c/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_I2S - bool - prompt "Support I2S Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support I2S Sample. - -if SAMPLE_SUPPORT_I2S -menu "I2S Sample Configuration" - osource "application/samples/peripheral/i2s/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_I2S_DMA - bool - prompt "Support I2S DMA Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - select I2S_SUPPORT_DMA - help - This option means support I2S DMA Sample. - -if SAMPLE_SUPPORT_I2S_DMA -menu "I2S DMA Sample Configuration" - osource "application/samples/peripheral/i2s_dma/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_I2S_DMA_LLI - bool - prompt "Support I2S DMA lli Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - select I2S_SUPPORT_DMA - help - This option means support I2S DMA LLI Sample. - -if SAMPLE_SUPPORT_I2S_DMA_LLI -menu "I2S DMA lli Sample Configuration" - osource "application/samples/peripheral/i2s_dma_lli/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_KEYSCAN - bool - prompt "Support KEYSCAN Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support KEYSCAN Sample. - -config SAMPLE_SUPPORT_PDM - bool - prompt "Support PDM Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support PDM Sample. - -if SAMPLE_SUPPORT_PDM -menu "PDM Sample Configuration" - osource "application/samples/peripheral/pdm/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_PDM_AMIC - bool - prompt "Support PDM AMIC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE && ADC_SUPPORT_AMIC - help - This option means support PDM AMIC Sample. - -if SAMPLE_SUPPORT_PDM_AMIC -menu "PDM AMIC Sample Configuration" - osource "application/samples/peripheral/pdm_amic/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_PINCTRL - bool - prompt "Support PINCTRL Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support PINCTRL Sample. - -if SAMPLE_SUPPORT_PINCTRL -menu "PINCTRL Sample Configuration" - osource "application/samples/peripheral/pinctrl/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_PWM - bool - prompt "Support PWM Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support PWM Sample. - -if SAMPLE_SUPPORT_PWM -menu "PWM Sample Configuration" - osource "application/samples/peripheral/pwm/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_QDEC - bool - prompt "Support QDEC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support QDEC Sample. - -if SAMPLE_SUPPORT_QDEC -menu "QDEC Sample Configuration" - osource "application/samples/peripheral/qdec/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_RTC - bool - prompt "Support RTC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support RTC Sample. - -if SAMPLE_SUPPORT_RTC -menu "RTC Sample Configuration" - osource "application/samples/peripheral/rtc/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_SFC - bool - prompt "Support SFC Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support SFC Sample. - -if SAMPLE_SUPPORT_SFC -menu "SFC Sample Configuration" - osource "application/samples/peripheral/sfc/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_SPI - bool - prompt "Support SPI Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support SPI Sample. - -if SAMPLE_SUPPORT_SPI -menu "SPI Sample Configuration" - osource "application/samples/peripheral/spi/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_SYSTICK - bool - prompt "Support SYSTICK Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support SYSTICK Sample. - -config SAMPLE_SUPPORT_TASKS - bool - prompt "Support TASKS Test Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support TASKS Test Sample. - -config SAMPLE_SUPPORT_TCXO - bool - prompt "Support TCXO Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support TCXO Sample. - -config SAMPLE_SUPPORT_TIMER - bool - prompt "Support TIMER Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support TIMER Sample. - -if SAMPLE_SUPPORT_TIMER -menu "TIMER Sample Configuration" - osource "application/samples/peripheral/timer/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_UART - bool - prompt "Support UART Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support UART Sample. - -if SAMPLE_SUPPORT_UART -menu "UART Sample Configuration" - osource "application/samples/peripheral/uart/Kconfig" -endmenu -endif - -config SAMPLE_SUPPORT_WDT - bool - prompt "Support WATCHDOG Sample." - default n - depends on ENABLE_PERIPHERAL_SAMPLE - help - This option means support WATCHDOG Sample. - -if SAMPLE_SUPPORT_WDT -menu "WATCHDOG Sample Configuration" - osource "application/samples/peripheral/watchdog/Kconfig" -endmenu -endif \ No newline at end of file diff --git a/application/samples/peripheral/adc/CMakeLists.txt b/application/samples/peripheral/adc/CMakeLists.txt deleted file mode 100755 index 32cc74e..0000000 --- a/application/samples/peripheral/adc/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== - -if((DEFINED CONFIG_ADC_USING_V154) OR (DEFINED CONFIG_ADC_USING_V155)) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/adc_demo_inc.c" PARENT_SCOPE) -else() - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/adc_demo.c" PARENT_SCOPE) -endif() \ No newline at end of file diff --git a/application/samples/peripheral/adc/Kconfig b/application/samples/peripheral/adc/Kconfig deleted file mode 100755 index c1a8b86..0000000 --- a/application/samples/peripheral/adc/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config HADC_SELF_CALIBRATION - bool - prompt "HADC calibration, or use record code." - default y - depends on ADC_USING_V152 - -config HADC_SAMPLE - bool - prompt "Enable HADC sample." - default y - depends on ADC_USING_V152 - -config TIMING_SAMPLE - bool - prompt "Create timing sample irq." - default n - -config ADC_CHANNEL - int - prompt "Choose ADC channel." - default 5 \ No newline at end of file diff --git a/application/samples/peripheral/adc/adc.code-workspace b/application/samples/peripheral/adc/adc.code-workspace deleted file mode 100755 index 96487ab..0000000 --- a/application/samples/peripheral/adc/adc.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/adc" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/adc/adc_demo_inc.c b/application/samples/peripheral/adc/adc_demo_inc.c deleted file mode 100755 index f727555..0000000 --- a/application/samples/peripheral/adc/adc_demo_inc.c +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: ADC Sample Source. \n - * - * History: \n - * 2023-07-06, Create file. \n - */ -#include "pinctrl.h" -#include "adc.h" -#include "adc_porting.h" -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" -#include "tcxo.h" - -#define DELAY_10000MS 10000 -#define CYCLES 10 -#define ADC_TASK_PRIO 26 -#define ADC_TASK_STACK_SIZE 0x1000 - -static void *adc_task(const char *arg) -{ - unused(arg); - osal_printk("start adc sample\r\n"); - uapi_adc_init(ADC_CLOCK_NONE); - uint8_t adc_channel = CONFIG_ADC_CHANNEL; - uint16_t voltage = 0; - uint32_t cnt = 0; - while (cnt++ < CYCLES) { - adc_port_read(adc_channel, &voltage); - osal_printk("voltage: %d mv\r\n", voltage); - osal_msleep(DELAY_10000MS); - } - /* 当前测量的电压值和实际值可能有较大差别,请确认是否有分压电阻,如果有分压电阻,则差别符合预期 */ - uapi_adc_deinit(); - - return NULL; -} - -static void adc_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)adc_task, 0, "AdcTask", ADC_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, ADC_TASK_PRIO); - } - osal_kthread_unlock(); -} - -/* Run the adc_entry. */ -app_run(adc_entry); \ No newline at end of file diff --git a/application/samples/peripheral/blinky/CMakeLists.txt b/application/samples/peripheral/blinky/CMakeLists.txt deleted file mode 100755 index 8218eb2..0000000 --- a/application/samples/peripheral/blinky/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/blinky_demo.c" PARENT_SCOPE) diff --git a/application/samples/peripheral/blinky/Kconfig b/application/samples/peripheral/blinky/Kconfig deleted file mode 100755 index 672168d..0000000 --- a/application/samples/peripheral/blinky/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. -#=============================================================================== -config BLINKY_PIN - int - prompt "Choose blinky pin." - default 2 \ No newline at end of file diff --git a/application/samples/peripheral/blinky/blinky.code-workspace b/application/samples/peripheral/blinky/blinky.code-workspace deleted file mode 100755 index e4da5ec..0000000 --- a/application/samples/peripheral/blinky/blinky.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/blinky" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/blinky/blinky_demo.c b/application/samples/peripheral/blinky/blinky_demo.c deleted file mode 100755 index 0d68cf0..0000000 --- a/application/samples/peripheral/blinky/blinky_demo.c +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: Blinky Sample Source. \n - * - * History: \n - * 2023-04-03, Create file. \n - */ - -#include "pinctrl.h" -#include "gpio.h" -#include "soc_osal.h" -#include "app_init.h" - -#define BLINKY_DURATION_MS 500 - -#define BLINKY_TASK_PRIO 24 -#define BLINKY_TASK_STACK_SIZE 0x1000 - -static int blinky_task(const char *arg) -{ - unused(arg); - - uapi_pin_set_mode(CONFIG_BLINKY_PIN, HAL_PIO_FUNC_GPIO); - - uapi_gpio_set_dir(CONFIG_BLINKY_PIN, GPIO_DIRECTION_OUTPUT); - uapi_gpio_set_val(CONFIG_BLINKY_PIN, GPIO_LEVEL_LOW); - - while (1) { - osal_msleep(BLINKY_DURATION_MS); - uapi_gpio_toggle(CONFIG_BLINKY_PIN); - osal_printk("Blinky working.\r\n"); - } - - return 0; -} - -static void blinky_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)blinky_task, 0, "BlinkyTask", BLINKY_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, BLINKY_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the blinky_entry. */ -app_run(blinky_entry); \ No newline at end of file diff --git a/application/samples/peripheral/dma/CMakeLists.txt b/application/samples/peripheral/dma/CMakeLists.txt deleted file mode 100755 index 867d0ed..0000000 --- a/application/samples/peripheral/dma/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/dma_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/dma/Kconfig b/application/samples/peripheral/dma/Kconfig deleted file mode 100755 index 41ed48b..0000000 --- a/application/samples/peripheral/dma/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config DMA_MEMORY_LLI_TRANSFER_MODE - bool - prompt "Choose DMA memory to memory lli transfer mode." - depends on SAMPLE_SUPPORT_DMA - default n \ No newline at end of file diff --git a/application/samples/peripheral/dma/dma.code-workspace b/application/samples/peripheral/dma/dma.code-workspace deleted file mode 100755 index b835c68..0000000 --- a/application/samples/peripheral/dma/dma.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/dma" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/dma/dma_demo.c b/application/samples/peripheral/dma/dma_demo.c deleted file mode 100755 index 061728b..0000000 --- a/application/samples/peripheral/dma/dma_demo.c +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: DMA Sample Source. \n - * - * History: \n - * 2023-07-06, Create file. \n - */ -#include "hal_dma.h" -#include "soc_osal.h" -#include "securec.h" -#include "app_init.h" - -#define DMA_TRANSFER_WORD_NUM 32 -#define DMA_TRANSFER_PRIORITY 0 -#define DMA_TRANSFER_WIDTH 2 -#define DMA_TASK_DURATION_MS 500 - -#define DMA_TASK_PRIO 24 -#define DMA_TASK_STACK_SIZE 0x1000 - -static uint32_t g_app_dma_src_data[DMA_TRANSFER_WORD_NUM] = { 0 }; -static uint32_t g_app_dma_desc_data[DMA_TRANSFER_WORD_NUM] = { 0 }; -static uint8_t g_dma_trans_done = 0; - -static void app_dma_trans_done_callback(uint8_t int_type, uint8_t channel, uintptr_t arg) -{ - unused(arg); - unused(channel); - switch (int_type) { - case HAL_DMA_INTERRUPT_TFR: - g_dma_trans_done = 1; - break; - case HAL_DMA_INTERRUPT_BLOCK: - g_dma_trans_done = 1; - break; - case HAL_DMA_INTERRUPT_ERR: - osal_printk("DMA transfer error.\r\n"); - break; - default: - break; - } -} - -static void *dma_task(const char *arg) -{ - unused(arg); - /* DMA init. */ - uapi_dma_init(); - uapi_dma_open(); - -#if defined(CONFIG_DMA_MEMORY_LLI_TRANSFER_MODE) - dma_channel_t dma_channel = DMA_CHANNEL_NONE; - dma_channel = uapi_dma_get_lli_channel(0, HAL_DMA_HANDSHAKING_MAX_NUM); -#endif - - for (uint32_t i = 0; i < DMA_TRANSFER_WORD_NUM; i++) { - g_app_dma_src_data[i] = i; - } - memset_s(g_app_dma_desc_data, DMA_TRANSFER_WORD_NUM, 0, DMA_TRANSFER_WORD_NUM); - - dma_ch_user_memory_config_t transfer_config = { 0 }; - transfer_config.src = (uint32_t)(uintptr_t)g_app_dma_src_data; - transfer_config.dest = (uint32_t)(uintptr_t)g_app_dma_desc_data; - transfer_config.transfer_num = DMA_TRANSFER_WORD_NUM; - transfer_config.priority = DMA_TRANSFER_PRIORITY; - transfer_config.width = DMA_TRANSFER_WIDTH; - - while (1) { - osal_msleep(DMA_TASK_DURATION_MS); - g_dma_trans_done = 0; -#if defined(CONFIG_DMA_MEMORY_LLI_TRANSFER_MODE) - osal_printk("dma config link list item of memory to memory start!\r\n"); - if (uapi_dma_transfer_memory_lli(dma_channel, &transfer_config, app_dma_trans_done_callback) == ERRCODE_SUCC) { - osal_printk("dma config link list item of memory to memory succ!\r\n"); - } - osal_printk("dma enable lli memory transfer start!\r\n"); - if (uapi_dma_enable_lli(dma_channel, app_dma_trans_done_callback, (uintptr_t)NULL) == ERRCODE_SUCC) { - osal_printk("dma enable lli memory transfer succ!\r\n"); - } - while (!g_dma_trans_done) {} - if (uapi_dma_end_transfer(dma_channel) == ERRCODE_SUCC) { - osal_printk("dma channel transfer finish!\r\n"); - } -#else - osal_printk("dma single memory transfer start!\r\n"); - if (uapi_dma_transfer_memory_single(&transfer_config, app_dma_trans_done_callback, - (uintptr_t)NULL) == ERRCODE_SUCC) { - osal_printk("dma single memory transfer succ!\r\n"); - } - while (!g_dma_trans_done) {} - osal_printk("dma checking transfer from 0x%08x to 0x%08x...\r\n", transfer_config.src, transfer_config.dest); - if (memcmp((void *)transfer_config.src, (void *)transfer_config.dest, transfer_config.transfer_num) == 0) { - osal_printk("dma memory copy test succ, length = %d block\r\n", transfer_config.transfer_num); - } -#endif - } - - return NULL; -} - -static void dma_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)dma_task, 0, "DmaTask", DMA_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, DMA_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the dma_entry. */ -app_run(dma_entry); \ No newline at end of file diff --git a/application/samples/peripheral/i2c/CMakeLists.txt b/application/samples/peripheral/i2c/CMakeLists.txt deleted file mode 100755 index ddc695f..0000000 --- a/application/samples/peripheral/i2c/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2C_MASTER) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/i2c_master_demo.c" PARENT_SCOPE) -elseif(DEFINED CONFIG_SAMPLE_SUPPORT_I2C_SLAVE) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/i2c_slave_demo.c" PARENT_SCOPE) -endif() \ No newline at end of file diff --git a/application/samples/peripheral/i2c/Kconfig b/application/samples/peripheral/i2c/Kconfig deleted file mode 100755 index 3b29215..0000000 --- a/application/samples/peripheral/i2c/Kconfig +++ /dev/null @@ -1,79 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config SAMPLE_SUPPORT_I2C_MASTER - bool - prompt "Support I2C Master Sample." - default n - depends on SAMPLE_SUPPORT_I2C - help - This option means support I2C Master Sample. - -config I2C_MASTER_BUS_ID - int - prompt "Choose I2C master bus id." - depends on SAMPLE_SUPPORT_I2C_MASTER - default 2 - -config I2C_SCL_MASTER_PIN - int - prompt "Choose I2C SCL master pin." - depends on SAMPLE_SUPPORT_I2C_MASTER - default 8 - -config I2C_SDA_MASTER_PIN - int - prompt "Choose I2C SDA master pin." - depends on SAMPLE_SUPPORT_I2C_MASTER - default 9 - -config I2C_MASTER_PIN_MODE - int - prompt "Choose I2C master pin mode." - depends on SAMPLE_SUPPORT_I2C_MASTER - default 3 - -config I2C_SLAVE_ADDR - hex - prompt "Choose I2C slave addr." - depends on SAMPLE_SUPPORT_I2C_MASTER - default 0x49 - -config SAMPLE_SUPPORT_I2C_SLAVE - bool - prompt "Support I2C Slave Sample." - default n - depends on SAMPLE_SUPPORT_I2C - help - This option means support I2C Slave Sample. - -config I2C_SLAVE_BUS_ID - int - prompt "Choose I2C slave bus id." - depends on SAMPLE_SUPPORT_I2C_SLAVE - default 2 - -config I2C_SCL_SLAVE_PIN - int - prompt "Choose I2C SCL slave pin." - depends on SAMPLE_SUPPORT_I2C_SLAVE - default 8 - -config I2C_SDA_SLAVE_PIN - int - prompt "Choose I2C SDA slave pin." - depends on SAMPLE_SUPPORT_I2C_SLAVE - default 9 - -config I2C_SLAVE_PIN_MODE - int - prompt "Choose I2C slave pin mode." - depends on SAMPLE_SUPPORT_I2C_SLAVE - default 3 - -config I2C_TRANSFER_LEN - int - prompt "Choose I2C transfer length." - depends on SAMPLE_SUPPORT_I2C - default 8 \ No newline at end of file diff --git a/application/samples/peripheral/i2c/i2c.code-workspace b/application/samples/peripheral/i2c/i2c.code-workspace deleted file mode 100755 index d515610..0000000 --- a/application/samples/peripheral/i2c/i2c.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/i2c" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/i2c/i2c_master_demo.c b/application/samples/peripheral/i2c/i2c_master_demo.c deleted file mode 100755 index 70a349b..0000000 --- a/application/samples/peripheral/i2c/i2c_master_demo.c +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: I2C Sample Source. \n - * - * History: \n - * 2023-05-25, Create file. \n - */ -#include "pinctrl.h" -#include "i2c.h" -#include "soc_osal.h" -#include "app_init.h" -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) -#include "dma.h" -#endif - -#define I2C_MASTER_ADDR 0x0 -#define I2C_SET_BAUDRATE 400000 -#define I2C_TASK_DURATION_MS 500 -#if defined(CONFIG_I2C_SUPPORT_INT) && (CONFIG_I2C_SUPPORT_INT == 1) -#define I2C_INT_TRANSFER_DELAY_MS 800 -#endif - -#define I2C_TASK_PRIO 24 -#define I2C_TASK_STACK_SIZE 0x1000 - -static void app_i2c_init_pin(void) -{ - /* I2C pinmux. */ - uapi_pin_set_mode(CONFIG_I2C_SCL_MASTER_PIN, CONFIG_I2C_MASTER_PIN_MODE); - uapi_pin_set_mode(CONFIG_I2C_SDA_MASTER_PIN, CONFIG_I2C_MASTER_PIN_MODE); -} - -static void *i2c_master_task(const char *arg) -{ - unused(arg); - i2c_data_t data = { 0 }; - - uint32_t baudrate = I2C_SET_BAUDRATE; - uint8_t hscode = I2C_MASTER_ADDR; - uint16_t dev_addr = CONFIG_I2C_SLAVE_ADDR; - -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) - uapi_dma_init(); - uapi_dma_open(); -#endif /* CONFIG_I2C_SUPPORT_DMA */ - - /* I2C master init config. */ - app_i2c_init_pin(); - uapi_i2c_master_init(CONFIG_I2C_MASTER_BUS_ID, baudrate, hscode); - -#if defined(CONFIG_I2C_SUPPORT_INT) && (CONFIG_I2C_SUPPORT_INT == 1) - uapi_i2c_set_irq_mode(CONFIG_I2C_MASTER_BUS_ID, 1); -#endif /* CONFIG_I2C_SUPPORT_INT */ - - /* I2C data config. */ - uint8_t tx_buff[CONFIG_I2C_TRANSFER_LEN] = { 0 }; - for (uint32_t loop = 0; loop < CONFIG_I2C_TRANSFER_LEN; loop++) { - tx_buff[loop] = (loop & 0xFF); - } - - uint8_t rx_buff[CONFIG_I2C_TRANSFER_LEN] = { 0 }; - data.send_buf = tx_buff; - data.send_len = CONFIG_I2C_TRANSFER_LEN; - data.receive_buf = rx_buff; - data.receive_len = CONFIG_I2C_TRANSFER_LEN; - - while (1) { - osal_msleep(I2C_TASK_DURATION_MS); - osal_printk("i2c%d master send start!\r\n", CONFIG_I2C_MASTER_BUS_ID); - if (uapi_i2c_master_write(CONFIG_I2C_MASTER_BUS_ID, dev_addr, &data) == ERRCODE_SUCC) { - osal_printk("i2c%d master send succ!\r\n", CONFIG_I2C_MASTER_BUS_ID); - } else { - continue; - } -#if defined(CONFIG_I2C_SUPPORT_INT) && (CONFIG_I2C_SUPPORT_INT == 1) - osal_msleep(I2C_INT_TRANSFER_DELAY_MS); -#endif - osal_printk("i2c%d master receive start!\r\n", CONFIG_I2C_MASTER_BUS_ID); - if (uapi_i2c_master_read(CONFIG_I2C_MASTER_BUS_ID, dev_addr, &data) == ERRCODE_SUCC) { - for (uint32_t i = 0; i < data.receive_len; i++) { - osal_printk("i2c%d master receive data is %x\r\n", CONFIG_I2C_MASTER_BUS_ID, data.receive_buf[i]); - } - osal_printk("i2c%d master receive succ!\r\n", CONFIG_I2C_MASTER_BUS_ID); - } - } - - return NULL; -} - -static void i2c_master_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)i2c_master_task, 0, "I2cMasterTask", I2C_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, I2C_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the i2c_master_entry. */ -app_run(i2c_master_entry); \ No newline at end of file diff --git a/application/samples/peripheral/i2c/i2c_slave_demo.c b/application/samples/peripheral/i2c/i2c_slave_demo.c deleted file mode 100755 index edb8510..0000000 --- a/application/samples/peripheral/i2c/i2c_slave_demo.c +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: I2C Sample Source. \n - * - * History: \n - * 2023-05-25, Create file. \n - */ -#include "pinctrl.h" -#include "i2c.h" -#include "soc_osal.h" -#include "app_init.h" -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) -#include "dma.h" -#endif - -#define I2C_SLAVE_ADDR 0x8 -#define I2C_SET_BAUDRATE 500000 -#define I2C_TASK_DURATION_MS 100 -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) -#define I2C_DMA_TRANSFER_DELAY_MS 500 -#endif - -#define I2C_TASK_PRIO 24 -#define I2C_TASK_STACK_SIZE 0x1000 - -static void app_i2c_init_pin(void) -{ - /* I2C pinmux. */ - uapi_pin_set_mode(CONFIG_I2C_SCL_SLAVE_PIN, CONFIG_I2C_SLAVE_PIN_MODE); - uapi_pin_set_mode(CONFIG_I2C_SDA_SLAVE_PIN, CONFIG_I2C_SLAVE_PIN_MODE); -} - -void *i2c_slave_task(const char *arg) -{ - unused(arg); - i2c_data_t data = { 0 }; - - uint32_t baudrate = I2C_SET_BAUDRATE; - uint16_t dev_addr = I2C_SLAVE_ADDR; - -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) - uapi_dma_init(); - uapi_dma_open(); -#endif /* CONFIG_I2C_SUPPORT_DMA */ - - /* I2C slave init config. */ - app_i2c_init_pin(); - uapi_i2c_slave_init(CONFIG_I2C_SLAVE_BUS_ID, baudrate, dev_addr); - -#if defined(CONFIG_I2C_SUPPORT_INT) && (CONFIG_I2C_SUPPORT_INT == 1) - uapi_i2c_set_irq_mode(CONFIG_I2C_SLAVE_BUS_ID, 1); -#endif /* CONFIG_I2C_SUPPORT_INT */ - - /* I2C data config. */ - uint8_t tx_buff[CONFIG_I2C_TRANSFER_LEN] = { 0 }; - for (uint32_t loop = 0; loop < CONFIG_I2C_TRANSFER_LEN; loop++) { - tx_buff[loop] = (loop & 0xFF); - } - - uint8_t rx_buff[CONFIG_I2C_TRANSFER_LEN] = { 0 }; - data.send_buf = tx_buff; - data.send_len = CONFIG_I2C_TRANSFER_LEN; - data.receive_buf = rx_buff; - data.receive_len = CONFIG_I2C_TRANSFER_LEN; - - while (1) { - osal_msleep(I2C_TASK_DURATION_MS); - osal_printk("i2c%d slave receive start!\r\n", CONFIG_I2C_SLAVE_BUS_ID); - if (uapi_i2c_slave_read(CONFIG_I2C_SLAVE_BUS_ID, &data) == ERRCODE_SUCC) { - for (uint32_t i = 0; i < data.receive_len; i++) { - osal_printk("i2c slave receive data is %x\r\n", data.receive_buf[i]); - } - osal_printk("i2c%d slave receive succ!\r\n", CONFIG_I2C_SLAVE_BUS_ID); - } - osal_printk("i2c%d slave send start!\r\n", CONFIG_I2C_SLAVE_BUS_ID); -#if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) - osal_msleep(I2C_DMA_TRANSFER_DELAY_MS); -#endif - if (uapi_i2c_slave_write(CONFIG_I2C_SLAVE_BUS_ID, &data) == ERRCODE_SUCC) { - osal_printk("i2c%d slave send succ!\r\n", CONFIG_I2C_SLAVE_BUS_ID); - } - } - - return NULL; -} - -static void i2c_slave_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)i2c_slave_task, 0, "I2cSlaveTask", I2C_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, I2C_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the i2c_slave_entry. */ -app_run(i2c_slave_entry); \ No newline at end of file diff --git a/application/samples/peripheral/i2s_dma_lli/CMakeLists.txt b/application/samples/peripheral/i2s_dma_lli/CMakeLists.txt deleted file mode 100755 index a69b02c..0000000 --- a/application/samples/peripheral/i2s_dma_lli/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_I2S_DMA_LLI_MASTER) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/i2s_dma_lli_master_demo.c" PARENT_SCOPE) -elseif(DEFINED CONFIG_SAMPLE_SUPPORT_I2S_DMA_LLI_SLAVE) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/i2s_dma_lli_slave_demo.c" PARENT_SCOPE) -endif() \ No newline at end of file diff --git a/application/samples/peripheral/i2s_dma_lli/Kconfig b/application/samples/peripheral/i2s_dma_lli/Kconfig deleted file mode 100755 index eb462e6..0000000 --- a/application/samples/peripheral/i2s_dma_lli/Kconfig +++ /dev/null @@ -1,26 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config SAMPLE_SUPPORT_I2S_DMA_LLI_MASTER - bool - prompt "Support I2S Master Sample." - default n - depends on SAMPLE_SUPPORT_I2S_DMA_LLI - help - This option means support I2S Master Sample. - -config SAMPLE_SUPPORT_I2S_DMA_LLI_SLAVE - bool - prompt "Support I2S Slave Sample." - default n - depends on SAMPLE_SUPPORT_I2S_DMA_LLI - help - This option means support I2S Slave Sample. - -config I2S_TRANSFER_LEN_OF_DMA_LLI - int - prompt "Set the length of transfer by DMA." - default 128 - help - This option means the length of transfer by DMA. \ No newline at end of file diff --git a/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_master_demo.c b/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_master_demo.c deleted file mode 100755 index 2b47721..0000000 --- a/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_master_demo.c +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: i2s dma master lli Sample Source. \n - * - * History: \n - * 2024-04-26, Create file. \n - */ -#include "i2s.h" -#include "watchdog.h" -#include "hal_sio.h" -#include "hal_dma.h" -#include "soc_osal.h" -#include "app_init.h" - -#define I2S_DIV_NUMBER 32 -#define I2S_CHANNEL_NUMBER 2 -#define I2S_TX_INT_THRESHOLD 7 -#define I2S_RX_INT_THRESHOLD 1 -#define I2S_DMA_SRC_WIDTH 2 -#define I2S_DMA_DEST_WIDTH 2 -#define I2S_DMA_BURST_LENGTH 0 -#define I2S_DMA_TRANS_STEP 2 - -#define I2S_TASK_PRIO 24 -#define I2S_TASK_STACK_SIZE 0xc00 - -static uint32_t g_i2s_first_data = 0x10000000; /* 32 bits */ -static uint32_t g_i2s_send_dma_data[CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI] = { 0 }; - -static void i2s_dma_master_init(void) -{ - uapi_i2s_deinit(SIO_BUS_0); - uapi_i2s_init(SIO_BUS_0, NULL); - sio_porting_i2s_pinmux(); - i2s_config_t config = { - .drive_mode = MASTER, - .transfer_mode = STD_MODE, - .data_width = THIRTY_TWO_BIT, - .channels_num = TWO_CH, - .timing = NONE_TIMING_MODE, - .clk_edge = RISING_EDGE, - .div_number = I2S_DIV_NUMBER, - .number_of_channels = I2S_CHANNEL_NUMBER, - }; - i2s_dma_attr_t attr = { - .tx_dma_enable = 1, - .tx_int_threshold = I2S_TX_INT_THRESHOLD, - .rx_dma_enable = 0, - .rx_int_threshold = I2S_RX_INT_THRESHOLD, - }; - uapi_i2s_set_config(SIO_BUS_0, &config); - uapi_i2s_dma_config(SIO_BUS_0, &attr); -} - -static void *i2s_dma_master_task(const char *arg) -{ - unused(arg); - int32_t ret = CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI; -#if defined(CONFIG_SIO_USING_V151) - ret = ERRCODE_SUCC; -#endif - uapi_dma_deinit(); - i2s_dma_master_init(); - for (uint32_t i = 0; i < CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI; i += I2S_DMA_TRANS_STEP) { - g_i2s_send_dma_data[i] = g_i2s_first_data; - g_i2s_send_dma_data[i + 1] = g_i2s_first_data; - g_i2s_first_data++; - } - /* DMA init. */ - uapi_dma_init(); - uapi_dma_open(); - i2s_dma_config_t dma_cfg = { - .src_width = I2S_DMA_SRC_WIDTH, - .dest_width = I2S_DMA_DEST_WIDTH, - .burst_length = I2S_DMA_BURST_LENGTH, - .priority = 0, - }; - osal_printk("DMA master transfer start.\r\n"); - while (1) { - uapi_watchdog_kick(); - if (uapi_i2s_merge_write_by_dma(SIO_BUS_0, &g_i2s_send_dma_data, CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI, &dma_cfg, - (uintptr_t)NULL, true) != ret) { - osal_printk("master uapi_i2s_merge_write_by_dma error.\r\n"); - } - } - return NULL; -} - -static void i2s_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)i2s_dma_master_task, 0, "I2sDmaMasterTask", - I2S_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, I2S_TASK_PRIO); - } - osal_kthread_unlock(); -} - -/* Run the i2s_entry. */ -app_run(i2s_entry); \ No newline at end of file diff --git a/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_slave_demo.c b/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_slave_demo.c deleted file mode 100755 index bb8d0f9..0000000 --- a/application/samples/peripheral/i2s_dma_lli/i2s_dma_lli_slave_demo.c +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: i2s dma slave lli Sample Source. \n - * - * History: \n - * 2024-04-26, Create file. \n - */ -#include "i2s.h" -#include "watchdog.h" -#include "hal_sio.h" -#include "hal_dma.h" -#include "soc_osal.h" -#include "app_init.h" - -#define I2S_DIV_NUMBER 32 -#define I2S_CHANNEL_NUMBER 2 -#define I2S_TX_INT_THRESHOLD 7 -#define I2S_RX_INT_THRESHOLD 1 -#define I2S_DMA_TRANSFER_EVENT 1 -#define I2S_RING_BUFFER_NUMBER 4 -#define I2S_DMA_DATA_CMP_MIDDLE 9 -#define I2S_DMA_DATA_CMP_END (CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI - 1) -#define I2S_DMA_TRANS_STEP 2 - -#define I2S_TASK_PRIO 24 -#define I2S_TASK_STACK_SIZE 0xc00 - -static uint32_t g_i2s_dma_data0[CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI] = { 0 }; -static uint32_t g_i2s_dma_data1[CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI] = { 0 }; -static uint32_t g_i2s_dma_data2[CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI] = { 0 }; -static uint32_t g_i2s_dma_data3[CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI] = { 0 }; -static uint32_t *g_i2s_dma_data[I2S_RING_BUFFER_NUMBER] = { - g_i2s_dma_data0, g_i2s_dma_data1, g_i2s_dma_data2, g_i2s_dma_data3}; -static osal_event g_i2s_dma_id; -static uint8_t g_transfer_err_flag = 0; -static uint32_t g_cb_count = 0; - -static int32_t i2s_add_dma_lli_node(uint8_t index, dma_channel_t dma_channel, dma_transfer_cb_t trans_done) -{ - dma_ch_user_peripheral_config_t transfer_config; - - transfer_config.src = i2s_porting_rx_merge_data_addr_get(SIO_BUS_0); - transfer_config.dest = (uint32_t)(uintptr_t)g_i2s_dma_data[index]; - transfer_config.transfer_num = (uint16_t)CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI; - transfer_config.src_handshaking = HAL_DMA_HANDSHAKING_I2S_RX; - transfer_config.dest_handshaking = 0; - transfer_config.trans_type = HAL_DMA_TRANS_PERIPHERAL_TO_MEMORY_DMA; - transfer_config.trans_dir = HAL_DMA_TRANSFER_DIR_PERIPHERAL_TO_MEM; - transfer_config.priority = 0; - transfer_config.src_width = HAL_DMA_TRANSFER_WIDTH_32; - transfer_config.dest_width = HAL_DMA_TRANSFER_WIDTH_32; - transfer_config.burst_length = 0; - transfer_config.src_increment = HAL_DMA_ADDRESS_INC_NO_CHANGE; - transfer_config.dest_increment = HAL_DMA_ADDRESS_INC_INCREMENT; - transfer_config.protection = HAL_DMA_PROTECTION_CONTROL_BUFFERABLE; - - errcode_t ret = uapi_dma_configure_peripheral_transfer_lli(dma_channel, &transfer_config, trans_done); - if (ret != ERRCODE_SUCC) { - osal_printk("%s Configure the DMA fail. %x\r\n", "i2s dma lli", ret); - return 1; - } - return 0; -} - -void app_printf_err(void) -{ - if (g_cb_count >= I2S_RING_BUFFER_NUMBER && g_transfer_err_flag) { - g_transfer_err_flag = 0; - // receive ok - if ((g_i2s_dma_data0[0] == g_i2s_dma_data1[0]) && (g_i2s_dma_data1[0] == g_i2s_dma_data2[0]) && - (g_i2s_dma_data2[0] == g_i2s_dma_data3[0]) && - (g_i2s_dma_data0[I2S_DMA_DATA_CMP_MIDDLE] == g_i2s_dma_data1[I2S_DMA_DATA_CMP_MIDDLE]) && - (g_i2s_dma_data1[I2S_DMA_DATA_CMP_MIDDLE] == g_i2s_dma_data2[I2S_DMA_DATA_CMP_MIDDLE]) && - (g_i2s_dma_data2[I2S_DMA_DATA_CMP_MIDDLE] == g_i2s_dma_data3[I2S_DMA_DATA_CMP_MIDDLE]) && - (g_i2s_dma_data0[I2S_DMA_DATA_CMP_END] == g_i2s_dma_data1[I2S_DMA_DATA_CMP_END]) && - (g_i2s_dma_data1[I2S_DMA_DATA_CMP_END] == g_i2s_dma_data2[I2S_DMA_DATA_CMP_END]) && - (g_i2s_dma_data2[I2S_DMA_DATA_CMP_END] == g_i2s_dma_data3[I2S_DMA_DATA_CMP_END])) { - osal_printk("recv OK\r\n"); - return; - } - // receive error - for (uint32_t j = 0; j < I2S_RING_BUFFER_NUMBER; j++) { - for (uint32_t i = 0; i < CONFIG_I2S_TRANSFER_LEN_OF_DMA_LLI; i += I2S_DMA_TRANS_STEP) { - osal_printk("%d, %d ~ %x\r\n", j, i, g_i2s_dma_data[j][i]); - } - } - } -} - -static void i2s_dma_trans_done_callback(uint8_t intr, uint8_t channel, uintptr_t arg) -{ - unused(channel); - unused(arg); - switch (intr) { - case HAL_DMA_INTERRUPT_TFR: - g_cb_count++; - if (g_cb_count >= I2S_RING_BUFFER_NUMBER) { - g_transfer_err_flag = 1; - } - if (osal_event_write(&g_i2s_dma_id, I2S_DMA_TRANSFER_EVENT) != OSAL_SUCCESS) { - osal_printk("osal_event_write fail!\r\n"); - return; - } - break; - case HAL_DMA_INTERRUPT_ERR: - osal_printk("i2s DMA transfer error.\r\n"); - break; - default: - break; - } -} - -static void *i2s_dma_slave_task(const char *arg) -{ - unused(arg); - if (osal_event_init(&g_i2s_dma_id) != OSAL_SUCCESS) { - return NULL; - } - uapi_dma_deinit(); - uapi_i2s_deinit(SIO_BUS_0); - uapi_i2s_init(SIO_BUS_0, NULL); - sio_porting_i2s_pinmux(); - i2s_config_t config = { - .drive_mode= SLAVE, - .transfer_mode = STD_MODE, - .data_width = THIRTY_TWO_BIT, - .channels_num = TWO_CH, - .timing = NONE_TIMING_MODE, - .clk_edge = RISING_EDGE, - .div_number = I2S_DIV_NUMBER, - .number_of_channels = I2S_CHANNEL_NUMBER, - }; - i2s_dma_attr_t attr = { - .tx_dma_enable = 0, - .tx_int_threshold = I2S_TX_INT_THRESHOLD, - .rx_dma_enable = 1, - .rx_int_threshold = I2S_RX_INT_THRESHOLD, - }; - - uapi_i2s_set_config(SIO_BUS_0, &config); - uapi_i2s_dma_config(SIO_BUS_0, &attr); - - /* DMA init. */ - uapi_dma_init(); - uapi_dma_open(); - - dma_channel_t dma_channel = uapi_dma_get_lli_channel(0, HAL_DMA_HANDSHAKING_MAX_NUM); - for (uint8_t i = 0; i < I2S_RING_BUFFER_NUMBER; i++) { - if (i2s_add_dma_lli_node(i, dma_channel, i2s_dma_trans_done_callback) != 0) { - osal_printk("i2s_add_dma_lli_node fail!\r\n"); - return NULL; - } - } - - if (uapi_dma_enable_lli(dma_channel, i2s_dma_trans_done_callback, (uintptr_t)NULL) == ERRCODE_SUCC) { - osal_printk("dma enable lli memory transfer succ!\r\n"); - } - hal_sio_set_rx_enable(SIO_BUS_0, 1); - - while (1) { - uapi_watchdog_kick(); - if (!(osal_event_read(&g_i2s_dma_id, I2S_DMA_TRANSFER_EVENT, OSAL_WAIT_FOREVER, - OSAL_WAITMODE_AND | OSAL_WAITMODE_CLR))) { - continue; - } - app_printf_err(); - } - return NULL; -} - -static void i2s_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)i2s_dma_slave_task, 0, "I2sDmaSlaveTask", - I2S_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, I2S_TASK_PRIO); - } - osal_kthread_unlock(); -} - -/* Run the i2s_entry. */ -app_run(i2s_entry); \ No newline at end of file diff --git a/application/samples/peripheral/pinctrl/CMakeLists.txt b/application/samples/peripheral/pinctrl/CMakeLists.txt deleted file mode 100755 index ab7cb58..0000000 --- a/application/samples/peripheral/pinctrl/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/pinctrl_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/pinctrl/Kconfig b/application/samples/peripheral/pinctrl/Kconfig deleted file mode 100755 index 9cdabc3..0000000 --- a/application/samples/peripheral/pinctrl/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config PINCTRL_USE_PIN - int - prompt "Choose Pinctrl use pin." - depends on SAMPLE_SUPPORT_PINCTRL - default 23 \ No newline at end of file diff --git a/application/samples/peripheral/pinctrl/pinctrl.code-workspace b/application/samples/peripheral/pinctrl/pinctrl.code-workspace deleted file mode 100755 index 5bca9ad..0000000 --- a/application/samples/peripheral/pinctrl/pinctrl.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/pinctrl" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/pinctrl/pinctrl_demo.c b/application/samples/peripheral/pinctrl/pinctrl_demo.c deleted file mode 100755 index fc9e5ee..0000000 --- a/application/samples/peripheral/pinctrl/pinctrl_demo.c +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: PINCTRL Sample Source. \n - * - * History: \n - * 2023-07-27, Create file. \n - */ -#include "pinctrl.h" -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" - -#define PINCTRL_PIN_MODE 5 -#define PINCTRL_PIN_DS 3 -#define PINCTRL_PIN_PULL 2 - -#define PINCTRL_TASK_PRIO 24 -#define PINCTRL_TASK_STACK_SIZE 0x1000 - -static void *pinctrl_task(const char *arg) -{ - unused(arg); - pin_t pin = CONFIG_PINCTRL_USE_PIN; - pin_mode_t mode; - pin_drive_strength_t ds; - pin_pull_t pull; - - /* PINCTRL init. */ - uapi_pin_init(); - - osal_printk("start get pin<%d> mode!\r\n", pin); - mode = uapi_pin_get_mode(pin); - osal_printk("the mode of pin<%d> is %d.\r\n", pin, mode); - mode = PINCTRL_PIN_MODE; - osal_printk("start set pin<%d> mode<%d>!\r\n", pin, mode); - if (uapi_pin_set_mode(pin, mode) == ERRCODE_SUCC && uapi_pin_get_mode(pin) == mode) { - osal_printk("set pin<%d> mode<%d> succ.\r\n", pin, mode); - } - - osal_printk("\r\n"); - osal_printk("start get pin<%d> driver-strength!\r\n", pin); - ds = uapi_pin_get_ds(pin); - osal_printk("The driver-strength of pin<%d> is %d.\r\n", pin, ds); - ds = PINCTRL_PIN_DS; - osal_printk("start set pin<%d> driver-strength<%d>!\r\n", pin, ds); - if (uapi_pin_set_ds(pin, ds) == ERRCODE_SUCC && uapi_pin_get_ds(pin) == ds) { - osal_printk("set pin<%d> driver-strength<%d> succ.\r\n", pin, ds); - } - - osal_printk("\r\n"); - osal_printk("start get pin<%d> pull/down status!\r\n", pin); - pull = uapi_pin_get_pull(pin); - osal_printk("The pull/down status of pin<%d> is %d.\r\n", pin, pull); - pull = PINCTRL_PIN_PULL; - osal_printk("start set pin<%d> pull/down status<%d>!\r\n", pin, pull); - if (uapi_pin_set_pull(pin, pull) == ERRCODE_SUCC && uapi_pin_get_pull(pin) == pull) { - osal_printk("set pin<%d> pull/down status<%d> succ.\r\n", pin, pull); - } - - /* PINCTRL deinit. */ - uapi_pin_deinit(); - - return NULL; -} - -static void pinctrl_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)pinctrl_task, 0, "PinctrlTask", PINCTRL_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, PINCTRL_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the pinctrl_entry. */ -app_run(pinctrl_entry); \ No newline at end of file diff --git a/application/samples/peripheral/pwm/CMakeLists.txt b/application/samples/peripheral/pwm/CMakeLists.txt deleted file mode 100755 index 445b0f3..0000000 --- a/application/samples/peripheral/pwm/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/pwm_demo.c" PARENT_SCOPE) diff --git a/application/samples/peripheral/pwm/Kconfig b/application/samples/peripheral/pwm/Kconfig deleted file mode 100755 index 0ffefc8..0000000 --- a/application/samples/peripheral/pwm/Kconfig +++ /dev/null @@ -1,28 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config PWM_CHANNEL - int - prompt "Choose PWM Test Channel." - depends on SAMPLE_SUPPORT_PWM - default 0 - -config PWM_GROUP_ID - int - prompt "Choose PWM Test Group ID." - depends on SAMPLE_SUPPORT_PWM && PWM_USING_V151 - default 0 - -config PWM_PIN - int - prompt "Choose PWM pin." - depends on SAMPLE_SUPPORT_PWM - default 20 - -config PWM_PIN_MODE - int - prompt "Choose PWM pin mode." - default 3 - depends on SAMPLE_SUPPORT_PWM - diff --git a/application/samples/peripheral/pwm/pwm.code-workspace b/application/samples/peripheral/pwm/pwm.code-workspace deleted file mode 100755 index 16ea51c..0000000 --- a/application/samples/peripheral/pwm/pwm.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/pwm" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/pwm/pwm_demo.c b/application/samples/peripheral/pwm/pwm_demo.c deleted file mode 100755 index e52d28e..0000000 --- a/application/samples/peripheral/pwm/pwm_demo.c +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: PWM Sample Source. \n - * - * History: \n - * 2023-06-27, Create file. \n - */ -#if defined(CONFIG_PWM_SUPPORT_LPM) -#include "pm_veto.h" -#endif -#include "common_def.h" -#include "pinctrl.h" -#include "pwm.h" -#include "tcxo.h" -#include "soc_osal.h" -#include "app_init.h" - -#define TEST_TCXO_DELAY_1000MS 1000 - -#define PWM_TASK_PRIO 24 -#define PWM_TASK_STACK_SIZE 0x1000 - -static errcode_t pwm_sample_callback(uint8_t channel) -{ - osal_printk("PWM %d, cycle done. \r\n", channel); - return ERRCODE_SUCC; -} - -static void *pwm_task(const char *arg) -{ - UNUSED(arg); - pwm_config_t cfg_no_repeat = { - 100, - 100, - 0, - 0xFF, - false - }; - - uapi_pin_set_mode(CONFIG_PWM_PIN, CONFIG_PWM_PIN_MODE); - uapi_pwm_deinit(); - uapi_pwm_init(); - uapi_pwm_open(CONFIG_PWM_CHANNEL, &cfg_no_repeat); - - uapi_tcxo_delay_ms((uint32_t)TEST_TCXO_DELAY_1000MS); - uapi_pwm_unregister_interrupt(CONFIG_PWM_CHANNEL); - uapi_pwm_register_interrupt(CONFIG_PWM_CHANNEL, pwm_sample_callback); -#ifdef CONFIG_PWM_USING_V151 - uint8_t channel_id = CONFIG_PWM_CHANNEL; - /* channel_id can also choose to configure multiple channels, and the third parameter also needs to be adjusted - accordingly. */ - uapi_pwm_set_group(CONFIG_PWM_GROUP_ID, &channel_id, 1); - /* Here you can also call the uapi_pwm_start interface to open each channel individually. */ - uapi_pwm_start_group(CONFIG_PWM_GROUP_ID); -#else - uapi_pwm_start(CONFIG_PWM_CHANNEL); -#endif - - uapi_tcxo_delay_ms((uint32_t)TEST_TCXO_DELAY_1000MS); -#ifdef CONFIG_PWM_USING_V151 - uapi_pwm_close(CONFIG_PWM_GROUP_ID); -#else - uapi_pwm_close(CONFIG_PWM_CHANNEL); -#endif - - uapi_tcxo_delay_ms((uint32_t)TEST_TCXO_DELAY_1000MS); - uapi_pwm_deinit(); - return NULL; -} - -static void pwm_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)pwm_task, 0, "PwmTask", PWM_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, PWM_TASK_PRIO); - } - osal_kthread_unlock(); -} - -/* Run the pwm_entry. */ -app_run(pwm_entry); \ No newline at end of file diff --git a/application/samples/peripheral/pwm_light/CMakeLists.txt b/application/samples/peripheral/pwm_light/CMakeLists.txt deleted file mode 100755 index 445b0f3..0000000 --- a/application/samples/peripheral/pwm_light/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/pwm_demo.c" PARENT_SCOPE) diff --git a/application/samples/peripheral/pwm_light/Kconfig b/application/samples/peripheral/pwm_light/Kconfig deleted file mode 100755 index 0ffefc8..0000000 --- a/application/samples/peripheral/pwm_light/Kconfig +++ /dev/null @@ -1,28 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config PWM_CHANNEL - int - prompt "Choose PWM Test Channel." - depends on SAMPLE_SUPPORT_PWM - default 0 - -config PWM_GROUP_ID - int - prompt "Choose PWM Test Group ID." - depends on SAMPLE_SUPPORT_PWM && PWM_USING_V151 - default 0 - -config PWM_PIN - int - prompt "Choose PWM pin." - depends on SAMPLE_SUPPORT_PWM - default 20 - -config PWM_PIN_MODE - int - prompt "Choose PWM pin mode." - default 3 - depends on SAMPLE_SUPPORT_PWM - diff --git a/application/samples/peripheral/pwm_light/pwm.code-workspace b/application/samples/peripheral/pwm_light/pwm.code-workspace deleted file mode 100755 index 16ea51c..0000000 --- a/application/samples/peripheral/pwm_light/pwm.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/pwm" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/pwm_light/pwm_demo.c b/application/samples/peripheral/pwm_light/pwm_demo.c deleted file mode 100755 index 8a9a5b6..0000000 --- a/application/samples/peripheral/pwm_light/pwm_demo.c +++ /dev/null @@ -1,96 +0,0 @@ -#include "pinctrl.h" -#include "gpio.h" -#include "pwm.h" -#include "timer.h" - -#define LIGHT_GPIO_W GPIO_02 -#define LIGHT_GPIO_Y GPIO_08 - -static uint32_t period_ns = 40000; //80M/2K -static uint8_t channel_id_w = 0; -static uint8_t channel_id_y = 0; -static uint32_t high_ns = 0; -static uint32_t low_ns = 0; -void hfgpio_pwm_init(void) -{ - high_ns = ((period_ns / 1000) * 0) / 1000; // 高电平时间 - low_ns = period_ns - high_ns; // 低电平时间 - pwm_config_t cfg_no_repeat = { - low_ns, - high_ns, - 0, - 0xFF, - true - }; - channel_id_w = LIGHT_GPIO_W % 8; - channel_id_y = LIGHT_GPIO_Y % 8; - - uapi_pin_set_mode(LIGHT_GPIO_W, PIN_MODE_1); - uapi_pin_set_mode(LIGHT_GPIO_Y, PIN_MODE_1); - uapi_pwm_deinit(); - uapi_pwm_init(); - uapi_pwm_open(channel_id_w, &cfg_no_repeat); - uapi_pwm_set_group(channel_id_w, &channel_id_w, 1); - uapi_pwm_start_group(channel_id_w); - - uapi_pwm_open(channel_id_y, &cfg_no_repeat); - uapi_pwm_set_group(channel_id_y, &channel_id_y, 1); - uapi_pwm_start_group(channel_id_y); -} - -static void hfgpio_pwm_update(int fid, uint32_t hrate) -{ - high_ns = ((period_ns / 1000) * hrate) / 1000; // 高电平时间 - low_ns = period_ns - high_ns; // 低电平时间 - - if(fid == LIGHT_GPIO_W){ - uapi_pwm_update_duty_ratio(channel_id_w, low_ns, high_ns); - uapi_pwm_start_group(channel_id_w); - }else if(fid == LIGHT_GPIO_Y){ - uapi_pwm_update_duty_ratio(channel_id_y, low_ns, high_ns); - uapi_pwm_start_group(channel_id_y); - } -} - -static int pwm_hrate = 0; -static int dir_flag = 0; -static timer_handle_t timer1_handle = 0; -static void light_dim_timer_callback(uintptr_t data) -{ - if(data){} - if(dir_flag == 0){ - pwm_hrate++; - if(pwm_hrate == 1000){ - dir_flag = 1; - } - } - else if(dir_flag == 1){ - pwm_hrate--; - if(pwm_hrate == 0){ - dir_flag = 0; - } - } - hfgpio_pwm_update(LIGHT_GPIO_W, pwm_hrate); - hfgpio_pwm_update(LIGHT_GPIO_Y, pwm_hrate); - - uapi_timer_start(timer1_handle, 5000, light_dim_timer_callback, 0); -} - -void light_hwtimer_dim_entry(void) -{ - uapi_timer_init(); - int ret = 0; - ret = uapi_timer_adapter(TIMER_INDEX_1, TIMER_1_IRQN, 1); - ret = uapi_timer_create(TIMER_INDEX_1, &timer1_handle); - ret = uapi_timer_start(timer1_handle, 1000, light_dim_timer_callback, 0); - if(ret != 0) - osal_printk("hwtimer start fail\r\n"); - else - osal_printk("hwtimer start success\r\n"); -} - -void pwm_test(void) -{ - hfgpio_pwm_init(); - light_hwtimer_dim_entry(); -} \ No newline at end of file diff --git a/application/samples/peripheral/sfc/CMakeLists.txt b/application/samples/peripheral/sfc/CMakeLists.txt deleted file mode 100755 index ea231bb..0000000 --- a/application/samples/peripheral/sfc/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/sfc_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/sfc/Kconfig b/application/samples/peripheral/sfc/Kconfig deleted file mode 100755 index ae67844..0000000 --- a/application/samples/peripheral/sfc/Kconfig +++ /dev/null @@ -1,15 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config SFC_SAMPLE_USER_ADDR - hex - prompt "choose SFC sample Start Address(Real address of the flash memory)." - depends on SAMPLE_SUPPORT_SFC - default 0x7C000 - -config SFC_SAMPLE_USER_SIZE - hex - prompt "choose SFC sample End Address(Real address of the flash memory)." - depends on SAMPLE_SUPPORT_SFC - default 0x1000 \ No newline at end of file diff --git a/application/samples/peripheral/sfc/sfc.code-workspace b/application/samples/peripheral/sfc/sfc.code-workspace deleted file mode 100755 index 3144b82..0000000 --- a/application/samples/peripheral/sfc/sfc.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/sfc" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/sfc/sfc_demo.c b/application/samples/peripheral/sfc/sfc_demo.c deleted file mode 100755 index 351c6a7..0000000 --- a/application/samples/peripheral/sfc/sfc_demo.c +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Provides SFC sample source \n - * - * History: \n - * 2024-03-04, Create file. \n - */ -#include "soc_osal.h" -#include "securec.h" -#include "sfc.h" -#include "sfc_porting.h" -#include "app_init.h" -#include "memory_config_common.h" - -#define SFC_TASK_PRIO 24 -#define SFC_TASK_STACK_SIZE 0x1000 -#define SFC_SAMPLE_LEN 0x80000 -#define SFC_PRINT_BUFF_LEN 32 -uint8_t g_print_data_buff[SFC_PRINT_BUFF_LEN] = {0}; -uint8_t g_write_data_buff[SFC_PRINT_BUFF_LEN] = {0}; - -static void sfc_sample_start_api_test(void) -{ - osal_printk("API test start\r\n"); - uint32_t remained_len = CONFIG_SFC_SAMPLE_USER_SIZE; - uint32_t start_addr = CONFIG_SFC_SAMPLE_USER_ADDR; - while (remained_len > 0) { - uint32_t cur_len = remained_len > SFC_PRINT_BUFF_LEN ? SFC_PRINT_BUFF_LEN : remained_len; - uapi_sfc_reg_read(start_addr, g_print_data_buff, cur_len); - for (uint8_t i = 0; i < cur_len; i++) { - osal_printk("%02x ", g_print_data_buff[i]); - } - uapi_sfc_reg_write(start_addr, g_write_data_buff, cur_len); - start_addr += cur_len; - remained_len -= cur_len; - osal_printk("\r\n"); - } - start_addr = CONFIG_SFC_SAMPLE_USER_ADDR; - remained_len = CONFIG_SFC_SAMPLE_USER_SIZE; - while (remained_len > 0) { - uint32_t cur_len = remained_len > SFC_PRINT_BUFF_LEN ? SFC_PRINT_BUFF_LEN : remained_len; - uapi_sfc_reg_read(start_addr, g_print_data_buff, cur_len); - for (uint8_t i = 0; i < cur_len; i++) { - osal_printk("%02x ", g_print_data_buff[i]); - } - start_addr += cur_len; - remained_len -= cur_len; - osal_printk("\r\n"); - } -} - -static void *sfc_task(const char *arg) -{ - unused(arg); - for (uint8_t i = 0; i < SFC_PRINT_BUFF_LEN; i++) { - g_write_data_buff[i] = i; - } - /* Erase User space */ - osal_printk("Erasing for API sample...\r\n"); - errcode_t ret = uapi_sfc_reg_erase(CONFIG_SFC_SAMPLE_USER_ADDR, CONFIG_SFC_SAMPLE_USER_SIZE); - if (ret != ERRCODE_SUCC) { - osal_printk("flash erase failed! ret = %x\r\n", ret); - return NULL; - } - osal_printk("Start API read sample...\r\n"); - sfc_sample_start_api_test(); - return NULL; -} - -static void sfc_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)sfc_task, 0, "SFCTask", SFC_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SFC_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the spi_master_entry. */ -app_run(sfc_entry); \ No newline at end of file diff --git a/application/samples/peripheral/spi/CMakeLists.txt b/application/samples/peripheral/spi/CMakeLists.txt deleted file mode 100755 index 478f7b2..0000000 --- a/application/samples/peripheral/spi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -if(DEFINED CONFIG_SAMPLE_SUPPORT_SPI_MASTER) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/spi_master_demo.c" PARENT_SCOPE) -elseif(DEFINED CONFIG_SAMPLE_SUPPORT_SPI_SLAVE) - set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/spi_slave_demo.c" PARENT_SCOPE) -endif() \ No newline at end of file diff --git a/application/samples/peripheral/spi/Kconfig b/application/samples/peripheral/spi/Kconfig deleted file mode 100755 index d7d5647..0000000 --- a/application/samples/peripheral/spi/Kconfig +++ /dev/null @@ -1,127 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config SAMPLE_SUPPORT_SPI_MASTER - bool - prompt "Support SPI Master Sample." - default n - depends on SAMPLE_SUPPORT_SPI - help - This option means support SPI Master Sample. - -config SPI_MASTER_BUS_ID - int - prompt "Choose SPI master bus id." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 2 - -config SPI_DI_MASTER_PIN - int - prompt "Choose SPI DI master pin." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 16 - -config SPI_DO_MASTER_PIN - int - prompt "Choose SPI DO master pin." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 17 - -config SPI_CLK_MASTER_PIN - int - prompt "Choose SPI CLK master pin." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 18 - -config SPI_CS_MASTER_PIN - int - prompt "Choose SPI CS master pin." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 19 - -config SPI_MASTER_PIN_MODE - int - prompt "Choose SPI master pin mode." - depends on SAMPLE_SUPPORT_SPI_MASTER - default 1 - -config SPI_MASTER_SUPPORT_QSPI - bool - prompt "SPI master support QSPI." - depends on SAMPLE_SUPPORT_SPI_MASTER - default n - -config SPI_MASTER_D3_PIN_MODE - int - prompt "Choose QSPI master D3 pin mode." - depends on SPI_MASTER_SUPPORT_QSPI - default 1 - -config SPI_MASTER_D2_PIN_MODE - int - prompt "Choose QSPI master D2 pin mode." - depends on SPI_MASTER_SUPPORT_QSPI - default 1 - -config SPI_MASTER_D3_PIN - int - prompt "Choose QSPI master D3 pin." - depends on SPI_MASTER_SUPPORT_QSPI - default 40 - -config SPI_MASTER_D2_PIN - int - prompt "Choose QSPI master D2 pin." - depends on SPI_MASTER_SUPPORT_QSPI - default 41 - -config SAMPLE_SUPPORT_SPI_SLAVE - bool - prompt "Support SPI Slave Sample." - default n - depends on SAMPLE_SUPPORT_SPI - help - This option means support SPI Slave Sample. - -config SPI_SLAVE_BUS_ID - int - prompt "Choose SPI slave bus id." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 4 - -config SPI_DI_SLAVE_PIN - int - prompt "Choose SPI DI slave pin." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 12 - -config SPI_DO_SLAVE_PIN - int - prompt "Choose SPI DO slave pin." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 13 - -config SPI_CLK_SLAVE_PIN - int - prompt "Choose SPI CLK slave pin." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 14 - -config SPI_CS_SLAVE_PIN - int - prompt "Choose SPI CS slave pin." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 15 - -config SPI_SLAVE_PIN_MODE - int - prompt "Choose SPI slave pin mode." - depends on SAMPLE_SUPPORT_SPI_SLAVE - default 5 - -config SPI_TRANSFER_LEN - int - prompt "Choose SPI transfer length." - depends on SAMPLE_SUPPORT_SPI - default 8 \ No newline at end of file diff --git a/application/samples/peripheral/spi/spi.code-workspace b/application/samples/peripheral/spi/spi.code-workspace deleted file mode 100755 index a94715a..0000000 --- a/application/samples/peripheral/spi/spi.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/spi" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/spi/spi_master_demo.c b/application/samples/peripheral/spi/spi_master_demo.c deleted file mode 100755 index 90d8954..0000000 --- a/application/samples/peripheral/spi/spi_master_demo.c +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: SPI Sample Source. \n - * - * History: \n - * 2023-06-25, Create file. \n - */ -#include "pinctrl.h" -#include "spi.h" -#include "soc_osal.h" -#include "app_init.h" - -#define SPI_SLAVE_NUM 1 -#define SPI_FREQUENCY 2 -#define SPI_CLK_POLARITY 0 -#define SPI_CLK_PHASE 0 -#define SPI_FRAME_FORMAT 0 -#define SPI_FRAME_FORMAT_STANDARD 0 -#define SPI_FRAME_SIZE_8 0x1f -#define SPI_TMOD 0 -#define SPI_WAIT_CYCLES 0x10 -#if defined(CONFIG_SPI_SUPPORT_DMA) && !(defined(CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH)) -#define SPI_DMA_WIDTH 2 -#endif -#if defined(CONFIG_SPI_MASTER_SUPPORT_QSPI) -#define QSPI_WRITE_CMD 0x38 -#define QSPI_WRITE_ADDR 0x123 -#endif -#define SPI_TASK_DURATION_MS 500 -#define SPI_TASK_PRIO 24 -#define SPI_TASK_STACK_SIZE 0x1000 - -static void app_spi_init_pin(void) -{ - uapi_pin_set_mode(CONFIG_SPI_DI_MASTER_PIN, CONFIG_SPI_MASTER_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_DO_MASTER_PIN, CONFIG_SPI_MASTER_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_CLK_MASTER_PIN, CONFIG_SPI_MASTER_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_CS_MASTER_PIN, CONFIG_SPI_MASTER_PIN_MODE); -#if defined(CONFIG_SPI_MASTER_SUPPORT_QSPI) - uapi_pin_set_mode(CONFIG_SPI_MASTER_D2_PIN, CONFIG_SPI_MASTER_D2_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_MASTER_D3_PIN, CONFIG_SPI_MASTER_D3_PIN_MODE); -#endif -} - -#if defined(CONFIG_SPI_SUPPORT_INTERRUPT) && (CONFIG_SPI_SUPPORT_INTERRUPT == 1) -static void app_spi_master_write_int_handler(const void *buffer, uint32_t length) -{ - unused(buffer); - unused(length); - osal_printk("spi master write interrupt start!\r\n"); -} - -static void app_spi_master_rx_callback(const void *buffer, uint32_t length, bool error) -{ - if (buffer == NULL || length == 0) { - osal_printk("spi master transfer illegal data!\r\n"); - return; - } - if (error) { - osal_printk("app_spi_master_read_int error!\r\n"); - return; - } - - uint8_t *buff = (uint8_t *)buffer; - for (uint32_t i = 0; i < length; i++) { - osal_printk("buff[%d] = %x\r\n", i, buff[i]); - } - osal_printk("app_spi_master_read_int success!\r\n"); -} -#endif /* CONFIG_SPI_SUPPORT_INTERRUPT */ - -static void app_spi_master_init_config(void) -{ - spi_attr_t config = { 0 }; - spi_extra_attr_t ext_config = { 0 }; - - config.is_slave = false; - config.slave_num = SPI_SLAVE_NUM; - config.bus_clk = SPI_CLK_FREQ; - config.freq_mhz = SPI_FREQUENCY; - config.clk_polarity = SPI_CLK_POLARITY; - config.clk_phase = SPI_CLK_PHASE; - config.frame_format = SPI_FRAME_FORMAT; - config.spi_frame_format = HAL_SPI_FRAME_FORMAT_STANDARD; - config.frame_size = SPI_FRAME_SIZE_8; - config.tmod = SPI_TMOD; - config.sste = 0; - - ext_config.qspi_param.wait_cycles = SPI_WAIT_CYCLES; -#if defined(CONFIG_SPI_MASTER_SUPPORT_QSPI) - config.tmod = HAL_SPI_TRANS_MODE_TX; - config.sste = 0; - config.spi_frame_format = HAL_SPI_FRAME_FORMAT_QUAD; - ext_config.qspi_param.trans_type = HAL_SPI_TRANS_TYPE_INST_S_ADDR_Q; - ext_config.qspi_param.inst_len = HAL_SPI_INST_LEN_8; - ext_config.qspi_param.addr_len = HAL_SPI_ADDR_LEN_24; - ext_config.qspi_param.wait_cycles = 0; -#endif - - uapi_spi_init(CONFIG_SPI_MASTER_BUS_ID, &config, &ext_config); -#if defined(CONFIG_SPI_SUPPORT_DMA) && (CONFIG_SPI_SUPPORT_DMA == 1) - uapi_dma_init(); - uapi_dma_open(); -#ifndef CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH - spi_dma_config_t dma_cfg = { - .src_width = SPI_DMA_WIDTH, - .dest_width = SPI_DMA_WIDTH, - .burst_length = 0, - .priority = 0 - }; - if (uapi_spi_set_dma_mode(CONFIG_SPI_MASTER_BUS_ID, true, &dma_cfg) != ERRCODE_SUCC) { - osal_printk("spi%d master set dma mode fail!\r\n"); - } -#endif -#endif /* CONFIG_SPI_SUPPORT_DMA */ - -#if defined(CONFIG_SPI_SUPPORT_INTERRUPT) && (CONFIG_SPI_SUPPORT_INTERRUPT == 1) - if (uapi_spi_set_irq_mode(CONFIG_SPI_MASTER_BUS_ID, true, app_spi_master_rx_callback, - app_spi_master_write_int_handler) == ERRCODE_SUCC) { - osal_printk("spi%d master set irq mode succ!\r\n", CONFIG_SPI_MASTER_BUS_ID); - } -#endif /* CONFIG_SPI_SUPPORT_INTERRUPT */ -} - -static void *spi_master_task(const char *arg) -{ - unused(arg); - /* SPI pinmux. */ - app_spi_init_pin(); - - /* SPI master init config. */ - app_spi_master_init_config(); - - /* SPI data config. */ - uint8_t tx_data[CONFIG_SPI_TRANSFER_LEN] = { 0 }; - for (uint32_t loop = 0; loop < CONFIG_SPI_TRANSFER_LEN; loop++) { - tx_data[loop] = (loop & 0xFF); - } - uint8_t rx_data[CONFIG_SPI_TRANSFER_LEN] = { 0 }; - spi_xfer_data_t data = { - .tx_buff = tx_data, - .tx_bytes = CONFIG_SPI_TRANSFER_LEN, - .rx_buff = rx_data, - .rx_bytes = CONFIG_SPI_TRANSFER_LEN, -#if defined(CONFIG_SPI_MASTER_SUPPORT_QSPI) - .cmd = QSPI_WRITE_CMD, - .addr = QSPI_WRITE_ADDR, -#endif - }; - - while (1) { - osal_msleep(SPI_TASK_DURATION_MS); - osal_printk("spi%d master send start!\r\n", CONFIG_SPI_MASTER_BUS_ID); - if (uapi_spi_master_write(CONFIG_SPI_MASTER_BUS_ID, &data, 0xFFFFFFFF) == ERRCODE_SUCC) { - osal_printk("spi%d master send succ!\r\n", CONFIG_SPI_MASTER_BUS_ID); - } else { - continue; - } - osal_printk("spi%d master receive start!\r\n", CONFIG_SPI_MASTER_BUS_ID); - if (uapi_spi_master_read(CONFIG_SPI_MASTER_BUS_ID, &data, 0xFFFFFFFF) == ERRCODE_SUCC) { -#ifndef CONFIG_SPI_SUPPORT_INTERRUPT - for (uint32_t i = 0; i < data.rx_bytes; i++) { - osal_printk("spi%d master receive data is %x\r\n", CONFIG_SPI_MASTER_BUS_ID, data.rx_buff[i]); - } -#endif - osal_printk("spi%d master receive succ!\r\n", CONFIG_SPI_MASTER_BUS_ID); - } - } - - return NULL; -} - -static void spi_master_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)spi_master_task, 0, "SpiMasterTask", SPI_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SPI_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the spi_master_entry. */ -app_run(spi_master_entry); \ No newline at end of file diff --git a/application/samples/peripheral/spi/spi_slave_demo.c b/application/samples/peripheral/spi/spi_slave_demo.c deleted file mode 100755 index e6fa3e1..0000000 --- a/application/samples/peripheral/spi/spi_slave_demo.c +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: SPI Sample Source. \n - * - * History: \n - * 2023-06-25, Create file. \n - */ -#include "pinctrl.h" -#include "spi.h" -#include "soc_osal.h" -#include "app_init.h" - -#define SPI_SLAVE_NUM 1 -#define SPI_FREQUENCY 2 -#define SPI_CLK_POLARITY 0 -#define SPI_CLK_PHASE 0 -#define SPI_FRAME_FORMAT 0 -#define SPI_FRAME_FORMAT_STANDARD 0 -#define SPI_FRAME_SIZE_8 0x1f -#define SPI_TMOD 0 -#define SPI_WAIT_CYCLES 0x10 -#if defined(CONFIG_SPI_SUPPORT_DMA) && !(defined(CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH)) -#define SPI_DMA_WIDTH 2 -#endif - -#define SPI_TASK_DURATION_MS 500 -#define SPI_TASK_PRIO 24 -#define SPI_TASK_STACK_SIZE 0x1000 - -static void app_spi_init_pin(void) -{ - uapi_pin_set_mode(CONFIG_SPI_DI_SLAVE_PIN, CONFIG_SPI_SLAVE_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_DO_SLAVE_PIN, CONFIG_SPI_SLAVE_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_CLK_SLAVE_PIN, CONFIG_SPI_SLAVE_PIN_MODE); - uapi_pin_set_mode(CONFIG_SPI_CS_SLAVE_PIN, CONFIG_SPI_SLAVE_PIN_MODE); -} - -#if defined(CONFIG_SPI_SUPPORT_INTERRUPT) && (CONFIG_SPI_SUPPORT_INTERRUPT == 1) -static void app_spi_slave_write_int_handler(const void *buffer, uint32_t length) -{ - unused(buffer); - unused(length); - osal_printk("spi slave write interrupt start!\r\n"); -} - -static void app_spi_slave_rx_callback(const void *buffer, uint32_t length, bool error) -{ - if (buffer == NULL || length == 0) { - osal_printk("spi slave transfer illegal data!\r\n"); - return; - } - if (error) { - osal_printk("app_spi_slave_read_int error!\r\n"); - return; - } - - uint8_t *buff = (uint8_t *)buffer; - for (uint32_t i = 0; i < length; i++) { - osal_printk("buff[%d] = %x\r\n", i, buff[i]); - } - osal_printk("app_spi_slave_read_int success!\r\n"); -} -#endif /* CONFIG_SPI_SUPPORT_INTERRUPT */ - -static void app_spi_slave_init_config(void) -{ - spi_attr_t config = { 0 }; - spi_extra_attr_t ext_config = { 0 }; - - config.is_slave = true; - config.slave_num = SPI_SLAVE_NUM; - config.bus_clk = SPI_CLK_FREQ; - config.freq_mhz = SPI_FREQUENCY; - config.clk_polarity = SPI_CLK_POLARITY; - config.clk_phase = SPI_CLK_PHASE; - config.frame_format = SPI_FRAME_FORMAT; - config.spi_frame_format = HAL_SPI_FRAME_FORMAT_STANDARD; - config.frame_size = SPI_FRAME_SIZE_8; - config.tmod = SPI_TMOD; - config.sste = 0; - - ext_config.qspi_param.wait_cycles = SPI_WAIT_CYCLES; - - uapi_spi_init(CONFIG_SPI_SLAVE_BUS_ID, &config, &ext_config); -#if defined(CONFIG_SPI_SUPPORT_DMA) && (CONFIG_SPI_SUPPORT_DMA == 1) - uapi_dma_init(); - uapi_dma_open(); -#ifndef CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH - spi_dma_config_t dma_cfg = { - .src_width = SPI_DMA_WIDTH, - .dest_width = SPI_DMA_WIDTH, - .burst_length = 0, - .priority = 0 - }; - if (uapi_spi_set_dma_mode(CONFIG_SPI_SLAVE_BUS_ID, true, &dma_cfg) != ERRCODE_SUCC) { - osal_printk("spi%d slave set dma mode fail!\r\n"); - } -#endif -#endif /* CONFIG_SPI_SUPPORT_DMA */ - -#if defined(CONFIG_SPI_SUPPORT_INTERRUPT) && (CONFIG_SPI_SUPPORT_INTERRUPT == 1) - if (uapi_spi_set_irq_mode(CONFIG_SPI_SLAVE_BUS_ID, true, app_spi_slave_rx_callback, - app_spi_slave_write_int_handler) == ERRCODE_SUCC) { - osal_printk("spi%d slave set irq mode succ!\r\n", CONFIG_SPI_SLAVE_BUS_ID); - } -#endif /* CONFIG_SPI_SUPPORT_INTERRUPT */ -} - -static void *spi_slave_task(const char *arg) -{ - unused(arg); - /* SPI pinmux. */ - app_spi_init_pin(); - - /* SPI slave init config. */ - app_spi_slave_init_config(); - - /* SPI data config. */ - uint8_t tx_data[CONFIG_SPI_TRANSFER_LEN] = { 0 }; - for (uint32_t loop = 0; loop < CONFIG_SPI_TRANSFER_LEN; loop++) { - tx_data[loop] = (loop & 0xFF); - } - uint8_t rx_data[CONFIG_SPI_TRANSFER_LEN] = { 0 }; - spi_xfer_data_t data = { - .tx_buff = tx_data, - .tx_bytes = CONFIG_SPI_TRANSFER_LEN, - .rx_buff = rx_data, - .rx_bytes = CONFIG_SPI_TRANSFER_LEN, - }; - - while (1) { - osal_msleep(SPI_TASK_DURATION_MS); - osal_printk("spi%d slave receive start!\r\n", CONFIG_SPI_SLAVE_BUS_ID); - if (uapi_spi_slave_read(CONFIG_SPI_SLAVE_BUS_ID, &data, 0xFFFFFFFF) == ERRCODE_SUCC) { -#ifndef CONFIG_SPI_SUPPORT_INTERRUPT - for (uint32_t i = 0; i < data.rx_bytes; i++) { - osal_printk("spi%d slave receive data is %x\r\n", CONFIG_SPI_SLAVE_BUS_ID, data.rx_buff[i]); - } -#endif - osal_printk("spi%d slave receive succ!\r\n", CONFIG_SPI_SLAVE_BUS_ID); - } else { - continue; - } - osal_printk("spi%d slave send start!\r\n", CONFIG_SPI_SLAVE_BUS_ID); - if (uapi_spi_slave_write(CONFIG_SPI_SLAVE_BUS_ID, &data, 0xFFFFFFFF) == ERRCODE_SUCC) { - osal_printk("spi%d slave send succ!\r\n", CONFIG_SPI_SLAVE_BUS_ID); - } - } - - return NULL; -} - -static void spi_slave_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)spi_slave_task, 0, "SpiSlaveTask", SPI_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SPI_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the spi_slave_entry. */ -app_run(spi_slave_entry); \ No newline at end of file diff --git a/application/samples/peripheral/systick/CMakeLists.txt b/application/samples/peripheral/systick/CMakeLists.txt deleted file mode 100755 index 826fc87..0000000 --- a/application/samples/peripheral/systick/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/systick_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/systick/systick.code-workspace b/application/samples/peripheral/systick/systick.code-workspace deleted file mode 100755 index d60a852..0000000 --- a/application/samples/peripheral/systick/systick.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/systick" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/systick/systick_demo.c b/application/samples/peripheral/systick/systick_demo.c deleted file mode 100755 index 3b2b2a4..0000000 --- a/application/samples/peripheral/systick/systick_demo.c +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: SYSTICK Sample Source. \n - * - * History: \n - * 2023-07-17, Create file. \n - */ -#include "pinctrl.h" -#include "systick.h" -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" - -#define SYSTICK_DELAY_S 2 -#define SYSTICK_DELAY_MS 1000 -#define SYSTICK_DELAY_US 20000 -#define SYSTICK_TASK_DURATION_MS 500 - -#define SYSTICK_TASK_PRIO 24 -#define SYSTICK_TASK_STACK_SIZE 0x1000 - -static void *systick_task(const char *arg) -{ - unused(arg); - uint64_t count_before_get_s; - uint64_t count_after_get_s; - uint64_t count_before_get_ms; - uint64_t count_after_get_ms; - uint64_t count_before_get_us; - uint64_t count_after_get_us; - - /* SYSTICK init. */ - uapi_systick_init(); - - while (1) { - osal_msleep(SYSTICK_TASK_DURATION_MS); - osal_printk("systick delay %ds!\r\n", SYSTICK_DELAY_S); - count_before_get_s = uapi_systick_get_s(); - uapi_systick_delay_s(SYSTICK_DELAY_S); - count_after_get_s = uapi_systick_get_s(); - osal_printk("count_after_get_s = %llu, count_before_get_s = %llu\r\n", count_after_get_s, count_before_get_s); - osal_printk("count_s = %llu\r\n", count_after_get_s - count_before_get_s); - if (count_after_get_s > count_before_get_s) { - osal_printk("systick get s work normall.\r\n"); - } - - osal_printk("systick delay %dms!\r\n", SYSTICK_DELAY_MS); - count_before_get_ms = uapi_systick_get_ms(); - uapi_systick_delay_ms(SYSTICK_DELAY_MS); - count_after_get_ms = uapi_systick_get_ms(); - osal_printk("count_after_get_ms = %llu, count_before_get_ms = %llu\r\n", count_after_get_ms, - count_before_get_ms); - osal_printk("count_ms = %llu\r\n", count_after_get_ms - count_before_get_ms); - if (count_after_get_ms > count_before_get_ms) { - osal_printk("systick get ms work normall.\r\n"); - } - - osal_printk("systick delay %dus!\r\n", SYSTICK_DELAY_US); - count_before_get_us = uapi_systick_get_us(); - uapi_systick_delay_us(SYSTICK_DELAY_US); - count_after_get_us = uapi_systick_get_us(); - osal_printk("count_after_get_us = %llu, count_before_get_us = %llu\r\n", count_after_get_us, - count_before_get_us); - osal_printk("count_us = %llu\r\n", count_after_get_us - count_before_get_us); - if (count_after_get_us > count_before_get_us) { - osal_printk("systick get us work normall.\r\n"); - } - } - - return NULL; -} - -static void systick_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)systick_task, 0, "SystickTask", SYSTICK_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, SYSTICK_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the systick_entry. */ -app_run(systick_entry); \ No newline at end of file diff --git a/application/samples/peripheral/tasks/CMakeLists.txt b/application/samples/peripheral/tasks/CMakeLists.txt deleted file mode 100755 index f60ac72..0000000 --- a/application/samples/peripheral/tasks/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/tasks.c" PARENT_SCOPE) diff --git a/application/samples/peripheral/tasks/tasks.c b/application/samples/peripheral/tasks/tasks.c deleted file mode 100755 index c250a6b..0000000 --- a/application/samples/peripheral/tasks/tasks.c +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: Tasks Sample Source. \n - * - * History: \n - * 2023-04-03, Create file. \n - */ -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" - -#define TASKS_TEST_DURATION_MS 5000 -#define TASKS_TEST_TASK_PRIO 24 -#define TASKS_TEST_TASK_STACK_SIZE 0x1000 - -static void *tasks_test_task(const char *arg) -{ - unused(arg); - - while (1) { - osal_msleep(TASKS_TEST_DURATION_MS); - osal_printk("Hello BS25, Now you can develop SLE Product!\r\n"); - } - - return NULL; -} - -static void tasks_test_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)tasks_test_task, 0, "TasksTask", - TASKS_TEST_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, TASKS_TEST_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the tasks_test_entry. */ -app_run(tasks_test_entry); \ No newline at end of file diff --git a/application/samples/peripheral/tasks/tasks.code-workspace b/application/samples/peripheral/tasks/tasks.code-workspace deleted file mode 100755 index 9c48ecd..0000000 --- a/application/samples/peripheral/tasks/tasks.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/tasks" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/tcxo/CMakeLists.txt b/application/samples/peripheral/tcxo/CMakeLists.txt deleted file mode 100755 index ecb8bb7..0000000 --- a/application/samples/peripheral/tcxo/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/tcxo_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/tcxo/tcxo.code-workspace b/application/samples/peripheral/tcxo/tcxo.code-workspace deleted file mode 100755 index 1e16363..0000000 --- a/application/samples/peripheral/tcxo/tcxo.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/tcxo" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/tcxo/tcxo_demo.c b/application/samples/peripheral/tcxo/tcxo_demo.c deleted file mode 100755 index 1720423..0000000 --- a/application/samples/peripheral/tcxo/tcxo_demo.c +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: TCXO Sample Source. \n - * - * History: \n - * 2023-07-17, Create file. \n - */ -#include "tcxo.h" -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" - -#define TCXO_DELAY_MS 1000 -#define TCXO_DELAY_US 20000 -#define TCXO_TASK_DURATION_MS 500 - -#define TCXO_TASK_PRIO 24 -#define TCXO_TASK_STACK_SIZE 0x1000 - -static void *tcxo_task(const char *arg) -{ - unused(arg); - uint64_t count_before_get_ms; - uint64_t count_after_get_ms; - uint64_t count_before_get_us; - uint64_t count_after_get_us; - - /* TCXO init. */ - uapi_tcxo_init(); - - while (1) { - osal_msleep(TCXO_TASK_DURATION_MS); - osal_printk("tcxo delay %dms!\r\n", TCXO_DELAY_MS); - count_before_get_ms = uapi_tcxo_get_ms(); - uapi_tcxo_delay_ms(TCXO_DELAY_MS); - count_after_get_ms = uapi_tcxo_get_ms(); - osal_printk("count_after_get_ms = %llu, count_before_get_ms = %llu\r\n", count_after_get_ms, - count_before_get_ms); - osal_printk("count_ms = %llu\r\n", count_after_get_ms - count_before_get_ms); - if (count_after_get_ms > count_before_get_ms) { - osal_printk("tcxo get ms work normall.\r\n"); - } - - osal_printk("tcxo delay %dus!\r\n", TCXO_DELAY_US); - count_before_get_us = uapi_tcxo_get_us(); - uapi_tcxo_delay_us(TCXO_DELAY_US); - count_after_get_us = uapi_tcxo_get_us(); - osal_printk("count_after_get_us = %llu, count_before_get_us = %llu\r\n", count_after_get_us, - count_before_get_us); - osal_printk("count_us = %llu\r\n", count_after_get_us - count_before_get_us); - if (count_after_get_us > count_before_get_us) { - osal_printk("tcxo get us work normall.\r\n"); - } - } - - return NULL; -} - -static void tcxo_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)tcxo_task, 0, "TcxoTask", TCXO_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, TCXO_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the tcxo_entry. */ -app_run(tcxo_entry); \ No newline at end of file diff --git a/application/samples/peripheral/timer/CMakeLists.txt b/application/samples/peripheral/timer/CMakeLists.txt deleted file mode 100755 index de134e6..0000000 --- a/application/samples/peripheral/timer/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/timer_demo.c" PARENT_SCOPE) diff --git a/application/samples/peripheral/timer/Kconfig b/application/samples/peripheral/timer/Kconfig deleted file mode 100755 index 359cbf5..0000000 --- a/application/samples/peripheral/timer/Kconfig +++ /dev/null @@ -1,4 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== \ No newline at end of file diff --git a/application/samples/peripheral/timer/timer.code-workspace b/application/samples/peripheral/timer/timer.code-workspace deleted file mode 100755 index 0c1e106..0000000 --- a/application/samples/peripheral/timer/timer.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/timer" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/timer/timer_demo.c b/application/samples/peripheral/timer/timer_demo.c deleted file mode 100755 index 660b877..0000000 --- a/application/samples/peripheral/timer/timer_demo.c +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: Timer Sample Source. \n - * - * History: \n - * 2023-07-18, Create file. \n - */ -#include "timer.h" -#include "tcxo.h" -#include "chip_core_irq.h" -#include "common_def.h" -#include "soc_osal.h" -#include "app_init.h" - -#define TIMER_TIMERS_NUM 4 -#define TIMER_INDEX 1 -#define TIMER_PRIO 1 -#define TIMER_DELAY_INT 5 -#define TIMER1_DELAY_1000US 1000 -#define TIMER2_DELAY_2000US 2000 -#define TIMER3_DELAY_3000US 3000 -#define TIMER4_DELAY_4000US 4000 -#define TIMER_MS_2_US 1000 - -#define TIMER_TASK_PRIO 24 -#define TIMER_TASK_STACK_SIZE 0x1000 - -typedef struct timer_info { - uint32_t start_time; - uint32_t end_time; - uint32_t delay_time; -} timer_info_t; - -static uint32_t g_timer_int_count = 0; -static timer_info_t g_timers_info[TIMER_TIMERS_NUM] = { - {0, 0, TIMER1_DELAY_1000US}, - {0, 0, TIMER2_DELAY_2000US}, - {0, 0, TIMER3_DELAY_3000US}, - {0, 0, TIMER4_DELAY_4000US} -}; - -/* Timed task callback function list. */ -static void timer_timeout_callback(uintptr_t data) -{ - uint32_t timer_index = (uint32_t)data; - g_timers_info[timer_index].end_time = uapi_tcxo_get_ms(); - g_timer_int_count++; -} - -static void *timer_task(const char *arg) -{ - unused(arg); - timer_handle_t timer_index[TIMER_TIMERS_NUM] = { 0 }; - uapi_timer_init(); - uapi_timer_adapter(TIMER_INDEX, TIMER_1_IRQN, TIMER_PRIO); - - for (uint32_t i = 0; i < TIMER_TIMERS_NUM; i++) { - uapi_timer_create(TIMER_INDEX, &timer_index[i]); - g_timers_info[i].start_time = uapi_tcxo_get_ms(); - uapi_timer_start(timer_index[i], g_timers_info[i].delay_time, timer_timeout_callback, i); - osal_msleep(TIMER_DELAY_INT); - } - - while (g_timer_int_count < TIMER_TIMERS_NUM) { - osal_msleep(TIMER_DELAY_INT); - } - - for (uint32_t i = 0; i < TIMER_TIMERS_NUM; i++) { - uapi_timer_stop(timer_index[i]); - uapi_timer_delete(timer_index[i]); - osal_printk("real time[%d] = %dms ", i, (g_timers_info[i].end_time - g_timers_info[i].start_time)); - osal_printk(" delay = %dms\r\n", g_timers_info[i].delay_time / TIMER_MS_2_US); - } - return NULL; -} - -static void timer_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)timer_task, 0, "TimerTask", TIMER_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, TIMER_TASK_PRIO); - osal_kfree(task_handle); - } - osal_kthread_unlock(); -} - -/* Run the timer_entry. */ -app_run(timer_entry); \ No newline at end of file diff --git a/application/samples/peripheral/uart/CMakeLists.txt b/application/samples/peripheral/uart/CMakeLists.txt deleted file mode 100755 index 9e47ca2..0000000 --- a/application/samples/peripheral/uart/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/uart_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/uart/Kconfig b/application/samples/peripheral/uart/Kconfig deleted file mode 100755 index ccc0d0b..0000000 --- a/application/samples/peripheral/uart/Kconfig +++ /dev/null @@ -1,45 +0,0 @@ -#=============================================================================== -# @brief Kconfig file. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -config UART_BUS_ID - int - prompt "Choose UART bus id." - depends on SAMPLE_SUPPORT_UART - default 1 - -config UART_TXD_PIN - int - prompt "Choose UART TXD pin." - depends on SAMPLE_SUPPORT_UART - default 17 - -config UART_RXD_PIN - int - prompt "Choose UART RXD pin." - depends on SAMPLE_SUPPORT_UART - default 18 - -config UART_TXD_PIN_MODE - int - prompt "Choose UART TXD pin mode." - depends on SAMPLE_SUPPORT_UART - default 25 - -config UART_RXD_PIN_MODE - int - prompt "Choose UART RXD pin mode." - depends on SAMPLE_SUPPORT_UART - default 24 - -config UART_SUPPORT_INT_MODE - bool - prompt "UART support interrupt mode." - depends on SAMPLE_SUPPORT_UART - default n - -config UART_TRANSFER_SIZE - int - prompt "Config UART transfer size." - depends on SAMPLE_SUPPORT_UART - default 64 \ No newline at end of file diff --git a/application/samples/peripheral/uart/uart.code-workspace b/application/samples/peripheral/uart/uart.code-workspace deleted file mode 100755 index 974f6da..0000000 --- a/application/samples/peripheral/uart/uart.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "../../../../" - } - ], - "settings": { - "debug.onTaskErrors": "debugAnyway", - "workspace.samplePath": "./samples/peripheral/uart" - } -} \ No newline at end of file diff --git a/application/samples/peripheral/uart/uart_demo.c b/application/samples/peripheral/uart/uart_demo.c deleted file mode 100755 index ba7a37e..0000000 --- a/application/samples/peripheral/uart/uart_demo.c +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: UART Sample Source. \n - * - * History: \n - * 2023-06-29, Create file. \n - */ -#include "pinctrl.h" -#include "uart.h" -#include "watchdog.h" -#include "soc_osal.h" -#include "app_init.h" -#if defined(CONFIG_UART_SUPPORT_DMA) -#include "dma.h" -#include "hal_dma.h" -#endif - -#define UART_BAUDRATE 115200 -#define CONFIG_UART_INT_WAIT_MS 5 - -#define UART_TASK_PRIO 24 -#define UART_TASK_STACK_SIZE 0x1000 - -static uint8_t g_app_uart_rx_buff[CONFIG_UART_TRANSFER_SIZE] = { 0 }; -#if defined(CONFIG_UART_SUPPORT_INT_MODE) -static uint8_t g_app_uart_int_rx_flag = 0; -static volatile uint8_t g_app_uart_int_index = 0; -static uint8_t g_app_uart_int_rx_buff[CONFIG_UART_TRANSFER_SIZE] = { 0 }; -#endif -static uart_buffer_config_t g_app_uart_buffer_config = { - .rx_buffer = g_app_uart_rx_buff, - .rx_buffer_size = CONFIG_UART_TRANSFER_SIZE -}; - -#if defined(CONFIG_UART_SUPPORT_DMA) -uart_write_dma_config_t g_app_dma_cfg = { - .src_width = HAL_DMA_TRANSFER_WIDTH_8, - .dest_width = HAL_DMA_TRANSFER_WIDTH_8, - .burst_length = HAL_DMA_BURST_TRANSACTION_LENGTH_1, - .priority = HAL_DMA_CH_PRIORITY_0 -}; -#endif - -static void app_uart_init_pin(void) -{ -#if defined(CONFIG_PINCTRL_SUPPORT_IE) - uapi_pin_set_ie(CONFIG_UART_RXD_PIN, PIN_IE_1); -#endif /* CONFIG_PINCTRL_SUPPORT_IE */ - uapi_pin_set_mode(CONFIG_UART_TXD_PIN, CONFIG_UART_TXD_PIN_MODE); - uapi_pin_set_mode(CONFIG_UART_RXD_PIN, CONFIG_UART_RXD_PIN_MODE); -} - -static void app_uart_init_config(void) -{ - uart_attr_t attr = { - .baud_rate = UART_BAUDRATE, - .data_bits = UART_DATA_BIT_8, - .stop_bits = UART_STOP_BIT_1, - .parity = UART_PARITY_NONE - }; - - uart_pin_config_t pin_config = { - .tx_pin = CONFIG_UART_TXD_PIN, - .rx_pin = CONFIG_UART_RXD_PIN, - .cts_pin = PIN_NONE, - .rts_pin = PIN_NONE - }; - -#if defined(CONFIG_UART_SUPPORT_DMA) - uart_extra_attr_t extra_attr = { - .tx_dma_enable = true, - .tx_int_threshold = UART_FIFO_INT_TX_LEVEL_EQ_0_CHARACTER, - .rx_dma_enable = true, - .rx_int_threshold = UART_FIFO_INT_RX_LEVEL_1_CHARACTER - }; - uapi_dma_init(); - uapi_dma_open(); - uapi_uart_deinit(CONFIG_UART_BUS_ID); - uapi_uart_init(CONFIG_UART_BUS_ID, &pin_config, &attr, &extra_attr, &g_app_uart_buffer_config); -#else - uapi_uart_deinit(CONFIG_UART_BUS_ID); - uapi_uart_init(CONFIG_UART_BUS_ID, &pin_config, &attr, NULL, &g_app_uart_buffer_config); -#endif -} - -#if defined(CONFIG_UART_SUPPORT_INT_MODE) -static void app_uart_read_int_handler(const void *buffer, uint16_t length, bool error) -{ - unused(error); - if (buffer == NULL || length == 0) { - osal_printk("uart%d int mode transfer illegal data!\r\n", CONFIG_UART_BUS_ID); - return; - } - - uint8_t *buff = (uint8_t *)buffer; - if (memcpy_s(g_app_uart_rx_buff, length, buff, length) != EOK) { - osal_printk("uart%d int mode data copy fail!\r\n", CONFIG_UART_BUS_ID); - return; - } - if (memcpy_s(g_app_uart_int_rx_buff + g_app_uart_int_index, length, g_app_uart_rx_buff, length) != EOK) { - g_app_uart_int_index = 0; - osal_printk("uart%d int mode data2 copy fail!\r\n", CONFIG_UART_BUS_ID); - } - g_app_uart_int_index += length; - g_app_uart_int_rx_flag = 1; -} - -static void app_uart_write_int_handler(const void *buffer, uint32_t length, const void *params) -{ - unused(params); - uint8_t *buff = (void *)buffer; - for (uint8_t i = 0; i < length; i++) { - osal_printk("uart%d write data[%d] = %d\r\n", CONFIG_UART_BUS_ID, i, buff[i]); - } -} - -static void app_uart_register_rx_callback(void) -{ - osal_printk("uart%d int mode register receive callback start!\r\n", CONFIG_UART_BUS_ID); - if (uapi_uart_register_rx_callback(CONFIG_UART_BUS_ID, UART_RX_CONDITION_FULL_OR_SUFFICIENT_DATA_OR_IDLE, - 1, app_uart_read_int_handler) == ERRCODE_SUCC) { - osal_printk("uart%d int mode register receive callback succ!\r\n", CONFIG_UART_BUS_ID); - } -} -#endif - -static void *uart_task(const char *arg) -{ - unused(arg); -#if defined(CONFIG_UART_SUPPORT_DMA) - int32_t ret = CONFIG_UART_TRANSFER_SIZE; -#if defined(CONFIG_UART_USING_V151) - ret = ERRCODE_SUCC; -#endif -#endif - /* UART pinmux. */ - app_uart_init_pin(); - - /* UART init config. */ - app_uart_init_config(); - -#if defined(CONFIG_UART_SUPPORT_INT_MODE) - app_uart_register_rx_callback(); -#endif - - while (1) { -#if defined(CONFIG_UART_SUPPORT_INT_MODE) - while (g_app_uart_int_rx_flag != 1) { osal_msleep(CONFIG_UART_INT_WAIT_MS); } - g_app_uart_int_rx_flag = 0; - osal_printk("uart%d int mode send back!\r\n", CONFIG_UART_BUS_ID); - if (uapi_uart_write_int(CONFIG_UART_BUS_ID, g_app_uart_int_rx_buff, CONFIG_UART_TRANSFER_SIZE, 0, - app_uart_write_int_handler) == ERRCODE_SUCC) { - osal_printk("uart%d int mode send back succ!\r\n", CONFIG_UART_BUS_ID); - } -#elif defined(CONFIG_UART_SUPPORT_DMA) - osal_printk("uart%d dma mode receive start!\r\n", CONFIG_UART_BUS_ID); - if (uapi_uart_read_by_dma(CONFIG_UART_BUS_ID, g_app_uart_rx_buff, CONFIG_UART_TRANSFER_SIZE, - &g_app_dma_cfg) == ret) { - osal_printk("uart%d dma mode receive succ!\r\n", CONFIG_UART_BUS_ID); - } - osal_printk("uart%d dma mode send back!\r\n", CONFIG_UART_BUS_ID); - if (uapi_uart_write_by_dma(CONFIG_UART_BUS_ID, g_app_uart_rx_buff, CONFIG_UART_TRANSFER_SIZE, - &g_app_dma_cfg) == ret) { - osal_printk("uart%d dma mode send back succ!\r\n", CONFIG_UART_BUS_ID); - } -#else - osal_printk("uart%d poll mode receive start!\r\n", CONFIG_UART_BUS_ID); - (void)uapi_watchdog_kick(); - if (uapi_uart_read(CONFIG_UART_BUS_ID, g_app_uart_rx_buff, CONFIG_UART_TRANSFER_SIZE, - 0) == CONFIG_UART_TRANSFER_SIZE) { - osal_printk("uart%d poll mode receive succ!\r\n", CONFIG_UART_BUS_ID); - } - osal_printk("uart%d poll mode send back!\r\n", CONFIG_UART_BUS_ID); - if (uapi_uart_write(CONFIG_UART_BUS_ID, g_app_uart_rx_buff, CONFIG_UART_TRANSFER_SIZE, - 0) == CONFIG_UART_TRANSFER_SIZE) { - osal_printk("uart%d poll mode send back succ!\r\n", CONFIG_UART_BUS_ID); - } -#endif - } - - return NULL; -} - -static void uart_entry(void) -{ - osal_task *task_handle = NULL; - osal_kthread_lock(); - task_handle = osal_kthread_create((osal_kthread_handler)uart_task, 0, "UartTask", UART_TASK_STACK_SIZE); - if (task_handle != NULL) { - osal_kthread_set_priority(task_handle, UART_TASK_PRIO); - } - osal_kthread_unlock(); -} - -/* Run the uart_entry. */ -app_run(uart_entry); \ No newline at end of file diff --git a/application/samples/peripheral/uflash/CMakeLists.txt b/application/samples/peripheral/uflash/CMakeLists.txt deleted file mode 100755 index d073d85..0000000 --- a/application/samples/peripheral/uflash/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES "${SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/hfuflash_demo.c" PARENT_SCOPE) \ No newline at end of file diff --git a/application/samples/peripheral/uflash/hfuflash_demo.c b/application/samples/peripheral/uflash/hfuflash_demo.c deleted file mode 100755 index c0f7064..0000000 --- a/application/samples/peripheral/uflash/hfuflash_demo.c +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - * - * Description: WDT Sample Source. \n - * - * History: \n - * 2023-06-29, Create file. \n - */ -#include "hsf.h" -#define UFLASH_TASK_STACK_SIZE 0x1000 -USER_FUNC int test_uflash_one_page(uint32_t addr) -{ - static char test_data[4096]; - int i; - - hfuflash_erase_page(addr,1); - memset(test_data, 0, sizeof(test_data)); - hfuflash_read(addr,test_data,4096); - for(i=0;i<4096;i++) - { - if(test_data[i]!=0xFF) - return 1; - } - - memset(test_data,0x55,4096); - hfuflash_write(addr,test_data,4096); - memset(test_data, 0, sizeof(test_data)); - hfuflash_read(addr,test_data,4096); - for(i=0;i<4096;i++) - { - if(test_data[i]!=0x55) - return 2; - } - - memset(test_data,0xAA,4096); - hfuflash_erase_page(addr,1); - hfuflash_write(addr,test_data,4096); - memset(test_data, 0, sizeof(test_data)); - hfuflash_read(addr,test_data,4096); - for(i=0;i<4096;i++) - { - if(test_data[i]!=0xAA) - return 3; - } - return 0; -} - -USER_FUNC int test_uflash(void) -{ - uint32_t addr = 0; - for(addr=0; addrlower_boundary, res->upper_boundary, res->is_human_presence); -} - -// 维测信息依次为: -// 1.告知上层是否需要写入flash -// 2.LNA * 10 + VGA -// 3.原始回波峰值 -// 4.过去period帧的平均MO1底噪 -// 5.过去period帧的平均MO2底噪 -// 6.过去period帧的平均DP底噪 -// 7.过去period帧的平均帧间隔 -// 8.过去period帧中帧间隔超过Xms的帧数 -// 9.过去period帧中bitmap数量超过X门限的帧数 -// 10.过去period帧中bitmap比例超过X门限的帧数 -// 11.过去period帧中是在参与统计的帧数 -// 12.过去period帧中帧间隔最大值 -// 13.过去period帧中帧间隔最大值下标 -// 14.当前所使用的算法参数MO1门限 -// 15.当前所使用的算法参数MO2门限 -// 16.当前所使用的算法参数DP门限 -static void radar_print_dbg_info(int16_t *arr, uint8_t len) -{ - if (len > RADAR_DBG_INFO_LEN || len == 0) { - return; - } - - PRINT("dbg_info: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n", - arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], - arr[11], arr[12], arr[13], arr[14], arr[15]); -} - -static void radar_init_para(void) -{ - radar_dbg_para_t dbg_para; - dbg_para.times = RADAR_DEFAULT_TIMES; - dbg_para.loop = RADAR_DEFAULT_LOOP; - dbg_para.ant = RADAR_DEFAULT_ANT; - dbg_para.wave = RADAR_DEFAULT_WAVE; - dbg_para.dbg_type = RADAR_DEFAULT_DBG_TYPE; - dbg_para.period = RADAR_DEFAULT_PERIOD; - uapi_radar_set_debug_para(&dbg_para); - - radar_sel_para_t sel_para; - sel_para.height = RADAR_HEIGHT_2M; - sel_para.scenario = RADAR_SCENARIO_TYPE_HOME; - sel_para.material = RADAR_MATERIAL_SINGLE; - sel_para.fusion_track = true; - sel_para.fusion_ai = true; - uapi_radar_select_alg_para(&sel_para); - - // 算法门限, 前三个使用tools/bin/radar_tool/radar_para_gen_tool工具标定, 后面五个使用本sample给出的默认值即可 - radar_alg_para_t alg_para; - alg_para.d_th_1m = 32; - alg_para.d_th_2m = 25; - alg_para.p_th = 25; - alg_para.t_th_1m = 13; - alg_para.t_th_2m = 26; - alg_para.b_th_ratio = 20; - alg_para.b_th_cnt = 4; - alg_para.a_th = 70; - uapi_radar_set_alg_para(&alg_para, 0); - - int16_t dly_time = RADAR_QUIT_DELAY_TIME; - uapi_radar_set_delay_time(dly_time); -} - -int radar_demo_init(void *param) -{ - PRINT("[RADAR_SAMPLE] radar_demo_init softap!\r\n"); - - param = param; - radar_start_softap(); - uapi_radar_register_result_cb(radar_print_res); - uapi_radar_register_debug_info_cb(radar_print_dbg_info, RADAR_DBG_INFO_RPT_COEF); - radar_init_para(); - // 启动雷达 - (void)osDelay(WIFI_START_SOFTAP_DELAY); - uapi_radar_set_status(RADAR_STATUS_START); - - for (;;) { - (void)osDelay(RADAR_STATUS_QUERY_DELAY); - uint8_t sts; - uapi_radar_get_status(&sts); - uapi_radar_get_hardware_status(&sts); - uint16_t time; - uapi_radar_get_delay_time(&time); - uint16_t iso; - uapi_radar_get_isolation(&iso); - radar_result_t res = {0}; - uapi_radar_get_result(&res); - int16_t arr[RADAR_DBG_INFO_LEN] = {0}; - uapi_radar_get_debug_info(arr, RADAR_DBG_INFO_LEN); - radar_print_dbg_info(arr, RADAR_DBG_INFO_LEN); - } - - return 0; -} diff --git a/application/samples/radar/sta_sample/CMakeLists.txt b/application/samples/radar/sta_sample/CMakeLists.txt deleted file mode 100755 index f49248d..0000000 --- a/application/samples/radar/sta_sample/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(SOURCES - "${SOURCES}" - "${CMAKE_CURRENT_SOURCE_DIR}/radar_sta_sample.c" - PARENT_SCOPE) - -set(PUBLIC_HEADER - "${PUBLIC_HEADER}" - "${CMAKE_CURRENT_SOURCE_DIR}/../../../include/middleware/services/radar/radar_service.h" - PARENT_SCOPE) diff --git a/application/samples/radar/sta_sample/radar_sta_sample.c b/application/samples/radar/sta_sample/radar_sta_sample.c deleted file mode 100755 index dcc4fc8..0000000 --- a/application/samples/radar/sta_sample/radar_sta_sample.c +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Radar samples function \n - * - */ - -#include "lwip/netifapi.h" -#include "wifi_hotspot.h" -#include "wifi_hotspot_config.h" -#include "td_base.h" -#include "td_type.h" -#include "stdlib.h" -#include "uart.h" -#include "cmsis_os2.h" -#include "soc_osal.h" -#include "radar_service.h" -#include "gpio.h" -#include "pinctrl.h" - -#define WIFI_IFNAME_MAX_SIZE 16 -#define WIFI_MAX_SSID_LEN 33 -#define WIFI_SCAN_AP_LIMIT 64 -#define WIFI_MAC_LEN 6 -#define WIFI_INIT_WAIT_TIME 500 // 5s -#define WIFI_START_STA_DELAY 100 // 1s - -#define RADAR_STATUS_START 1 -#define RADAR_STATUS_QUERY_DELAY 1000 // 10s -#define RADAR_QUIT_DELAY_TIME 12 // 12s - -#define RADAR_DEFAULT_TIMES 0 -#define RADAR_DEFAULT_LOOP 8 -#define RADAR_DEFAULT_ANT 0 -#define RADAR_DEFAULT_PERIOD 5000 -#define RADAR_DEFAULT_DBG_TYPE 3 -#define RADAR_DEFAULT_WAVE 2 - -#define RADAR_API_NO_HUMAN 0 -#define RADAR_API_RANGE_CLOSE 50 -#define RADAR_API_RANGE_NEAR 100 -#define RADAR_API_RANGE_MEDIUM 200 -#define RADAR_API_RANGE_FAR 600 - -#define RADAR_DBG_INFO_RPT_COEF 100 -#define RADAR_DBG_INFO_LEN 16 - -// led档位控制参数 -typedef enum { - RADAR_INSIDE_1M, - RADAR_INSIDE_2M, - RADAR_INSIDE_6M, -} radar_led_gear_t; - -radar_led_gear_t g_radar_led_gear = RADAR_INSIDE_1M; - -/***************************************************************************** - STA 扫描-关联 sample用例 -*****************************************************************************/ -void radar_set_led_gear(radar_led_gear_t gear) -{ - PRINT("[RADAR_SAMPLE] SET LED GEAR:%u!\r\n", gear); - g_radar_led_gear = gear; -} - -static void radar_led_init(void) -{ - // 1. 初始化所有GPIO并设置GPIO的类型 - uapi_gpio_init(); - // 2. 设置GPIO为输出 - errcode_t ret = uapi_gpio_set_dir(GPIO_13, GPIO_DIRECTION_OUTPUT); - if (ret != ERRCODE_SUCC) { - PRINT("[RADAR_SAMPLE] led uapi_gpio_set_dir failed %u!\r\n", ret); - } - // 3. 设置GPIO PIN模式为0,普通模式 - ret = uapi_pin_set_mode(GPIO_13, PIN_MODE_0); - if (ret != ERRCODE_SUCC) { - PRINT("[RADAR_SAMPLE] led uapi_pin_set_mode failed %u!\r\n", ret); - } -} - -static void radar_set_led_on(void) -{ - errcode_t ret = uapi_gpio_set_val(GPIO_13, GPIO_LEVEL_HIGH); - if (ret!= ERRCODE_SUCC) { - PRINT("[RADAR_SAMPLE] led ctrl failed %u!\r\n", ret); - } -} - -static void radar_set_led_off(void) -{ - errcode_t ret = uapi_gpio_set_val(GPIO_13, GPIO_LEVEL_LOW); - if (ret!= ERRCODE_SUCC) { - PRINT("[RADAR_SAMPLE] led ctrl failed %u!\r\n", ret); - } -} - -static void radar_ctrl_led(radar_result_t *res) -{ - switch (g_radar_led_gear) { - case RADAR_INSIDE_1M: - if (res->lower_boundary == 0 && res->upper_boundary == RADAR_API_RANGE_NEAR) { - radar_set_led_on(); - } else { - radar_set_led_off(); - } - break; - case RADAR_INSIDE_2M: - if ((res->lower_boundary == RADAR_API_RANGE_NEAR && - res->upper_boundary == RADAR_API_RANGE_MEDIUM) || - (res->lower_boundary == 0 && res->upper_boundary == RADAR_API_RANGE_NEAR)) { - radar_set_led_on(); - } else { - radar_set_led_off(); - } - break; - default: // 默认6M档位 - if (res->is_human_presence == 1) { - radar_set_led_on(); - } else { - radar_set_led_off(); - } - } -} - -td_s32 radar_start_sta(td_void) -{ - (void)osDelay(WIFI_INIT_WAIT_TIME); /* 500: 延时0.5s, 等待wifi初始化完毕 */ - PRINT("STA try enable.\r\n"); - /* 创建STA接口 */ - if (wifi_sta_enable() != 0) { - PRINT("sta enbale fail !\r\n"); - return -1; - } - - /* 连接成功 */ - PRINT("STA connect success.\r\n"); - return 0; -} - -static void radar_print_res(radar_result_t *res) -{ - PRINT("[RADAR_SAMPLE] lb:%u, hb:%u, hm:%u\r\n", res->lower_boundary, res->upper_boundary, res->is_human_presence); - - radar_ctrl_led(res); -} - -// 维测信息依次为: -// 1.告知上层是否需要写入flash -// 2.LNA * 10 + VGA -// 3.原始回波峰值 -// 4.过去period帧的平均MO1底噪 -// 5.过去period帧的平均MO2底噪 -// 6.过去period帧的平均DP底噪 -// 7.过去period帧的平均帧间隔 -// 8.过去period帧中帧间隔超过Xms的帧数 -// 9.过去period帧中bitmap数量超过X门限的帧数 -// 10.过去period帧中bitmap比例超过X门限的帧数 -// 11.过去period帧中是在参与统计的帧数 -// 12.过去period帧中帧间隔最大值 -// 13.过去period帧中帧间隔最大值下标 -// 14.当前所使用的算法参数MO1门限 -// 15.当前所使用的算法参数MO2门限 -// 16.当前所使用的算法参数DP门限 -static void radar_print_dbg_info(int16_t *arr, uint8_t len) -{ - if (len > RADAR_DBG_INFO_LEN || len == 0) { - return; - } - - PRINT("dbg_info: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n", - arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9], arr[10], - arr[11], arr[12], arr[13], arr[14], arr[15]); -} - -static void radar_init_para(void) -{ - radar_dbg_para_t dbg_para; - dbg_para.times = RADAR_DEFAULT_TIMES; - dbg_para.loop = RADAR_DEFAULT_LOOP; - dbg_para.ant = RADAR_DEFAULT_ANT; - dbg_para.wave = RADAR_DEFAULT_WAVE; - dbg_para.dbg_type = RADAR_DEFAULT_DBG_TYPE; - dbg_para.period = RADAR_DEFAULT_PERIOD; - uapi_radar_set_debug_para(&dbg_para); - - radar_sel_para_t sel_para; - sel_para.height = RADAR_HEIGHT_2M; - sel_para.scenario = RADAR_SCENARIO_TYPE_HOME; - sel_para.material = RADAR_MATERIAL_SINGLE; - sel_para.fusion_track = true; - sel_para.fusion_ai = true; - uapi_radar_select_alg_para(&sel_para); - - // 算法门限, 前三个使用tools/bin/radar_tool/radar_para_gen_tool工具标定, 后面五个使用本sample给出的默认值即可 - radar_alg_para_t alg_para; - alg_para.d_th_1m = 32; - alg_para.d_th_2m = 25; - alg_para.p_th = 25; - alg_para.t_th_1m = 13; - alg_para.t_th_2m = 26; - alg_para.b_th_ratio = 20; - alg_para.b_th_cnt = 4; - alg_para.a_th = 70; - uapi_radar_set_alg_para(&alg_para, 0); - - int16_t dly_time = RADAR_QUIT_DELAY_TIME; - uapi_radar_set_delay_time(dly_time); -} - -int radar_demo_init(void *param) -{ - PRINT("[RADAR_SAMPLE] radar_demo_init sta!\r\n"); - param = param; - radar_led_init(); - radar_start_sta(); - uapi_radar_register_result_cb(radar_print_res); - uapi_radar_register_debug_info_cb(radar_print_dbg_info, RADAR_DBG_INFO_RPT_COEF); - radar_init_para(); - // 启动雷达 - (void)osDelay(WIFI_START_STA_DELAY); - uapi_radar_set_status(RADAR_STATUS_START); - - for (;;) { - (void)osDelay(RADAR_STATUS_QUERY_DELAY); - uint8_t sts; - uapi_radar_get_status(&sts); - uapi_radar_get_hardware_status(&sts); - uint16_t time; - uapi_radar_get_delay_time(&time); - uint16_t iso; - uapi_radar_get_isolation(&iso); - radar_result_t res = {0}; - uapi_radar_get_result(&res); - int16_t arr[RADAR_DBG_INFO_LEN] = {0}; - uapi_radar_get_debug_info(arr, RADAR_DBG_INFO_LEN); - radar_print_dbg_info(arr, RADAR_DBG_INFO_LEN); - } - - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/CMakeLists.txt b/application/samples/wifi/hilink_indie_upgrade/CMakeLists.txt deleted file mode 100755 index 98fd9cc..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. -#=============================================================================== -add_subdirectory_if_exist(address_mapping/application) -add_subdirectory_if_exist(address_mapping/hilinksdk) diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/CMakeLists.txt b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/CMakeLists.txt deleted file mode 100755 index da91a19..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(COMPONENT_NAME "app_addr_map") - -set(CMAKE_HILINK_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}) - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/app_call_entry.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_function_mapping.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_log_manage.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_device_ext.c - - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_ble_cfg_net_api.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_bt_function.c - - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_network_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_socket_adapter.c - - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_custom.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_sle_api.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/uapi_hilink_quick_netcfg_api.c -) - -set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/ -) - -set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/product/ - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/include/ - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/adapter/include/ - - ${CMAKE_CURRENT_SOURCE_DIR}/ - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_uapi/ - ${CMAKE_CURRENT_SOURCE_DIR}/../include/ -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS -) - -set(COMPONENT_CCFLAGS - -Wno-error=logical-op - -Wno-error=sign-compare - -Wno-error=jump-misses-init - -Wno-sign-compare - -Wno-jump-misses-init - -Wno-error=unused-parameter - -Wno-unused-parameter - -Wno-unused-but-set-variable - -Wno-error=unused-variable -) - -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - false -) - -set(LIB_OUT_PATH ${BIN_DIR}/${CHIP}/libs/wifi/${TARGET_COMMAND}) - -build_component() \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.c deleted file mode 100755 index 98d5278..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.c +++ /dev/null @@ -1,87 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: app call entry. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call_entry.h" -#include -#include "app_function_mapping.h" -#include "func_call.h" - -#define BITS_PER_BYTES 8 -#define CRC32_TBL_SIZE 256 - -unsigned int g_crc32_tbl[CRC32_TBL_SIZE] = { 0 }; - -static api_get g_hilink_api_get = NULL; - -static struct hilink_info_stru *g_hilink_info = (struct hilink_info_stru *)&hilink_info_addr; - -void *get_hilink_api_addr(unsigned int index, const char *prototype) -{ - return g_hilink_api_get == NULL ? NULL : g_hilink_api_get(index, prototype); -} - -static void init_crc32_table(void) -{ - for (unsigned int i = 0; i < CRC32_TBL_SIZE; i++) { - unsigned int tmp = i; - for (unsigned char bit = 0; bit < BITS_PER_BYTES; bit++) { - if ((tmp & 1) != 0) { - /* 0xEDB88320 为 CRC32 的生成多项式的反转 */ - tmp = (tmp >> 1) ^ 0xEDB88320; - } else { - tmp = tmp >> 1; - } - } - g_crc32_tbl[i] = tmp; - } -} - -static unsigned int prototype_cal_crc32(const char *input) -{ - unsigned int checksum = 0xFFFFFFFF; - for (unsigned int i = 0; input[i] != 0; i++) { - if (input[i] == ' ') { - continue; - } - checksum = (checksum >> BITS_PER_BYTES) ^ (g_crc32_tbl[(checksum ^ input[i]) & 0xFF]); - } - return ~checksum; -} - -static void *app_api_get(unsigned int index, const char *prototype) -{ - const struct mapping_tbl *app_call_tbl = get_app_mapping_tbl(); - unsigned int size = get_app_mapping_tbl_size(); - if (app_call_tbl == NULL || size == 0) { - return NULL; - } - - unsigned int checksum = prototype_cal_crc32(prototype); - if ((index < size) && (app_call_tbl[index].checksum == checksum)) { - return app_call_tbl[index].addr; - } - /* 对应校验和不匹配,尝试全部匹配 */ - for (unsigned int i = 0; i < size; i++) { - if (app_call_tbl[i].checksum == checksum) { - return app_call_tbl[i].addr; - } - } - return NULL; -} - -void hilink_func_map_init(void) -{ - // printf("%s %d, 0x%x\r\n", __FUNCTION__, __LINE__, g_hilink_info); - - init_crc32_table(); - if (g_hilink_info->entry != NULL) { - // printf("%s %d, 0x%x\r\n", __FUNCTION__, __LINE__, g_hilink_info->entry); - g_hilink_info->entry(&g_hilink_api_get, app_api_get); - } -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.h deleted file mode 100755 index ef93e28..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_call_entry.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: app call entry. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#ifndef APP_CALL_ENTRY_H -#define APP_CALL_ENTRY_H - -#ifdef __cplusplus -extern "C" { -#endif - -void *get_hilink_api_addr(unsigned int index, const char *prototype); -void hilink_func_map_init(void); - -extern char hilink_info_addr; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.c deleted file mode 100755 index 97f16b1..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.c +++ /dev/null @@ -1,417 +0,0 @@ - -#include "app_function_mapping.h" -#include "func_call.h" -#include "func_call_list.h" -#include "hilink_kv_adapter.h" -#include "hilink_mbedtls_utils.h" -#include "hilink_mem_adapter.h" -#include "hilink_network_adapter.h" -#include "hilink_open_ota_adapter.h" -#include "hilink_open_ota_mcu_adapter.h" -#include "hilink_sal_aes.h" -#include "hilink_sal_base64.h" -#include "hilink_sal_defines.h" -#include "hilink_sal_drbg.h" -#include "hilink_sal_kdf.h" -#include "hilink_sal_md.h" -#include "hilink_sal_mpi.h" -#include "hilink_sal_rsa.h" -#include "hilink_socket_adapter.h" -#include "hilink_softap_adapter.h" -#include "hilink_stdio_adapter.h" -#include "hilink_str_adapter.h" -#include "hilink_sys_adapter.h" -#include "hilink_thread_adapter.h" -#include "hilink_time_adapter.h" -#include "hilink_tls_client.h" -#include "hilink_device.h" -#include "ohos_bt_gatt.h" -#include "ohos_bt_def.h" -#include "ohos_bt_gatt_server.h" -#include "hilink_bt_api.h" -#include "hilink_bt_function.h" -#include "ohos_bt_gap.h" -#include "oh_sle_common.h" -#include "oh_sle_connection_manager.h" -#include "oh_sle_device_discovery.h" -#include "oh_sle_ssap_server.h" -#include "hichain.h" -#include "cmsis_os2.h" -#include "cJSON.h" -#include "mbedtls/md.h" -#include "mbedtls/ctr_drbg.h" -#include "mbedtls/bignum.h" -#include "mbedtls/ecdh.h" -#include "mbedtls/hkdf.h" -#include "mbedtls/entropy.h" -#include "mbedtls/sha256.h" -#include "mbedtls/ecp.h" - -static const struct mapping_tbl g_app_call_tbl[APP_CALL_MAX] = { - [APP_CALL_HILINK_KVSTORE_INIT] = { HILINK_KVStoreInit, 0x3A23309A }, - [APP_CALL_HILINK_SET_VALUE] = { HILINK_SetValue, 0xAF0B6921 }, - [APP_CALL_HILINK_GET_VALUE] = { HILINK_GetValue, 0x88B9C567 }, - [APP_CALL_HILINK_DELETE_VALUE] = { HILINK_DeleteValue, 0x55C08452 }, - [APP_CALL_HILINK_GET_FILE_NAME] = { HILINK_GetFileName, 0x23541433 }, - [APP_CALL_HILINK_MALLOC] = { HILINK_Malloc, 0x82C5309A }, - [APP_CALL_HILINK_FREE] = { HILINK_Free, 0x2D3258C3 }, - [APP_CALL_HILINK_MEMCMP] = { HILINK_Memcmp, 0xE6C834A5 }, - [APP_CALL_HILINK_GET_ADDR_INFO] = { HILINK_GetAddrInfo, 0x00B53089 }, - [APP_CALL_HILINK_FREE_ADDR_INFO] = { HILINK_FreeAddrInfo, 0xC7A65C43 }, - [APP_CALL_HILINK_SOCKET] = { HILINK_Socket, 0x392D51DF }, - [APP_CALL_HILINK_CLOSE] = { HILINK_Close, 0xEF32BBC1 }, - [APP_CALL_HILINK_SET_SOCKET_OPT] = { HILINK_SetSocketOpt, 0x25B613C6 }, - [APP_CALL_HILINK_BIND] = { HILINK_Bind, 0xB37656F5 }, - [APP_CALL_HILINK_CONNECT] = { HILINK_Connect, 0x9E142F0D }, - [APP_CALL_HILINK_RECV] = { HILINK_Recv, 0x713AD611 }, - [APP_CALL_HILINK_SEND] = { HILINK_Send, 0x5955749E }, - [APP_CALL_HILINK_RECV_FROM] = { HILINK_RecvFrom, 0x72C53C3B }, - [APP_CALL_HILINK_SEND_TO] = { HILINK_SendTo, 0xA8CD96D2 }, - [APP_CALL_HILINK_SELECT] = { HILINK_Select, 0xC69CB534 }, - [APP_CALL_HILINK_GET_SOCKET_ERRNO] = { HILINK_GetSocketErrno, 0x231411DE }, - [APP_CALL_HILINK_HTONL] = { HILINK_Htonl, 0xAE5C4F17 }, - [APP_CALL_HILINK_NTOHL] = { HILINK_Ntohl, 0x82DA2760 }, - [APP_CALL_HILINK_HTONS] = { HILINK_Htons, 0xBB04E019 }, - [APP_CALL_HILINK_NTOHS] = { HILINK_Ntohs, 0x9813CAC4 }, - [APP_CALL_HILINK_INET_ATON] = { HILINK_InetAton, 0xCBA339BE }, - [APP_CALL_HILINK_INET_ADDR] = { HILINK_InetAddr, 0xBF3D734F }, - [APP_CALL_HILINK_INET_NTOA] = { HILINK_InetNtoa, 0xBF095523 }, - [APP_CALL_HILINK_VPRINTF] = { HILINK_Vprintf, 0x5DD160C0 }, - [APP_CALL_HILINK_RAND] = { HILINK_Rand, 0x387CA4AD }, - [APP_CALL_HILINK_TRNG] = { HILINK_Trng, 0x28BFC876 }, - [APP_CALL_HILINK_STRLEN] = { HILINK_Strlen, 0x6508F627 }, - [APP_CALL_HILINK_STRCHR] = { HILINK_Strchr, 0xD0B46BE4 }, - [APP_CALL_HILINK_STRRCHR] = { HILINK_Strrchr, 0x8319EAC3 }, - [APP_CALL_HILINK_ATOI] = { HILINK_Atoi, 0x71921D27 }, - [APP_CALL_HILINK_STRSTR] = { HILINK_Strstr, 0xD806C9F3 }, - [APP_CALL_HILINK_STRCMP] = { HILINK_Strcmp, 0x464BF4DF }, - [APP_CALL_HILINK_STRNCMP] = { HILINK_Strncmp, 0xBAE09ADB }, - [APP_CALL_HILINK_CREATE_TASK] = { HILINK_CreateTask, 0x95232386 }, - [APP_CALL_HILINK_THREAD_SUSPEND] = { HILINK_ThreadSuspend, 0xB021EEFB }, - [APP_CALL_HILINK_THREAD_RESUME] = { HILINK_ThreadResume, 0xD3FAD2C6 }, - [APP_CALL_HILINK_DELETE_TASK] = { HILINK_DeleteTask, 0xB405A1E9 }, - [APP_CALL_HILINK_GET_CURRENT_TASK_ID] = { HILINK_GetCurrentTaskId, 0xC13BB042 }, - [APP_CALL_HILINK_MUTEX_CREATE] = { HILINK_MutexCreate, 0x0CAB5EF0 }, - [APP_CALL_HILINK_MUTEX_LOCK] = { HILINK_MutexLock, 0x2D3D5430 }, - [APP_CALL_HILINK_MUTEX_UNLOCK] = { HILINK_MutexUnlock, 0x90162EB8 }, - [APP_CALL_HILINK_MUTEX_DESTROY] = { HILINK_MutexDestroy, 0xE51C2E1D }, - [APP_CALL_HILINK_SEM_CREATE] = { HILINK_SemCreate, 0x10F3EE4E }, - [APP_CALL_HILINK_SEM_WAIT] = { HILINK_SemWait, 0xE5FE71A0 }, - [APP_CALL_HILINK_SEM_POST] = { HILINK_SemPost, 0xBA8DF1E9 }, - [APP_CALL_HILINK_SEM_DESTROY] = { HILINK_SemDestroy, 0x5E4A3669 }, - [APP_CALL_HILINK_MILLI_SLEEP] = { HILINK_MilliSleep, 0x4908DDB1 }, - [APP_CALL_HILINK_SCHED_YIELD] = { HILINK_SchedYield, 0x6E08F54B }, - [APP_CALL_HILINK_GET_OS_TIME] = { HILINK_GetOsTime, 0x606E13CA }, - [APP_CALL_HILINK_GET_UTC_TIME] = { HILINK_GetUtcTime, 0xCB530F71 }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_INIT] = { HILINK_OtaAdapterFlashInit, 0x320CC9DF }, - [APP_CALL_HILINK_OTA_ADAPTER_GET_UPDATE_INDEX] = { HILINK_OtaAdapterGetUpdateIndex, 0x6C3DCB70 }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_ERASE] = { HILINK_OtaAdapterFlashErase, 0xDC6E54BD }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_WRITE] = { HILINK_OtaAdapterFlashWrite, 0xA7B3C172 }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_READ] = { HILINK_OtaAdapterFlashRead, 0x0E7ECCB5 }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_FINISH] = { HILINK_OtaAdapterFlashFinish, 0x4E88950C }, - [APP_CALL_HILINK_OTA_ADAPTER_FLASH_MAX_SIZE] = { HILINK_OtaAdapterFlashMaxSize, 0xFC3D4D70 }, - [APP_CALL_HILINK_OTA_ADAPTER_RESTART] = { HILINK_OtaAdapterRestart, 0x0224AB40 }, - [APP_CALL_HILINK_OTA_START_PROCESS] = { HILINK_OtaStartProcess, 0xD9E568A8 }, - [APP_CALL_HILINK_OTA_END_PROCESS] = { HILINK_OtaEndProcess, 0x95713870 }, - [APP_CALL_HILINK_GET_REBOOT_FLAG] = { HILINK_GetRebootFlag, 0x53E9BB3D }, - [APP_CALL_HILINK_GET_MCU_VERSION] = { HILINK_GetMcuVersion, 0x77889DAA }, - [APP_CALL_HILINK_NOTIFY_OTA_STATUS] = { HILINK_NotifyOtaStatus, 0x102DB1FC }, - [APP_CALL_HILINK_NOTIFY_OTA_DATA] = { HILINK_NotifyOtaData, 0x4CE38751 }, - [APP_CALL_HILINK_RESTART] = { HILINK_Restart, 0xF2E6A0BD }, - [APP_CALL_HILINK_GET_SYSTEM_BOOT_REASON] = { HILINK_GetSystemBootReason, 0x27B0EC51 }, - [APP_CALL_HILINK_SAL_RSA_INIT] = { HILINK_SAL_RsaInit, 0xB8EA015C }, - [APP_CALL_HILINK_SAL_RSA_FREE] = { HILINK_SAL_RsaFree, 0xE0E475AD }, - [APP_CALL_HILINK_SAL_RSA_PARAM_IMPORT] = { HILINK_SAL_RsaParamImport, 0xF3E3CDB4 }, - [APP_CALL_HILINK_RSA_PKCS1_VERIFY] = { HILINK_RsaPkcs1Verify, 0x9580E84E }, - [APP_CALL_HILINK_RSA_PKCS1_DECRYPT] = { HILINK_RsaPkcs1Decrypt, 0x228803A6 }, - [APP_CALL_HILINK_RSA_PKCS1_ENCRYPT] = { HILINK_RsaPkcs1Encrypt, 0x91F39D95 }, - [APP_CALL_HILINK_TLS_CLIENT_CREATE] = { HILINK_TlsClientCreate, 0x8D3F28B0 }, - [APP_CALL_HILINK_SET_TLS_CLIENT_OPTION] = { HILINK_SetTlsClientOption, 0xE4D53C67 }, - [APP_CALL_HILINK_TLS_CLIENT_CONNECT] = { HILINK_TlsClientConnect, 0x0A27B5AB }, - [APP_CALL_HILINK_TLS_CLIENT_GET_CONTEXT_FD] = { HILINK_TlsClientGetContextFd, 0x436D11F8 }, - [APP_CALL_HILINK_TLS_CLIENT_READ] = { HILINK_TlsClientRead, 0x3A8AAEB6 }, - [APP_CALL_HILINK_TLS_CLIENT_WRITE] = { HILINK_TlsClientWrite, 0x538628D3 }, - [APP_CALL_HILINK_TLS_CLIENT_IS_VALID_CERT] = { HILINK_TlsClientIsValidCert, 0x2F674C39 }, - [APP_CALL_HILINK_TLS_CLIENT_FREE_RESOURCE] = { HILINK_TlsClientFreeResource, 0x8B6CF1C2 }, - [APP_CALL_HILINK_SAL_AES_GCM_ENCRYPT] = { HILINK_SAL_AesGcmEncrypt, 0x95BAB949 }, - [APP_CALL_HILINK_SAL_AES_GCM_DECRYPT] = { HILINK_SAL_AesGcmDecrypt, 0x9E19EA99 }, - [APP_CALL_HILINK_SAL_ADD_PADDING] = { HILINK_SAL_AddPadding, 0x3B11D075 }, - [APP_CALL_HILINK_SAL_GET_PADDING] = { HILINK_SAL_GetPadding, 0x24E025EF }, - [APP_CALL_HILINK_SAL_AES_CBC_ENCRYPT] = { HILINK_SAL_AesCbcEncrypt, 0x6FF88F42 }, - [APP_CALL_HILINK_SAL_AES_CBC_DECRYPT] = { HILINK_SAL_AesCbcDecrypt, 0x331C3BE3 }, - [APP_CALL_HILINK_SAL_AES_CCM_DECRYPT] = { HILINK_SAL_AesCcmDecrypt, 0x6689468D }, - [APP_CALL_HILINK_SAL_AES_CCM_ENCRYPT] = { HILINK_SAL_AesCcmEncrypt, 0xAF74C6B8 }, - [APP_CALL_HILINK_SAL_BASE64_ENCODE] = { HILINK_SAL_Base64Encode, 0x11187E2D }, - [APP_CALL_HILINK_SAL_BASE64_DECODE] = { HILINK_SAL_Base64Decode, 0x7953251B }, - [APP_CALL_HILINK_SAL_DRBG_INIT] = { HILINK_SAL_DrbgInit, 0x9228B8A8 }, - [APP_CALL_HILINK_SAL_DRBG_DEINIT] = { HILINK_SAL_DrbgDeinit, 0xC32422F9 }, - [APP_CALL_HILINK_SAL_DRBG_RANDOM] = { HILINK_SAL_DrbgRandom, 0x7C012233 }, - [APP_CALL_HILINK_SAL_HKDF] = { HILINK_SAL_Hkdf, 0x2BB295C1 }, - [APP_CALL_HILINK_SAL_PKCS5_PBKDF2_HMAC] = { HILINK_SAL_Pkcs5Pbkdf2Hmac, 0x10F36291 }, - [APP_CALL_HILINK_SAL_MD_CALC] = { HILINK_SAL_MdCalc, 0xA845CD2F }, - [APP_CALL_HILINK_SAL_HMAC_CALC] = { HILINK_SAL_HmacCalc, 0xA2D6BC34 }, - [APP_CALL_HILINK_SAL_MD_INIT] = { HILINK_SAL_MdInit, 0xE37B7CBE }, - [APP_CALL_HILINK_SAL_MD_UPDATE] = { HILINK_SAL_MdUpdate, 0x23083067 }, - [APP_CALL_HILINK_SAL_MD_FINISH] = { HILINK_SAL_MdFinish, 0xAE8AF934 }, - [APP_CALL_HILINK_SAL_MD_FREE] = { HILINK_SAL_MdFree, 0x6DEEEFCC }, - [APP_CALL_HILINK_SAL_MPI_INIT] = { HILINK_SAL_MpiInit, 0x168D2D46 }, - [APP_CALL_HILINK_SAL_MPI_FREE] = { HILINK_SAL_MpiFree, 0x58A94AB5 }, - [APP_CALL_HILINK_SAL_MPI_EXP_MOD] = { HILINK_SAL_MpiExpMod, 0x049858C1 }, - [APP_CALL_HILINK_SAL_MPI_CMP_INT] = { HILINK_SAL_MpiCmpInt, 0x1E8BE467 }, - [APP_CALL_HILINK_SAL_MPI_SUB_INT] = { HILINK_SAL_MpiSubInt, 0x2F492DE9 }, - [APP_CALL_HILINK_SAL_MPI_CMP_MPI] = { HILINK_SAL_MpiCmpMpi, 0xB4046E4B }, - [APP_CALL_HILINK_SAL_MPI_READ_STRING] = { HILINK_SAL_MpiReadString, 0x0EEEA5E3 }, - [APP_CALL_HILINK_SAL_MPI_WRITE_STRING] = { HILINK_SAL_MpiWriteString, 0xD6FE8809 }, - [APP_CALL_HILINK_SAL_MPI_READ_BINARY] = { HILINK_SAL_MpiReadBinary, 0x743B2B61 }, - [APP_CALL_HILINK_SAL_MPI_WRITE_BINARY] = { HILINK_SAL_MpiWriteBinary, 0x11718F20 }, - [APP_CALL_HILINK_GET_LOCAL_IP] = { HILINK_GetLocalIp, 0x38742D7C }, - [APP_CALL_HILINK_GET_MAC_ADDR] = { HILINK_GetMacAddr, 0x48EE81BB }, - [APP_CALL_HILINK_GET_WI_FI_SSID] = { HILINK_GetWiFiSsid, 0xD5D48537 }, - [APP_CALL_HILINK_SET_WI_FI_INFO] = { HILINK_SetWiFiInfo, 0x3D34C708 }, - [APP_CALL_HILINK_RECONNECT_WI_FI] = { HILINK_ReconnectWiFi, 0x68622D32 }, - [APP_CALL_HILINK_CONNECT_WI_FI] = { HILINK_ConnectWiFi, 0x33179ADE }, - [APP_CALL_HILINK_GET_NETWORK_STATE] = { HILINK_GetNetworkState, 0xD3E8C502 }, - [APP_CALL_HILINK_GET_WI_FI_BSSID] = { HILINK_GetWiFiBssid, 0x6A2217F6 }, - [APP_CALL_HILINK_GET_WI_FI_RSSI] = { HILINK_GetWiFiRssi, 0x938E85AA }, - [APP_CALL_HILINK_START_SOFT_AP] = { HILINK_StartSoftAp, 0x7A6754CE }, - [APP_CALL_HILINK_STOP_SOFT_AP] = { HILINK_StopSoftAp, 0x869A8127 }, - [APP_CALL_HILINK_GET_DEV_INFO] = { HILINK_GetDevInfo, 0x656D364C }, - [APP_CALL_HILINK_GET_SVC_INFO] = { HILINK_GetSvcInfo, 0x00F05E95 }, - [APP_CALL_HILINK_GET_AUTO_AC] = { HILINK_GetAutoAc, 0xFE7738AD }, - [APP_CALL_HILINK_PUT_CHAR_STATE] = { HILINK_PutCharState, 0x05E79CAC }, - [APP_CALL_HILINK_CONTROL_CHAR_STATE] = { HILINK_ControlCharState, 0xA11368FA }, - [APP_CALL_HILINK_GET_CHAR_STATE] = { HILINK_GetCharState, 0xE6717C71 }, - [APP_CALL_HILINK_GET_PIN_CODE] = { HILINK_GetPinCode, 0xC469FC93 }, - [APP_CALL_HILINK_NOTIFY_DEV_STATUS] = { HILINK_NotifyDevStatus, 0x4FF22195 }, - [APP_CALL_HILINK_PROCESS_BEFORE_RESTART] = { HILINK_ProcessBeforeRestart, 0x3E9F7CA3 }, - [APP_CALL_REGISTE_LOG] = { registe_log, 0x01D52266 }, - [APP_CALL_GET_INSTANCE] = { get_instance, 0xEA04E818 }, - [APP_CALL_DESTROY] = { destroy, 0x4A6D5AF6 }, - [APP_CALL_SET_CONTEXT] = { set_context, 0x6621F901 }, - [APP_CALL_RECEIVE_DATA] = { receive_data, 0x39D0642D }, - [APP_CALL_RECEIVE_DATA_WITH_JSON_OBJECT] = { receive_data_with_json_object, 0x0350FA3F }, - [APP_CALL_INIT_CENTER] = { init_center, 0x28ED49CF }, - [APP_CALL_START_PAKE] = { start_pake, 0x23AC20D0 }, - [APP_CALL_AUTHENTICATE_PEER] = { authenticate_peer, 0x3710992F }, - [APP_CALL_DELETE_LOCAL_AUTH_INFO] = { delete_local_auth_info, 0xBE7E3DBC }, - [APP_CALL_IMPORT_AUTH_INFO] = { import_auth_info, 0xEBD73738 }, - [APP_CALL_ADD_AUTH_INFO] = { add_auth_info, 0x5AE906D8 }, - [APP_CALL_REMOVE_AUTH_INFO] = { remove_auth_info, 0xD885A611 }, - [APP_CALL_IS_TRUST_PEER] = { is_trust_peer, 0x8F2416A4 }, - [APP_CALL_LIST_TRUST_PEERS] = { list_trust_peers, 0x5FFA93EC }, - [APP_CALL_SET_SELF_AUTH_ID] = { set_self_auth_id, 0x3483EDAD }, - [APP_CALL_GET_LOCAL_ADDRESS] = { GetLocalAddress, 0xE5864419 }, - [APP_CALL_GET_LOCAL_NAME] = { GetLocalName, 0xC4516893 }, - [APP_CALL_SET_LOCAL_NAME] = { SetLocalName, 0x82274A6D }, - [APP_CALL_BLUETOOTH_FACTORY_RESET] = { BluetoothFactoryReset, 0xEC6FD673 }, - [APP_CALL_GET_BT_SCAN_MODE] = { GetBtScanMode, 0x4D397519 }, - [APP_CALL_SET_BT_SCAN_MODE] = { SetBtScanMode, 0x9C9FFB56 }, - [APP_CALL_READ_BT_MAC_ADDR] = { ReadBtMacAddr, 0x1202FEAB }, - [APP_CALL_GET_PARIED_DEVICES_NUM] = { GetPariedDevicesNum, 0x34F195D5 }, - [APP_CALL_GET_PAIR_STATE] = { GetPairState, 0x95E791C4 }, - [APP_CALL_REMOVE_PAIR] = { RemovePair, 0x3315669E }, - [APP_CALL_REMOVE_ALL_PAIRS] = { RemoveAllPairs, 0x430FB9E7 }, - [APP_CALL_READ_REMOTE_RSSI_VALUE] = { ReadRemoteRssiValue, 0x288EF87B }, - [APP_CALL_IS_ACL_CONNECTED] = { IsAclConnected, 0xC4498A4D }, - [APP_CALL_DISCONNECT_REMOTE_DEVICE] = { DisconnectRemoteDevice, 0xF1A93918 }, - [APP_CALL_CONNECT_REMOTE_DEVICE] = { ConnectRemoteDevice, 0xFA7C7805 }, - [APP_CALL_INIT_BT_STACK] = { InitBtStack, 0xF7131CCF }, - [APP_CALL_ENABLE_BT_STACK] = { EnableBtStack, 0x092F762F }, - [APP_CALL_DISABLE_BT_STACK] = { DisableBtStack, 0x28C0A502 }, - [APP_CALL_SET_DEVICE_NAME] = { SetDeviceName, 0xEC955661 }, - [APP_CALL_BLE_SET_ADV_DATA] = { BleSetAdvData, 0xD19C624C }, - [APP_CALL_BLE_START_ADV] = { BleStartAdv, 0xD0B61E88 }, - [APP_CALL_BLE_STOP_ADV] = { BleStopAdv, 0xF81F9D57 }, - [APP_CALL_BLE_UPDATE_ADV] = { BleUpdateAdv, 0x108A971D }, - [APP_CALL_BLE_SET_SECURITY_IO_CAP] = { BleSetSecurityIoCap, 0x268273CE }, - [APP_CALL_BLE_SET_SECURITY_AUTH_REQ] = { BleSetSecurityAuthReq, 0xABEE8013 }, - [APP_CALL_BLE_GATT_SECURITY_RSP] = { BleGattSecurityRsp, 0xFF69661C }, - [APP_CALL_BLE_SCAN_FILTER_PARAM_SETUP] = { BleScanFilterParamSetup, 0x1A29BBD9 }, - [APP_CALL_BLE_SCAN_FILTER_ADD_REMOVE] = { BleScanFilterAddRemove, 0x95111C6A }, - [APP_CALL_BLE_SCAN_FILTER_CLEAR] = { BleScanFilterClear, 0x64314013 }, - [APP_CALL_BLE_SCAN_FILTER_ENABLE] = { BleScanFilterEnable, 0xFBA647F7 }, - [APP_CALL_BLE_SET_SCAN_PARAMETERS] = { BleSetScanParameters, 0x7B736AE8 }, - [APP_CALL_BLE_START_SCAN] = { BleStartScan, 0xE330F3D7 }, - [APP_CALL_BLE_STOP_SCAN] = { BleStopScan, 0x157E6C37 }, - [APP_CALL_BLE_GATT_REGISTER_CALLBACKS] = { BleGattRegisterCallbacks, 0x74AFBCC3 }, - [APP_CALL_BLE_START_ADV_EX] = { BleStartAdvEx, 0x8D643C71 }, - [APP_CALL_BLE_GATTS_REGISTER] = { BleGattsRegister, 0x08363127 }, - [APP_CALL_BLE_GATTS_UN_REGISTER] = { BleGattsUnRegister, 0xCB03B902 }, - [APP_CALL_BLE_GATTS_DISCONNECT] = { BleGattsDisconnect, 0xC6D32C20 }, - [APP_CALL_BLE_GATTS_ADD_SERVICE] = { BleGattsAddService, 0x2A73EE70 }, - [APP_CALL_BLE_GATTS_ADD_CHARACTERISTIC] = { BleGattsAddCharacteristic, 0x99A65902 }, - [APP_CALL_BLE_GATTS_ADD_DESCRIPTOR] = { BleGattsAddDescriptor, 0xA14959BA }, - [APP_CALL_BLE_GATTS_START_SERVICE] = { BleGattsStartService, 0x60D70D05 }, - [APP_CALL_BLE_GATTS_STOP_SERVICE] = { BleGattsStopService, 0x5A89A6C3 }, - [APP_CALL_BLE_GATTS_DELETE_SERVICE] = { BleGattsDeleteService, 0xE489489F }, - [APP_CALL_BLE_GATTS_CLEAR_SERVICES] = { BleGattsClearServices, 0x355E418A }, - [APP_CALL_BLE_GATTS_SEND_RESPONSE] = { BleGattsSendResponse, 0x02EF8A54 }, - [APP_CALL_BLE_GATTS_SEND_INDICATION] = { BleGattsSendIndication, 0x3D8DF826 }, - [APP_CALL_BLE_GATTS_SET_ENCRYPTION] = { BleGattsSetEncryption, 0xC59AD8FA }, - [APP_CALL_BLE_GATTS_REGISTER_CALLBACKS] = { BleGattsRegisterCallbacks, 0xBD1564AF }, - [APP_CALL_BLE_GATTS_START_SERVICE_EX] = { BleGattsStartServiceEx, 0x4FEE6224 }, - [APP_CALL_BLE_GATTS_STOP_SERVICE_EX] = { BleGattsStopServiceEx, 0xFCA67974 }, - [APP_CALL_HILINK_GET_DEVICE_SN] = { HILINK_GetDeviceSn, 0xF6F63E17 }, - [APP_CALL_HILINK_GET_SUB_PROD_ID] = { HILINK_GetSubProdId, 0xD3036A50 }, - [APP_CALL_HILINK_BT_GET_DEV_SURFACE_POWER] = { HILINK_BT_GetDevSurfacePower, 0x120E5449 }, - [APP_CALL_HILINK_BT_GET_DEV_INFO] = { HILINK_BT_GetDevInfo, 0x669A4D79 }, - [APP_CALL_HILINK_GET_CUSTOM_INFO] = { HILINK_GetCustomInfo, 0x2E919F88 }, - [APP_CALL_HILINK_GET_MANU_ID] = { HILINK_GetManuId, 0xC4BBEEC6 }, - [APP_CALL_HILINK_BT_GET_MAC_ADDR] = { HILINK_BT_GetMacAddr, 0x4E542216 }, - [APP_CALL_GET_DEVICE_VERSION] = { getDeviceVersion, 0xD35ED1DE }, - [APP_CALL_OS_KERNEL_GET_TICK_COUNT] = { osKernelGetTickCount, 0x5A21434F }, - [APP_CALL_OS_KERNEL_GET_TICK_FREQ] = { osKernelGetTickFreq, 0xC521776D }, - [APP_CALL_OS_DELAY] = { osDelay, 0x37F5C502 }, - [APP_CALL_OS_THREAD_NEW] = { osThreadNew, 0x57B639AA }, - [APP_CALL_OS_THREAD_TERMINATE] = { osThreadTerminate, 0x3F47D1CC }, - [APP_CALL_OS_THREAD_GET_ID] = { osThreadGetId, 0x1888A199 }, - [APP_CALL_OS_MUTEX_NEW] = { osMutexNew, 0x61CD6F5D }, - [APP_CALL_OS_MUTEX_DELETE] = { osMutexDelete, 0x7C9BEF30 }, - [APP_CALL_OS_MUTEX_ACQUIRE] = { osMutexAcquire, 0xD5EACE78 }, - [APP_CALL_OS_MUTEX_RELEASE] = { osMutexRelease, 0x5DB24268 }, - [APP_CALL_OS_SEMAPHORE_NEW] = { osSemaphoreNew, 0xE3605815 }, - [APP_CALL_OS_SEMAPHORE_ACQUIRE] = { osSemaphoreAcquire, 0x33F98458 }, - [APP_CALL_OS_SEMAPHORE_RELEASE] = { osSemaphoreRelease, 0x376DD1E7 }, - [APP_CALL_OS_SEMAPHORE_DELETE] = { osSemaphoreDelete, 0x70BF3612 }, - [APP_CALL_OS_THREAD_SUSPEND] = { osThreadSuspend, 0xB6D1F9C6 }, - [APP_CALL_OS_THREAD_RESUME] = { osThreadResume, 0x2395F48B }, - [APP_CALL_MALLOC] = { malloc, 0xEDE23AE1 }, - [APP_CALL_FREE] = { free, 0x514E24C7 }, - [APP_CALL_SLE_DISCONNECT_REMOTE_DEVICE] = { SleDisconnectRemoteDevice, 0x9360CE44 }, - [APP_CALL_SLE_CONNECTION_REGISTER_CALLBACKS] = { SleConnectionRegisterCallbacks, 0x291140AF }, - [APP_CALL_ENABLE_SLE] = { EnableSle, 0xEC557650 }, - [APP_CALL_DISABLE_SLE] = { DisableSle, 0x3E6EBBC1 }, - [APP_CALL_SLE_GET_LOCAL_ADDR] = { SleGetLocalAddr, 0xD453DC9E }, - [APP_CALL_SLE_SET_LOCAL_NAME] = { SleSetLocalName, 0xD772F6AA }, - [APP_CALL_SLE_SET_ANNOUNCE_DATA] = { SleSetAnnounceData, 0x506112D2 }, - [APP_CALL_SLE_SET_ANNOUNCE_PARAM] = { SleSetAnnounceParam, 0x6C5B806E }, - [APP_CALL_SLE_START_ANNOUNCE] = { SleStartAnnounce, 0xC4E0EAEC }, - [APP_CALL_SLE_STOP_ANNOUNCE] = { SleStopAnnounce, 0x6A98F6F1 }, - [APP_CALL_SLE_ANNOUNCE_SEEK_REGISTER_CALLBACKS] = { SleAnnounceSeekRegisterCallbacks, 0x683AC864 }, - [APP_CALL_SSAPS_REGISTER_SERVER] = { ssapsRegisterServer, 0x94FA565B }, - [APP_CALL_SSAPS_ADD_SERVICE_SYNC] = { SsapsAddServiceSync, 0x7CE2A054 }, - [APP_CALL_SSAPS_ADD_PROPERTY_SYNC] = { SsapsAddPropertySync, 0x0F45AC6A }, - [APP_CALL_SSAPS_ADD_DESCRIPTOR_SYNC] = { SsapsAddDescriptorSync, 0x8A556CDE }, - [APP_CALL_SSAPS_START_SERVICE] = { SsapsStartService, 0xE96B315E }, - [APP_CALL_SSAPS_DELETE_ALL_SERVICES] = { SsapsDeleteAllServices, 0xF45ED456 }, - [APP_CALL_SSAPS_SEND_RESPONSE] = { SsapsSendResponse, 0xEF46F1E5 }, - [APP_CALL_SSAPS_NOTIFY_INDICATE] = { SsapsNotifyIndicate, 0xC234ABF9 }, - [APP_CALL_SSAPS_REGISTER_CALLBACKS] = { SsapsRegisterCallbacks, 0x2B121CCE }, - [APP_CALL_C_JSON_VERSION] = { cJSON_Version, 0x688D2163 }, - [APP_CALL_C_JSON_INIT_HOOKS] = { cJSON_InitHooks, 0xBDF57FB6 }, - [APP_CALL_C_JSON_PARSE] = { cJSON_Parse, 0x098B4742 }, - [APP_CALL_C_JSON_PARSE_WITH_LENGTH] = { cJSON_ParseWithLength, 0xFBC504AC }, - [APP_CALL_C_JSON_PARSE_WITH_OPTS] = { cJSON_ParseWithOpts, 0x5E03230A }, - [APP_CALL_C_JSON_PARSE_WITH_LENGTH_OPTS] = { cJSON_ParseWithLengthOpts, 0xDF90428D }, - [APP_CALL_C_JSON_PRINT] = { cJSON_Print, 0x53F024F9 }, - [APP_CALL_C_JSON_PRINT_UNFORMATTED] = { cJSON_PrintUnformatted, 0xC20964CA }, - [APP_CALL_C_JSON_PRINT_BUFFERED] = { cJSON_PrintBuffered, 0x8AEA8A90 }, - [APP_CALL_C_JSON_PRINT_PREALLOCATED] = { cJSON_PrintPreallocated, 0x42D1CEF0 }, - [APP_CALL_C_JSON_DELETE] = { cJSON_Delete, 0xA2BA9C88 }, - [APP_CALL_C_JSON_GET_ARRAY_SIZE] = { cJSON_GetArraySize, 0xA011C100 }, - [APP_CALL_C_JSON_GET_ARRAY_ITEM] = { cJSON_GetArrayItem, 0x4A9B8F7F }, - [APP_CALL_C_JSON_GET_OBJECT_ITEM] = { cJSON_GetObjectItem, 0x9EBEDA36 }, - [APP_CALL_C_JSON_GET_OBJECT_ITEM_CASE_SENSITIVE] = { cJSON_GetObjectItemCaseSensitive, 0x5056947E }, - [APP_CALL_C_JSON_HAS_OBJECT_ITEM] = { cJSON_HasObjectItem, 0x9426D868 }, - [APP_CALL_C_JSON_GET_ERROR_PTR] = { cJSON_GetErrorPtr, 0x829904D7 }, - [APP_CALL_C_JSON_GET_STRING_VALUE] = { cJSON_GetStringValue, 0x0DA74B72 }, - [APP_CALL_C_JSON_GET_NUMBER_VALUE] = { cJSON_GetNumberValue, 0x76D93829 }, - [APP_CALL_C_JSON_IS_INVALID] = { cJSON_IsInvalid, 0xD151333F }, - [APP_CALL_C_JSON_IS_FALSE] = { cJSON_IsFalse, 0x3506E830 }, - [APP_CALL_C_JSON_IS_TRUE] = { cJSON_IsTrue, 0x32A8CF68 }, - [APP_CALL_C_JSON_IS_BOOL] = { cJSON_IsBool, 0x630BD5D0 }, - [APP_CALL_C_JSON_IS_NULL] = { cJSON_IsNull, 0xA39237FD }, - [APP_CALL_C_JSON_IS_NUMBER] = { cJSON_IsNumber, 0xF0BADD13 }, - [APP_CALL_C_JSON_IS_STRING] = { cJSON_IsString, 0x1AB77B60 }, - [APP_CALL_C_JSON_IS_ARRAY] = { cJSON_IsArray, 0x92987F07 }, - [APP_CALL_C_JSON_IS_OBJECT] = { cJSON_IsObject, 0x13958808 }, - [APP_CALL_C_JSON_IS_RAW] = { cJSON_IsRaw, 0x1D140EB2 }, - [APP_CALL_C_JSON_CREATE_NULL] = { cJSON_CreateNull, 0xA0CA25BF }, - [APP_CALL_C_JSON_CREATE_TRUE] = { cJSON_CreateTrue, 0x9267FBC8 }, - [APP_CALL_C_JSON_CREATE_FALSE] = { cJSON_CreateFalse, 0x09457528 }, - [APP_CALL_C_JSON_CREATE_BOOL] = { cJSON_CreateBool, 0xA7C5DFA1 }, - [APP_CALL_C_JSON_CREATE_NUMBER] = { cJSON_CreateNumber, 0x729552A8 }, - [APP_CALL_C_JSON_CREATE_STRING] = { cJSON_CreateString, 0xD76B3362 }, - [APP_CALL_C_JSON_CREATE_RAW] = { cJSON_CreateRaw, 0xB9915E84 }, - [APP_CALL_C_JSON_CREATE_ARRAY] = { cJSON_CreateArray, 0x795CD770 }, - [APP_CALL_C_JSON_CREATE_OBJECT] = { cJSON_CreateObject, 0xEB84A3AE }, - [APP_CALL_C_JSON_CREATE_STRING_REFERENCE] = { cJSON_CreateStringReference, 0x73DE78F0 }, - [APP_CALL_C_JSON_CREATE_OBJECT_REFERENCE] = { cJSON_CreateObjectReference, 0x4D37E8FC }, - [APP_CALL_C_JSON_CREATE_ARRAY_REFERENCE] = { cJSON_CreateArrayReference, 0x2F53E2F7 }, - [APP_CALL_C_JSON_CREATE_INT_ARRAY] = { cJSON_CreateIntArray, 0x2853D57F }, - [APP_CALL_C_JSON_CREATE_FLOAT_ARRAY] = { cJSON_CreateFloatArray, 0x170FC255 }, - [APP_CALL_C_JSON_CREATE_DOUBLE_ARRAY] = { cJSON_CreateDoubleArray, 0x1F7CBBB9 }, - [APP_CALL_C_JSON_CREATE_STRING_ARRAY] = { cJSON_CreateStringArray, 0xB63D119A }, - [APP_CALL_C_JSON_ADD_ITEM_TO_ARRAY] = { cJSON_AddItemToArray, 0xC4775120 }, - [APP_CALL_C_JSON_ADD_ITEM_TO_OBJECT] = { cJSON_AddItemToObject, 0x418F3865 }, - [APP_CALL_C_JSON_ADD_ITEM_TO_OBJECT_CS] = { cJSON_AddItemToObjectCS, 0x792FEFAA }, - [APP_CALL_C_JSON_ADD_ITEM_REFERENCE_TO_ARRAY] = { cJSON_AddItemReferenceToArray, 0xFF69038B }, - [APP_CALL_C_JSON_ADD_ITEM_REFERENCE_TO_OBJECT] = { cJSON_AddItemReferenceToObject, 0xFD3AA3C2 }, - [APP_CALL_C_JSON_DETACH_ITEM_VIA_POINTER] = { cJSON_DetachItemViaPointer, 0xC476B26D }, - [APP_CALL_C_JSON_DETACH_ITEM_FROM_ARRAY] = { cJSON_DetachItemFromArray, 0xFB2B48F3 }, - [APP_CALL_C_JSON_DELETE_ITEM_FROM_ARRAY] = { cJSON_DeleteItemFromArray, 0xB3904203 }, - [APP_CALL_C_JSON_DETACH_ITEM_FROM_OBJECT] = { cJSON_DetachItemFromObject, 0xC394782F }, - [APP_CALL_C_JSON_DETACH_ITEM_FROM_OBJECT_CASE_SENSITIVE] = { cJSON_DetachItemFromObjectCaseSensitive, 0xE1C40F71 }, - [APP_CALL_C_JSON_DELETE_ITEM_FROM_OBJECT] = { cJSON_DeleteItemFromObject, 0x8001C315 }, - [APP_CALL_C_JSON_DELETE_ITEM_FROM_OBJECT_CASE_SENSITIVE] = { cJSON_DeleteItemFromObjectCaseSensitive, 0x04539827 }, - [APP_CALL_C_JSON_INSERT_ITEM_IN_ARRAY] = { cJSON_InsertItemInArray, 0xDDC80900 }, - [APP_CALL_C_JSON_REPLACE_ITEM_VIA_POINTER] = { cJSON_ReplaceItemViaPointer, 0x966524DC }, - [APP_CALL_C_JSON_REPLACE_ITEM_IN_ARRAY] = { cJSON_ReplaceItemInArray, 0xE965006F }, - [APP_CALL_C_JSON_REPLACE_ITEM_IN_OBJECT] = { cJSON_ReplaceItemInObject, 0x86EBDA9C }, - [APP_CALL_C_JSON_REPLACE_ITEM_IN_OBJECT_CASE_SENSITIVE] = { cJSON_ReplaceItemInObjectCaseSensitive, 0x46226BC1 }, - [APP_CALL_C_JSON_DUPLICATE] = { cJSON_Duplicate, 0xDA2387E2 }, - [APP_CALL_C_JSON_COMPARE] = { cJSON_Compare, 0xAE9565DF }, - [APP_CALL_C_JSON_MINIFY] = { cJSON_Minify, 0xEE621F0D }, - [APP_CALL_C_JSON_ADD_NULL_TO_OBJECT] = { cJSON_AddNullToObject, 0xA9362983 }, - [APP_CALL_C_JSON_ADD_TRUE_TO_OBJECT] = { cJSON_AddTrueToObject, 0x71D1AD83 }, - [APP_CALL_C_JSON_ADD_FALSE_TO_OBJECT] = { cJSON_AddFalseToObject, 0x860B4E60 }, - [APP_CALL_C_JSON_ADD_BOOL_TO_OBJECT] = { cJSON_AddBoolToObject, 0x7BB473E4 }, - [APP_CALL_C_JSON_ADD_NUMBER_TO_OBJECT] = { cJSON_AddNumberToObject, 0x103ADF87 }, - [APP_CALL_C_JSON_ADD_STRING_TO_OBJECT] = { cJSON_AddStringToObject, 0x2D1A3CA9 }, - [APP_CALL_C_JSON_ADD_RAW_TO_OBJECT] = { cJSON_AddRawToObject, 0xEB171CF7 }, - [APP_CALL_C_JSON_ADD_OBJECT_TO_OBJECT] = { cJSON_AddObjectToObject, 0x3077B4AF }, - [APP_CALL_C_JSON_ADD_ARRAY_TO_OBJECT] = { cJSON_AddArrayToObject, 0xC2D7FC37 }, - [APP_CALL_C_JSON_SET_NUMBER_HELPER] = { cJSON_SetNumberHelper, 0x37FAE533 }, - [APP_CALL_C_JSON_SET_VALUESTRING] = { cJSON_SetValuestring, 0x7290D811 }, - [APP_CALL_C_JSON_MALLOC] = { cJSON_malloc, 0x6CE0826F }, - [APP_CALL_C_JSON_FREE] = { cJSON_free, 0x347C6215 }, - [APP_CALL_MBEDTLS_MD_INFO_FROM_TYPE] = { mbedtls_md_info_from_type, 0x02BA313E }, - [APP_CALL_MBEDTLS_CTR_DRBG_INIT] = { mbedtls_ctr_drbg_init, 0xEF20F1F6 }, - [APP_CALL_MBEDTLS_MPI_INIT] = { mbedtls_mpi_init, 0x7D00A7EB }, - [APP_CALL_MBEDTLS_ECDH_INIT] = { mbedtls_ecdh_init, 0x1BB555DE }, - [APP_CALL_MBEDTLS_CTR_DRBG_RANDOM] = { mbedtls_ctr_drbg_random, 0x7B0FCDD0 }, - [APP_CALL_MBEDTLS_MPI_READ_BINARY] = { mbedtls_mpi_read_binary, 0x5C747D76 }, - [APP_CALL_MBEDTLS_MPI_SUB_MPI] = { mbedtls_mpi_sub_mpi, 0x15136B35 }, - [APP_CALL_MBEDTLS_HKDF] = { mbedtls_hkdf, 0x079DA4BF }, - [APP_CALL_MBEDTLS_MD_GET_SIZE] = { mbedtls_md_get_size, 0x9A6EED5F }, - [APP_CALL_MBEDTLS_ENTROPY_INIT] = { mbedtls_entropy_init, 0x0C5448B8 }, - [APP_CALL_MBEDTLS_MPI_CMP_MPI] = { mbedtls_mpi_cmp_mpi, 0x364FB034 }, - [APP_CALL_MBEDTLS_ECDH_COMPUTE_SHARED] = { mbedtls_ecdh_compute_shared, 0x76275BD8 }, - [APP_CALL_MBEDTLS_MPI_EXP_MOD] = { mbedtls_mpi_exp_mod, 0x23C8C7F3 }, - [APP_CALL_MBEDTLS_MPI_MOD_MPI] = { mbedtls_mpi_mod_mpi, 0xCBCC1D0B }, - [APP_CALL_MBEDTLS_SHA256] = { mbedtls_sha256, 0xD41C5B49 }, - [APP_CALL_MBEDTLS_MPI_FREE] = { mbedtls_mpi_free, 0x538D65C0 }, - [APP_CALL_MBEDTLS_MPI_WRITE_BINARY] = { mbedtls_mpi_write_binary, 0x0C85F9C8 }, - [APP_CALL_MBEDTLS_MPI_MUL_MPI] = { mbedtls_mpi_mul_mpi, 0xD50201ED }, - [APP_CALL_MBEDTLS_MPI_ADD_MPI] = { mbedtls_mpi_add_mpi, 0xA6266D7A }, - [APP_CALL_MBEDTLS_ENTROPY_FUNC] = { mbedtls_entropy_func, 0x2A375141 }, - [APP_CALL_MBEDTLS_ECDH_FREE] = { mbedtls_ecdh_free, 0xF7F5E69E }, - [APP_CALL_MBEDTLS_MPI_INV_MOD] = { mbedtls_mpi_inv_mod, 0x1AD06932 }, - [APP_CALL_MBEDTLS_CTR_DRBG_SEED] = { mbedtls_ctr_drbg_seed, 0xC3A6C044 }, - [APP_CALL_MBEDTLS_CTR_DRBG_FREE] = { mbedtls_ctr_drbg_free, 0xEAE908D4 }, - [APP_CALL_MBEDTLS_MPI_COPY] = { mbedtls_mpi_copy, 0x3657EA22 }, - [APP_CALL_MBEDTLS_ENTROPY_FREE] = { mbedtls_entropy_free, 0xC5FA797F }, - [APP_CALL_MBEDTLS_ECP_GROUP_LOAD] = { mbedtls_ecp_group_load, 0xE8D04592 }, - [APP_CALL_MBEDTLS_MPI_SAFE_COND_SWAP] = { mbedtls_mpi_safe_cond_swap, 0x541477B3 }, - [APP_CALL_MBEDTLS_MPI_LSET] = { mbedtls_mpi_lset, 0x62753A05 }, -}; - -const struct mapping_tbl *get_app_mapping_tbl(void) -{ - return g_app_call_tbl; -} - -unsigned int get_app_mapping_tbl_size(void) -{ - return APP_CALL_MAX; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.h deleted file mode 100755 index 56d983c..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/app_function_mapping.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: app function mapping. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#ifndef APP_FUNCTION_MAPPING_H -#define APP_FUNCTION_MAPPING_H - -#ifdef __cplusplus -extern "C" { -#endif - -const struct mapping_tbl *get_app_mapping_tbl(void); -unsigned int get_app_mapping_tbl_size(void); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/hilink_call.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/hilink_call.h deleted file mode 100755 index a91c876..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/hilink_call.h +++ /dev/null @@ -1,123 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: hilink function mapping \n - * - * History: \n - * 2024-01-27, Create file. \n - */ -#ifndef HILINK_CALL_H -#define HILINK_CALL_H - -#include "func_call_list.h" -#include "app_call_entry.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0L -#else -#define NULL ((void*)0) -#endif -#endif - -#define hilink_call0(idx, nr, t) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"()"); \ - if (call_addr != NULL) { \ - return ((t (*)(void))call_addr)(); \ - } \ -} while (0) -#define hilink_call1(idx, nr, t, t1, p1) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1))call_addr)(p1); \ - } \ -} while (0) -#define hilink_call2(idx, nr, t, t1, p1, t2, p2) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1","#t2")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2))call_addr)(p1, p2); \ - } \ -} while (0) -#define hilink_call3(idx, nr, t, t1, p1, t2, p2, t3, p3) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1","#t2","#t3")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3))call_addr)(p1, p2, p3); \ - } \ -} while (0) -#define hilink_call4(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4))call_addr)(p1, p2, p3, p4); \ - } \ -} while (0) -#define hilink_call5(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4","#t5")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4, t5))call_addr)(p1, p2, p3, p4, p5); \ - } \ -} while (0) -#define hilink_call6(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) do { \ - void *call_addr = get_hilink_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4","#t5","#t6")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4, t5, t6))call_addr)(p1, p2, p3, p4, p5, p6); \ - } \ -} while (0) - -#define hilink_call0_ret_void(idx, nr) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"()"); \ - if (call_addr != NULL) { \ - ((void (*)(void))call_addr)(); \ - return; \ - } \ -} while (0) -#define hilink_call1_ret_void(idx, nr, t1, p1) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1))call_addr)(p1); \ - return; \ - } \ -} while (0) -#define hilink_call2_ret_void(idx, nr, t1, p1, t2, p2) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1","#t2")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2))call_addr)(p1, p2); \ - return; \ - } \ -} while (0) -#define hilink_call3_ret_void(idx, nr, t1, p1, t2, p2, t3, p3) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1","#t2","#t3")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3))call_addr)(p1, p2, p3); \ - return; \ - } \ -} while (0) -#define hilink_call4_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4))call_addr)(p1, p2, p3, p4); \ - return; \ - } \ -} while (0) -#define hilink_call5_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4","#t5")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4, t5))call_addr)(p1, p2, p3, p4, p5); \ - return; \ - } \ -} while (0) -#define hilink_call6_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) do { \ - void *call_addr = get_hilink_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4","#t5","#t6")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4, t5, t6))call_addr)(p1, p2, p3, p4, p5, p6); \ - return; \ - } \ -} while (0) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_ble_cfg_net_api.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_ble_cfg_net_api.c deleted file mode 100755 index 4592ea2..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_ble_cfg_net_api.c +++ /dev/null @@ -1,93 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: ble cfg net api \n - * - * History: \n - * 2024-01-27, Create file. \n - */ -#include "hilink_call.h" -#include "ble_cfg_net_api.h" - -int BLE_CfgNetInit(const BLE_InitPara *para, const BLE_CfgNetCb *callback) -{ - hilink_call2(HILINK_CALL_BLE_CFG_NET_INIT, BLE_CfgNetInit, int, - const BLE_InitPara *, para, const BLE_CfgNetCb *, callback); - return 0; -} - -int BLE_CfgNetDeInit(const BLE_GattHandleList *handleList, unsigned int flag) -{ - hilink_call2(HILINK_CALL_BLE_CFG_NET_DE_INIT, BLE_CfgNetDeInit, int, - const BLE_GattHandleList *, handleList, unsigned int, flag); - return 0; -} - -int BLE_CfgNetAdvCtrl(unsigned int advSecond) -{ - hilink_call1(HILINK_CALL_BLE_CFG_NET_ADV_CTRL, BLE_CfgNetAdvCtrl, int, unsigned int, advSecond); - return 0; -} - -int BLE_CfgNetAdvUpdate(const BLE_AdvInfo *advInfo) -{ - hilink_call1(HILINK_CALL_BLE_CFG_NET_ADV_UPDATE, BLE_CfgNetAdvUpdate, int, const BLE_AdvInfo *, advInfo); - return 0; -} - -int BLE_CfgNetDisConnect(void) -{ - hilink_call0(HILINK_CALL_BLE_CFG_NET_DIS_CONNECT, BLE_CfgNetDisConnect, int); - return 0; -} - -int BLE_SendCustomData(BLE_DataType dataType, const unsigned char *buff, unsigned int len) -{ - hilink_call3(HILINK_CALL_BLE_SEND_CUSTOM_DATA, BLE_SendCustomData, int, - BLE_DataType, dataType, const unsigned char *, buff, unsigned int, len); - return 0; -} - -int BLE_GetAdvType(void) -{ - hilink_call0(HILINK_CALL_BLE_GET_ADV_TYPE, BLE_GetAdvType, int); - return 0; -} - -void BLE_SetAdvType(int type) -{ - hilink_call1_ret_void(HILINK_CALL_BLE_SET_ADV_TYPE, BLE_SetAdvType, int, type); -} - -int BLE_SetAdvNameMpp(const unsigned char *mpp, unsigned int len) -{ - hilink_call2(HILINK_CALL_BLE_SET_ADV_NAME_MPP, BLE_SetAdvNameMpp, int, - const unsigned char *, mpp, unsigned int, len); - return 0; -} - -int BLE_NearDiscoveryInit(const BLE_NearDiscoveryCb *cb) -{ - hilink_call1(HILINK_CALL_BLE_NEAR_DISCOVERY_INIT, BLE_NearDiscoveryInit, int, const BLE_NearDiscoveryCb *, cb); - return 0; -} - -int BLE_NearDiscoveryEnable(unsigned long waitTime) -{ - hilink_call1(HILINK_CALL_BLE_NEAR_DISCOVERY_ENABLE, BLE_NearDiscoveryEnable, int, unsigned long, waitTime); - return 0; -} - -int HILINK_BT_GetTaskStackSize(const char *name, unsigned long *stackSize) -{ - hilink_call2(HILINK_CALL_HILINK_BT_GET_TASK_STACK_SIZE, HILINK_BT_GetTaskStackSize, int, - const char *, name, unsigned long *, stackSize); - return 0; -} - -int HILINK_BT_SetTaskStackSize(const char *name, unsigned long stackSize) -{ - hilink_call2(HILINK_CALL_HILINK_BT_SET_TASK_STACK_SIZE, HILINK_BT_SetTaskStackSize, int, - const char *, name, unsigned long, stackSize); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink.c deleted file mode 100755 index 476b403..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink.c +++ /dev/null @@ -1,163 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: HiLink function adaption \n - * - * History: \n - * 2024-01-27, Create file. \n - */ -#include "hilink_call.h" -#include "hilink.h" - -int HILINK_RegisterBaseCallback(const HiLinkBaseCallback *cb, unsigned int cbSize) -{ - hilink_call2(HILINK_CALL_HILINK_REGISTER_BASE_CALLBACK, HILINK_RegisterBaseCallback, int, - const HiLinkBaseCallback *, cb, unsigned int, cbSize); - return 0; -} - -int HILINK_Main(void) -{ - hilink_call0(HILINK_CALL_HILINK_MAIN, HILINK_Main, int); - return 0; -} - -void HILINK_Reset(void) -{ - hilink_call0_ret_void(HILINK_CALL_HILINK_RESET, HILINK_Reset); -} - -int HILINK_SetSdkAttr(HILINK_SdkAttr sdkAttr) -{ - hilink_call1(HILINK_CALL_HILINK_SET_SDK_ATTR, HILINK_SetSdkAttr, int, HILINK_SdkAttr, sdkAttr); - return 0; -} - -HILINK_SdkAttr *HILINK_GetSdkAttr(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_SDK_ATTR, HILINK_GetSdkAttr, HILINK_SdkAttr *); - return NULL; -} - -int HILINK_RestoreFactorySettings(void) -{ - hilink_call0(HILINK_CALL_HILINK_RESTORE_FACTORY_SETTINGS, HILINK_RestoreFactorySettings, int); - return 0; -} - -int HILINK_GetDevStatus(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_DEV_STATUS, HILINK_GetDevStatus, int); - return 0; -} - -const char *HILINK_GetSdkVersion(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_SDK_VERSION, HILINK_GetSdkVersion, const char *); - return NULL; -} - -int HILINK_ReportCharState(const char *svcId, const char *payload, unsigned int len) -{ - hilink_call3(HILINK_CALL_HILINK_REPORT_CHAR_STATE, HILINK_ReportCharState, int, - const char *, svcId, const char *, payload, unsigned int, len); - return 0; -} - -int HILINK_IsRegister(void) -{ - hilink_call0(HILINK_CALL_HILINK_IS_REGISTER, HILINK_IsRegister, int); - return 0; -} - -int HILINK_GetNetworkingMode(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_NETWORKING_MODE, HILINK_GetNetworkingMode, int); - return 0; -} - -int HILINK_GetRegisterStatus(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_REGISTER_STATUS, HILINK_GetRegisterStatus, int); - return 0; -} - -int HILINK_SetScheduleInterval(unsigned long interval) -{ - hilink_call1(HILINK_CALL_HILINK_SET_SCHEDULE_INTERVAL, HILINK_SetScheduleInterval, int, unsigned long, interval); - return 0; -} - -int HILINK_SetMonitorScheduleInterval(unsigned long interval) -{ - hilink_call1(HILINK_CALL_HILINK_SET_MONITOR_SCHEDULE_INTERVAL, HILINK_SetMonitorScheduleInterval, int, - unsigned long, interval); - return 0; -} - -int HILINK_SetNetConfigMode(enum HILINK_NetConfigMode netConfigMode) -{ - hilink_call1(HILINK_CALL_HILINK_SET_NET_CONFIG_MODE, HILINK_SetNetConfigMode, int, - enum HILINK_NetConfigMode, netConfigMode); - return 0; -} - -enum HILINK_NetConfigMode HILINK_GetNetConfigMode(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_NET_CONFIG_MODE, HILINK_GetNetConfigMode, enum HILINK_NetConfigMode); - return HILINK_NETCONFIG_BUTT; -} - -void HILINK_SetNetConfigTimeout(unsigned long netConfigTimeout) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_SET_NET_CONFIG_TIMEOUT, HILINK_SetNetConfigTimeout, - unsigned long, netConfigTimeout); -} - -int HILINK_SetOtaBootTime(unsigned int bootTime) -{ - hilink_call1(HILINK_CALL_HILINK_SET_OTA_BOOT_TIME, HILINK_SetOtaBootTime, int, unsigned int, bootTime); - return 0; -} - -void HILINK_EnableKitframework(void) -{ - hilink_call0_ret_void(HILINK_CALL_HILINK_ENABLE_KITFRAMEWORK, HILINK_EnableKitframework); -} - -void HILINK_EnableBatchControl(bool flag) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_ENABLE_BATCH_CONTROL, HILINK_EnableBatchControl, bool, flag); -} - -void HILINK_EnableProcessDelErrCode(int enable) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_ENABLE_PROCESS_DEL_ERR_CODE, HILINK_EnableProcessDelErrCode, int, enable); -} - -void HILINK_UnbindDevice(int type) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_UNBIND_DEVICE, HILINK_UnbindDevice, int, type); -} - -int HILINK_SetDeviceInstallType(int type) -{ - hilink_call1(HILINK_CALL_HILINK_SET_DEVICE_INSTALL_TYPE, HILINK_SetDeviceInstallType, int, int, type); - return 0; -} - -SetupType HILINK_GetDevSetupType(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_DEV_SETUP_TYPE, HILINK_GetDevSetupType, SetupType); - return SETUP_TYPE_UNREGISTER; -} - -void HILINK_EnableDevIdInherit(bool isEnbale) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_ENABLE_DEV_ID_INHERIT, HILINK_EnableDevIdInherit, bool, isEnbale); -} - -void HILINK_NotifyNetworkAvailable(bool status) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_NOTIFY_NETWORK_AVAILABLE, HILINK_NotifyNetworkAvailable, bool, status); -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_bt_function.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_bt_function.c deleted file mode 100755 index 5f54689..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_bt_function.c +++ /dev/null @@ -1,23 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: hilink bt function \n - * - * History: \n - * 2024-01-27, Create file. \n - */ -#include "hilink_call.h" -#include "hilink_bt_function.h" - -int HILINK_BT_SetSdkEventCallback(HILINK_BT_SdkEventCallBack callback) -{ - hilink_call1(HILINK_CALL_HILINK_BT_SET_SDK_EVENT_CALLBACK, HILINK_BT_SetSdkEventCallback, int, - HILINK_BT_SdkEventCallBack, callback); - return 0; -} - -int HILINK_BT_HardRevoke(void) -{ - hilink_call0(HILINK_CALL_HILINK_BT_SET_SDK_EVENT_CALLBACK, HILINK_BT_HardRevoke, int); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_custom.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_custom.c deleted file mode 100755 index b2ff7f1..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_custom.c +++ /dev/null @@ -1,45 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: hilink sle api - * - * History: \n - * 2024-11-08, Create file. - */ -#include "hilink_call.h" -#include "hilink_sle_api.h" - -void HILINK_SetProtType(const int protType) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_SET_PROT_TYPE, HILINK_SetProtType, const int, protType); -} - -void HILINK_EnablePrescan(void) -{ - hilink_call0_ret_void(HILINK_CALL_HILINK_ENABLE_PRESCAN, HILINK_EnablePrescan); -} - -int HILINK_SetNetConfigInfo(const char *info) -{ - hilink_call1(HILINK_CALL_HILINK_SET_NET_CONFIG_INFO, HILINK_SetNetConfigInfo, int, const char *, info); - return 0; -} - -int HILINK_SetSoftAPMode(void) -{ - hilink_call0(HILINK_CALL_HILINK_SET_SOFT_APMODE, HILINK_SetSoftAPMode, int); - return 0; -} - -int HILINK_RequestRegInfo(unsigned int regInfoNums) -{ - hilink_call1(HILINK_CALL_HILINK_REQUEST_REG_INFO, HILINK_RequestRegInfo, int, unsigned int, regInfoNums); - return 0; -} - -int HILINK_DiagnosisInfoRecord(int errCode, const char *param) -{ - hilink_call2(HILINK_CALL_HILINK_DIAGNOSIS_INFO_RECORD, HILINK_DiagnosisInfoRecord, int, - int, errCode, const char *, param); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_device_ext.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_device_ext.c deleted file mode 100755 index 52fa7f2..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_device_ext.c +++ /dev/null @@ -1,17 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: HiLink register to get function ACkeyV2 \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "hilink_call.h" -#include "hilink_device.h" - -void HILINK_RegisterGetAcV2Func(HILINK_GetAcKeyFunc func) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_REGISTER_GET_AC_V2_FUNC, HILINK_RegisterGetAcV2Func, - HILINK_GetAcKeyFunc, func); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_log_manage.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_log_manage.c deleted file mode 100755 index 2f86a50..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_log_manage.c +++ /dev/null @@ -1,24 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: HiLink log management \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "hilink_log_manage.h" -#include "hilink_call.h" - -#include - -void HILINK_SetLogLevel(HiLinkLogLevel level) -{ - hilink_call1_ret_void(HILINK_CALL_HILINK_SET_LOG_LEVEL, HILINK_SetLogLevel, HiLinkLogLevel, level); -} - -HiLinkLogLevel HILINK_GetLogLevel(void) -{ - hilink_call0(HILINK_CALL_HILINK_GET_LOG_LEVEL, HILINK_GetLogLevel, HiLinkLogLevel); - return HILINK_LOG_INVALID; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_network_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_network_adapter.c deleted file mode 100755 index 0b361db..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_network_adapter.c +++ /dev/null @@ -1,17 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: hilink network adapter - * - * History: \n - * 2024-05-28, Create file. - */ -#include "hilink_call.h" -#include "hilink_network_adapter.h" - -int HILINK_RegWiFiRecoveryCallback(const WiFiRecoveryApi *cb, unsigned int cbSize) -{ - hilink_call2(HILINK_CALL_HILINK_REG_WI_FI_RECOVERY_CALLBACK, HILINK_RegWiFiRecoveryCallback, int, - const WiFiRecoveryApi *, cb, unsigned int, cbSize); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_quick_netcfg_api.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_quick_netcfg_api.c deleted file mode 100755 index b4ce21c..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_quick_netcfg_api.c +++ /dev/null @@ -1,56 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: hilink network adapter - * - * History: \n - * 2024-05-28, Create file. - */ -#include "hilink_call.h" -#include "hilink_quick_netcfg_api.h" -#include "hilink_quick_netcfg_adapter.h" - -int HILINK_SetQuickCfgCommonLoader(QuickCfgCommonLoader *loader, unsigned int loaderSize) -{ - hilink_call2(HILINK_CALL_HILINK_SET_QUICK_CFG_COMMON_LOADER, HILINK_SetQuickCfgCommonLoader, int, - QuickCfgCommonLoader *, loader, unsigned int, loaderSize); - return 0; -} -int HILINK_StartQuickCfg(void) -{ - hilink_call0(HILINK_CALL_HILINK_START_QUICK_CFG, HILINK_StartQuickCfg, int); - return 0; -} - -int HILINK_FrameParse(const unsigned char *frame, unsigned int len) -{ - hilink_call2(HILINK_CALL_HILINK_FRAME_PARSE, HILINK_FrameParse, int, - const unsigned char *, frame, unsigned int, len); - return 0; -} - -int HILINK_QuickCfgCmdParse(const char *payload, unsigned int len) -{ - hilink_call2(HILINK_CALL_HILINK_QUICK_CFG_CMD_PARSE, HILINK_QuickCfgCmdParse, int, - const char *, payload, unsigned int, len); - return 0; -} - -int HILINK_SetDeviceType(DevType type) -{ - hilink_call1(HILINK_CALL_HILINK_SET_DEVICE_TYPE, HILINK_SetDeviceType, int, - DevType, type); - return 0; -} - -int HILINK_SetQuickCfgWifiLoader(QuickCfgWifiLoader *loader, unsigned int loaderSize) -{ - hilink_call2(HILINK_CALL_HILINK_SET_QUICK_CFG_WIFI_LOADER, HILINK_SetQuickCfgWifiLoader, int, - QuickCfgWifiLoader *, loader, unsigned int, loaderSize); - return 0; -} - -void HILINK_EnableQuickNetCfg(void) -{ - hilink_call0_ret_void(HILINK_CALL_HILINK_ENABLE_QUICK_NET_CFG, HILINK_EnableQuickNetCfg); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_sle_api.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_sle_api.c deleted file mode 100755 index aac07fb..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_sle_api.c +++ /dev/null @@ -1,15 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: hilink sle api - * - * History: \n - * 2024-11-08, Create file. - */ -#include "hilink_call.h" -#include "hilink_sle_api.h" - -void HILINK_EnableSle(void) -{ - hilink_call0_ret_void(HILINK_CALL_HILINK_ENABLE_SLE, HILINK_EnableSle); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_socket_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_socket_adapter.c deleted file mode 100755 index dc6d55e..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/application/hilink_uapi/uapi_hilink_socket_adapter.c +++ /dev/null @@ -1,16 +0,0 @@ - /** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: hilink socket adapter - * - * History: \n - * 2024-05-28, Create file. - */ -#include "hilink_call.h" -#include "hilink_socket_adapter.h" - -int HILINK_RegisterErrnoCallback(GetErrno cb) -{ - hilink_call1(HILINK_CALL_HILINK_REGISTER_ERRNO_CALLBACK, HILINK_RegisterErrnoCallback, int, GetErrno, cb); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/CMakeLists.txt b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/CMakeLists.txt deleted file mode 100755 index 878a624..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(COMPONENT_NAME "hilinkdevicesdk") - -set(LIBS ${ROOT_DIR}/application/samples/wifi/libhilink/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -set(COMPONENT_NAME "hilinkota") - -set(LIBS ${ROOT_DIR}/application/samples/wifi/libhilink/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -set(COMPONENT_NAME "hilinkbtsdk") - -set(LIBS ${ROOT_DIR}/application/samples/wifi/libhilink/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -if (DEFINES MATCHES "SUPPORT_QUICK_NETCFG") -set(COMPONENT_NAME "hilinkquickcfg") -set(LIBS ${ROOT_DIR}/application/samples/wifi/libhilink/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() -endif() - -set(COMPONENT_NAME "hilink_addr_map") - -set(CMAKE_HILINK_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}) - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_call_entry.c - ${CMAKE_CURRENT_SOURCE_DIR}/hilink_function_mapping.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hichain.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_device.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_kv_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_mem_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_network_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_open_ota_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_open_ota_mcu_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_aes.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_base64.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_drbg.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_kdf.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_md.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_mpi.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sal_rsa.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_socket_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_softap_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_stdio_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_str_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_sys_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_thread_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_time_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_tls_client.c - - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_ble_adapter.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_hilink_ble_main.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_cmsis_liteos2.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_cJSON.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_mbed_tls.c - - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_oh_sle_connection_manager.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_oh_sle_device_discovery.c - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/uapi_oh_sle_ssap_server.c -) - -set(PUBLIC_HEADER -) - -set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/product/ - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/include/ - ${CMAKE_CURRENT_SOURCE_DIR}/../../../ohos_connect/hilink_adapt/adapter/include/ - - ${ROOT_DIR}/open_source/deviceauth/interfaces/innerkits/deviceauth_lite/ - - ${CMAKE_CURRENT_SOURCE_DIR}/ - ${CMAKE_CURRENT_SOURCE_DIR}/app_uapi/ - ${CMAKE_CURRENT_SOURCE_DIR}/../include/ - - ${ROOT_DIR}/kernel/liteos/liteos_v208.5.0/Huawei_LiteOS/open_source/CMSIS/CMSIS/RTOS2/Include/ - ${ROOT_DIR}/include/ - ${ROOT_DIR}/open_source/cjson/cjson - ${ROOT_DIR}/open_source/mbedtls/mbedtls_v3.1.0/include -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS -) - -set(COMPONENT_CCFLAGS - -Wno-error=logical-op - -Wno-error=sign-compare - -Wno-error=jump-misses-init - -Wno-sign-compare - -Wno-jump-misses-init - -Wno-error=unused-parameter - -Wno-unused-parameter - -Wno-unused-but-set-variable - -Wno-error=unused-variable -) - -set(PRIVATE_DEFINES -) - -set(PUBLIC_DEFINES -) -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - false -) - -set(LIB_OUT_PATH ${BIN_DIR}/${CHIP}/libs/wifi/${TARGET_COMMAND}) - -build_component() \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/app_call.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/app_call.h deleted file mode 100755 index e8939bb..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/app_call.h +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: Function invoking macros on the application side. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#ifndef APP_CALL_H -#define APP_CALL_H - -#include "func_call_list.h" -#include "hilink_call_entry.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0L -#else -#define NULL ((void*)0) -#endif -#endif - -#define app_call0(idx, nr, t) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"()"); \ - if (call_addr != NULL) { \ - return ((t (*)(void))call_addr)(); \ - } \ -} while (0) -#define app_call1(idx, nr, t, t1, p1) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1))call_addr)(p1); \ - } \ -} while (0) -#define app_call2(idx, nr, t, t1, p1, t2, p2) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2))call_addr)(p1, p2); \ - } \ -} while (0) -#define app_call3(idx, nr, t, t1, p1, t2, p2, t3, p3) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2","#t3")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3))call_addr)(p1, p2, p3); \ - } \ -} while (0) -#define app_call4(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4))call_addr)(p1, p2, p3, p4); \ - } \ -} while (0) -#define app_call5(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4","#t5")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4, t5))call_addr)(p1, p2, p3, p4, p5); \ - } \ -} while (0) -#define app_call6(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4","#t5","#t6")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4, t5, t6))call_addr)(p1, p2, p3, p4, p5, p6); \ - } \ -} while (0) -#define app_call9(idx, nr, t, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6, t7, p7, t8, p8, t9, p9) do { \ - void *call_addr = get_app_api_addr(idx, #t#nr"("#t1","#t2","#t3","#t4","#t5","#t6","#t7","#t8","#t9")"); \ - if (call_addr != NULL) { \ - return ((t (*)(t1, t2, t3, t4, t5, t6, t7, t8, t9))call_addr)(p1, p2, p3, p4, p5, p6, p7, p8, p9); \ - } \ -} while (0) - -#define app_call0_ret_void(idx, nr) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"()"); \ - if (call_addr != NULL) { \ - ((void (*)(void))call_addr)(); \ - return; \ - } \ -} while (0) -#define app_call1_ret_void(idx, nr, t1, p1) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1))call_addr)(p1); \ - return; \ - } \ -} while (0) -#define app_call2_ret_void(idx, nr, t1, p1, t2, p2) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1","#t2")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2))call_addr)(p1, p2); \ - return; \ - } \ -} while (0) -#define app_call3_ret_void(idx, nr, t1, p1, t2, p2, t3, p3) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1","#t2","#t3")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3))call_addr)(p1, p2, p3); \ - return; \ - } \ -} while (0) -#define app_call4_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4))call_addr)(p1, p2, p3, p4); \ - return; \ - } \ -} while (0) -#define app_call5_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4","#t5")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4, t5))call_addr)(p1, p2, p3, p4, p5); \ - return; \ - } \ -} while (0) -#define app_call6_ret_void(idx, nr, t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) do { \ - void *call_addr = get_app_api_addr(idx, "void"#nr"("#t1","#t2","#t3","#t4","#t5","#t6")"); \ - if (call_addr != NULL) { \ - ((void (*)(t1, t2, t3, t4, t5, t6))call_addr)(p1, p2, p3, p4, p5, p6); \ - return; \ - } \ -} while (0) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cJSON.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cJSON.c deleted file mode 100755 index a0531b8..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cJSON.c +++ /dev/null @@ -1,520 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of cJSON in sdk side. \n - * - * History: \n - * 2024-11-26, Create file. \n - */ - -#include "app_call.h" -#include "cJSON.h" - -#ifdef true -#undef true -#endif -#define true ((cJSON_bool)1) - -#ifdef false -#undef false -#endif -#define false ((cJSON_bool)0) - -const char *cJSON_Version(void) -{ - app_call0(APP_CALL_C_JSON_VERSION, cJSON_Version, const char *); - return NULL; -} - -void cJSON_InitHooks(cJSON_Hooks * hooks) -{ - app_call1_ret_void(APP_CALL_C_JSON_INIT_HOOKS, cJSON_InitHooks, cJSON_Hooks *, hooks); -} - -cJSON *cJSON_Parse(const char *value) -{ - app_call1(APP_CALL_C_JSON_PARSE, cJSON_Parse, cJSON *, const char *, value); - return NULL; -} - -cJSON *cJSON_ParseWithLength(const char *value, size_t buffer_length) -{ - app_call2(APP_CALL_C_JSON_PARSE_WITH_LENGTH, cJSON_ParseWithLength, cJSON *, - const char *, value, size_t, buffer_length); - return NULL; -} - -cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) -{ - app_call3(APP_CALL_C_JSON_PARSE_WITH_OPTS, cJSON_ParseWithOpts, cJSON *, - const char *, value, const char **, return_parse_end, cJSON_bool, require_null_terminated); - return NULL; -} - -cJSON *cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, - const char **return_parse_end, cJSON_bool require_null_terminated) -{ - app_call4(APP_CALL_C_JSON_PARSE_WITH_LENGTH_OPTS, cJSON_ParseWithLengthOpts, cJSON *, - const char *, value, size_t, buffer_length, const char **, return_parse_end, cJSON_bool, require_null_terminated); - return NULL; -} - -char *cJSON_Print(const cJSON *item) -{ - app_call1(APP_CALL_C_JSON_PRINT, cJSON_Print, char *, const cJSON *, item); - return NULL; -} - -char *cJSON_PrintUnformatted(const cJSON *item) -{ - app_call1(APP_CALL_C_JSON_PRINT_UNFORMATTED, cJSON_PrintUnformatted, char *, const cJSON *, item); - return NULL; -} - -char *cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) -{ - app_call3(APP_CALL_C_JSON_PRINT_BUFFERED, cJSON_PrintBuffered, char *, - const cJSON *, item, int, prebuffer, cJSON_bool, fmt); - return NULL; -} - -cJSON_bool cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format) -{ - app_call4(APP_CALL_C_JSON_PRINT_PREALLOCATED, cJSON_PrintPreallocated, cJSON_bool, - cJSON *, item, char *, buffer, const int, length, const cJSON_bool, format); - return false; -} - -void cJSON_Delete(cJSON *item) -{ - app_call1_ret_void(APP_CALL_C_JSON_DELETE, cJSON_Delete, cJSON *, item); -} - -int cJSON_GetArraySize(const cJSON *array) -{ - app_call1(APP_CALL_C_JSON_GET_ARRAY_SIZE, cJSON_GetArraySize, int, const cJSON *, array); - return 0; -} - -cJSON *cJSON_GetArrayItem(const cJSON *array, int index) -{ - app_call2(APP_CALL_C_JSON_GET_ARRAY_ITEM, cJSON_GetArrayItem, cJSON *, const cJSON *, array, int, index); - return NULL; -} - -cJSON *cJSON_GetObjectItem(const cJSON * const object, const char * const string) -{ - app_call2(APP_CALL_C_JSON_GET_OBJECT_ITEM, cJSON_GetObjectItem, cJSON *, - const cJSON * const, object, const char * const, string); - return NULL; -} - -cJSON *cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) -{ - app_call2(APP_CALL_C_JSON_GET_OBJECT_ITEM_CASE_SENSITIVE, cJSON_GetObjectItemCaseSensitive, cJSON *, - const cJSON * const, object, const char * const, string); - return NULL; -} - -cJSON_bool cJSON_HasObjectItem(const cJSON *object, const char *string) -{ - app_call2(APP_CALL_C_JSON_HAS_OBJECT_ITEM, cJSON_HasObjectItem, cJSON_bool, - const cJSON *, object, const char *, string); - return false; -} - -const char *cJSON_GetErrorPtr(void) -{ - app_call0(APP_CALL_C_JSON_GET_ERROR_PTR, cJSON_GetErrorPtr, const char *); - return NULL; -} - -char *cJSON_GetStringValue(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_GET_STRING_VALUE, cJSON_GetStringValue, char *, const cJSON * const, item); - return NULL; -} - -double cJSON_GetNumberValue(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_GET_NUMBER_VALUE, cJSON_GetNumberValue, double, const cJSON * const, item); - return 0; -} - -cJSON_bool cJSON_IsInvalid(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_INVALID, cJSON_IsInvalid, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsFalse(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_FALSE, cJSON_IsFalse, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsTrue(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_TRUE, cJSON_IsTrue, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsBool(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_BOOL, cJSON_IsBool, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsNull(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_NULL, cJSON_IsNull, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsNumber(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_NUMBER, cJSON_IsNumber, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsString(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_STRING, cJSON_IsString, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsArray(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_ARRAY, cJSON_IsArray, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsObject(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_OBJECT, cJSON_IsObject, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON_bool cJSON_IsRaw(const cJSON * const item) -{ - app_call1(APP_CALL_C_JSON_IS_RAW, cJSON_IsRaw, cJSON_bool, const cJSON * const, item); - return false; -} - -cJSON *cJSON_CreateNull(void) -{ - app_call0(APP_CALL_C_JSON_CREATE_NULL, cJSON_CreateNull, cJSON *); - return NULL; -} - -cJSON *cJSON_CreateTrue(void) -{ - app_call0(APP_CALL_C_JSON_CREATE_TRUE, cJSON_CreateTrue, cJSON *); - return NULL; -} - -cJSON *cJSON_CreateFalse(void) -{ - app_call0(APP_CALL_C_JSON_CREATE_FALSE, cJSON_CreateFalse, cJSON *); - return NULL; -} - -cJSON *cJSON_CreateBool(cJSON_bool boolean) -{ - app_call1(APP_CALL_C_JSON_CREATE_BOOL, cJSON_CreateBool, cJSON *, cJSON_bool, boolean); - return NULL; -} - -cJSON *cJSON_CreateNumber(double num) -{ - app_call1(APP_CALL_C_JSON_CREATE_NUMBER, cJSON_CreateNumber, cJSON *, double, num); - return NULL; -} - -cJSON *cJSON_CreateString(const char *string) -{ - app_call1(APP_CALL_C_JSON_CREATE_STRING, cJSON_CreateString, cJSON *, const char *, string); - return NULL; -} - -cJSON *cJSON_CreateRaw(const char *raw) -{ - app_call1(APP_CALL_C_JSON_CREATE_RAW, cJSON_CreateRaw, cJSON *, const char *, raw); - return NULL; -} - -cJSON *cJSON_CreateArray(void) -{ - app_call0(APP_CALL_C_JSON_CREATE_ARRAY, cJSON_CreateArray, cJSON *); - return NULL; -} - -cJSON *cJSON_CreateObject(void) -{ - app_call0(APP_CALL_C_JSON_CREATE_OBJECT, cJSON_CreateObject, cJSON *); - return NULL; -} - -cJSON *cJSON_CreateStringReference(const char *string) -{ - app_call1(APP_CALL_C_JSON_CREATE_STRING_REFERENCE, cJSON_CreateStringReference, cJSON *, const char *, string); - return NULL; -} - -cJSON *cJSON_CreateObjectReference(const cJSON *child) -{ - app_call1(APP_CALL_C_JSON_CREATE_OBJECT_REFERENCE, cJSON_CreateObjectReference, cJSON *, const cJSON *, child); - return NULL; -} - -cJSON *cJSON_CreateArrayReference(const cJSON *child) -{ - app_call1(APP_CALL_C_JSON_CREATE_ARRAY_REFERENCE, cJSON_CreateArrayReference, cJSON *, const cJSON *, child); - return NULL; -} - -cJSON *cJSON_CreateIntArray(const int *numbers, int count) -{ - app_call2(APP_CALL_C_JSON_CREATE_INT_ARRAY, cJSON_CreateIntArray, cJSON *, const int *, numbers, int, count); - return NULL; -} - -cJSON *cJSON_CreateFloatArray(const float *numbers, int count) -{ - app_call2(APP_CALL_C_JSON_CREATE_FLOAT_ARRAY, cJSON_CreateFloatArray, cJSON *, - const float *, numbers, int, count); - return NULL; -} - -cJSON *cJSON_CreateDoubleArray(const double *numbers, int count) -{ - app_call2(APP_CALL_C_JSON_CREATE_DOUBLE_ARRAY, cJSON_CreateDoubleArray, cJSON *, - const double *, numbers, int, count); - return NULL; -} - -cJSON *cJSON_CreateStringArray(const char *const *strings, int count) -{ - app_call2(APP_CALL_C_JSON_CREATE_STRING_ARRAY, cJSON_CreateStringArray, cJSON *, - const char *const *, strings, int, count); - return NULL; -} - -cJSON_bool cJSON_AddItemToArray(cJSON *array, cJSON *item) -{ - app_call2(APP_CALL_C_JSON_ADD_ITEM_TO_ARRAY, cJSON_AddItemToArray, cJSON_bool, cJSON *, array, cJSON *, item); - return false; -} - -cJSON_bool cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) -{ - app_call3(APP_CALL_C_JSON_ADD_ITEM_TO_OBJECT, cJSON_AddItemToObject, cJSON_bool, - cJSON *, object, const char *, string, cJSON *, item); - return false; -} - -cJSON_bool cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) -{ - app_call3(APP_CALL_C_JSON_ADD_ITEM_TO_OBJECT_CS, cJSON_AddItemToObjectCS, cJSON_bool, - cJSON *, object, const char *, string, cJSON *, item); - return false; -} - -cJSON_bool cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) -{ - app_call2(APP_CALL_C_JSON_ADD_ITEM_REFERENCE_TO_ARRAY, cJSON_AddItemReferenceToArray, cJSON_bool, - cJSON *, array, cJSON *, item); - return false; -} - -cJSON_bool cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) -{ - app_call3(APP_CALL_C_JSON_ADD_ITEM_REFERENCE_TO_OBJECT, cJSON_AddItemReferenceToObject, cJSON_bool, - cJSON *, object, const char *, string, cJSON *, item); - return false; -} - -cJSON *cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) -{ - app_call2(APP_CALL_C_JSON_DETACH_ITEM_VIA_POINTER, cJSON_DetachItemViaPointer, cJSON *, - cJSON *, parent, cJSON * const, item); - return NULL; -} - -cJSON *cJSON_DetachItemFromArray(cJSON *array, int which) -{ - app_call2(APP_CALL_C_JSON_DETACH_ITEM_FROM_ARRAY, cJSON_DetachItemFromArray, cJSON *, - cJSON *, array, int, which); - return NULL; -} - -void cJSON_DeleteItemFromArray(cJSON *array, int which) -{ - app_call2_ret_void(APP_CALL_C_JSON_DELETE_ITEM_FROM_ARRAY, cJSON_DeleteItemFromArray, cJSON *, array, int, which); -} - -cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) -{ - app_call2(APP_CALL_C_JSON_DETACH_ITEM_FROM_OBJECT, cJSON_DetachItemFromObject, cJSON *, - cJSON *, object, const char *, string); - return NULL; -} - -cJSON *cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) -{ - app_call2(APP_CALL_C_JSON_DETACH_ITEM_FROM_OBJECT_CASE_SENSITIVE, cJSON_DetachItemFromObjectCaseSensitive, cJSON *, - cJSON *, object, const char *, string); - return NULL; -} - -void cJSON_DeleteItemFromObject(cJSON *object, const char *string) -{ - app_call2_ret_void(APP_CALL_C_JSON_DELETE_ITEM_FROM_OBJECT, cJSON_DeleteItemFromObject, - cJSON *, object, const char *, string); -} - -void cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) -{ - app_call2_ret_void(APP_CALL_C_JSON_DELETE_ITEM_FROM_OBJECT_CASE_SENSITIVE, cJSON_DeleteItemFromObjectCaseSensitive, - cJSON *, object, const char *, string); -} - -cJSON_bool cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) -{ - app_call3(APP_CALL_C_JSON_INSERT_ITEM_IN_ARRAY, cJSON_InsertItemInArray, cJSON_bool, - cJSON *, array, int, which, cJSON *, newitem); - return false; -} - -cJSON_bool cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON *const item, cJSON *replacement) -{ - app_call3(APP_CALL_C_JSON_REPLACE_ITEM_VIA_POINTER, cJSON_ReplaceItemViaPointer, cJSON_bool, - cJSON * const, parent, cJSON * const, item, cJSON *, replacement); - return false; -} - -cJSON_bool cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) -{ - app_call3(APP_CALL_C_JSON_REPLACE_ITEM_IN_ARRAY, cJSON_ReplaceItemInArray, cJSON_bool, - cJSON *, array, int, which, cJSON *, newitem); - return false; -} - -cJSON_bool cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) -{ - app_call3(APP_CALL_C_JSON_REPLACE_ITEM_IN_OBJECT, cJSON_ReplaceItemInObject, cJSON_bool, - cJSON *, object, const char *, string, cJSON *, newitem); - return false; -} - -cJSON_bool cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) -{ - app_call3(APP_CALL_C_JSON_REPLACE_ITEM_IN_OBJECT_CASE_SENSITIVE, cJSON_ReplaceItemInObjectCaseSensitive, - cJSON_bool, cJSON *, object, const char *, string, cJSON *, newitem); - return false; -} - -cJSON *cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) -{ - app_call2(APP_CALL_C_JSON_DUPLICATE, cJSON_Duplicate, cJSON *, const cJSON *, item, cJSON_bool, recurse); - return NULL; -} - -cJSON_bool cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) -{ - app_call3(APP_CALL_C_JSON_COMPARE, cJSON_Compare, cJSON_bool, - const cJSON * const, a, const cJSON * const, b, const cJSON_bool, case_sensitive); - return false; -} - -void cJSON_Minify(char *json) -{ - app_call1_ret_void(APP_CALL_C_JSON_MINIFY, cJSON_Minify, char *, json); -} - -cJSON *cJSON_AddNullToObject(cJSON * const object, const char * const name) -{ - app_call2(APP_CALL_C_JSON_ADD_NULL_TO_OBJECT, cJSON_AddNullToObject, cJSON *, - cJSON * const, object, const char * const, name); - return NULL; -} - -cJSON *cJSON_AddTrueToObject(cJSON * const object, const char * const name) -{ - app_call2(APP_CALL_C_JSON_ADD_TRUE_TO_OBJECT, cJSON_AddTrueToObject, cJSON *, - cJSON * const, object, const char * const, name); - return NULL; -} - -cJSON *cJSON_AddFalseToObject(cJSON * const object, const char * const name) -{ - app_call2(APP_CALL_C_JSON_ADD_FALSE_TO_OBJECT, cJSON_AddFalseToObject, cJSON *, - cJSON * const, object, const char * const, name); - return NULL; -} - -cJSON *cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) -{ - app_call3(APP_CALL_C_JSON_ADD_BOOL_TO_OBJECT, cJSON_AddBoolToObject, cJSON *, - cJSON * const, object, const char * const, name, const cJSON_bool, boolean); - return NULL; -} - -cJSON *cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) -{ - app_call3(APP_CALL_C_JSON_ADD_NUMBER_TO_OBJECT, cJSON_AddNumberToObject, cJSON *, - cJSON * const, object, const char * const, name, const double, number); - return NULL; -} - -cJSON *cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) -{ - app_call3(APP_CALL_C_JSON_ADD_STRING_TO_OBJECT, cJSON_AddStringToObject, cJSON *, - cJSON * const, object, const char * const, name, const char * const, string); - return NULL; -} - -cJSON *cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) -{ - app_call3(APP_CALL_C_JSON_ADD_RAW_TO_OBJECT, cJSON_AddRawToObject, cJSON *, - cJSON * const, object, const char * const, name, const char * const, raw); - return NULL; -} - -cJSON *cJSON_AddObjectToObject(cJSON * const object, const char * const name) -{ - app_call2(APP_CALL_C_JSON_ADD_OBJECT_TO_OBJECT, cJSON_AddObjectToObject, cJSON *, - cJSON * const, object, const char * const, name); - return NULL; -} - -cJSON *cJSON_AddArrayToObject(cJSON * const object, const char * const name) -{ - app_call2(APP_CALL_C_JSON_ADD_ARRAY_TO_OBJECT, cJSON_AddArrayToObject, cJSON *, - cJSON * const, object, const char * const, name); - return NULL; -} - -double cJSON_SetNumberHelper(cJSON *object, double number) -{ - app_call2(APP_CALL_C_JSON_SET_NUMBER_HELPER, cJSON_SetNumberHelper, double, cJSON *, object, double, number); - return 0; -} - -char *cJSON_SetValuestring(cJSON *object, const char *valuestring) -{ - app_call2(APP_CALL_C_JSON_SET_VALUESTRING, cJSON_SetValuestring, char *, - cJSON *, object, const char *, valuestring); - return NULL; -} - -void *cJSON_malloc(size_t size) -{ - app_call1(APP_CALL_C_JSON_MALLOC, cJSON_malloc, void *, size_t, size); - return NULL; -} - -void cJSON_free(void *object) -{ - app_call1_ret_void(APP_CALL_C_JSON_FREE, cJSON_free, void *, object); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cmsis_liteos2.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cmsis_liteos2.c deleted file mode 100755 index 096a6e2..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_cmsis_liteos2.c +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Common operations on the cmsis liteos2, including session creation and destruction. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "cmsis_os2.h" - -/* Only applicable to the partially used interfaces */ -uint32_t osKernelGetTickCount(void) -{ - app_call0(APP_CALL_OS_KERNEL_GET_TICK_COUNT, osKernelGetTickCount, uint32_t); - return 0; -} - -uint32_t osKernelGetTickFreq(void) -{ - app_call0(APP_CALL_OS_KERNEL_GET_TICK_FREQ, osKernelGetTickFreq, uint32_t); - return 0; -} - -osStatus_t osDelay(uint32_t ticks) -{ - app_call1(APP_CALL_OS_DELAY, osDelay, osStatus_t, uint32_t, ticks); - return osError; -} - -osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr) -{ - app_call3(APP_CALL_OS_THREAD_NEW, osThreadNew, osThreadId_t, osThreadFunc_t, func, void *, argument, - const osThreadAttr_t *, attr); - return NULL; -} - -osStatus_t osThreadTerminate(osThreadId_t thread_id) -{ - app_call1(APP_CALL_OS_THREAD_TERMINATE, osThreadTerminate, osStatus_t, osThreadId_t, thread_id); - return osError; -} - -osThreadId_t osThreadGetId(void) -{ - app_call0(APP_CALL_OS_THREAD_GET_ID, osThreadGetId, osThreadId_t); - return NULL; -} - -osMutexId_t osMutexNew(const osMutexAttr_t *attr) -{ - app_call1(APP_CALL_OS_MUTEX_NEW, osMutexNew, osMutexId_t, const osMutexAttr_t *, attr); - return NULL; -} - -osStatus_t osMutexDelete(osMutexId_t mutex_id) -{ - app_call1(APP_CALL_OS_MUTEX_DELETE, osMutexDelete, osStatus_t, osMutexId_t, mutex_id); - return osError; -} - -osStatus_t osMutexAcquire(osMutexId_t mutex_id, uint32_t timeout) -{ - app_call2(APP_CALL_OS_MUTEX_ACQUIRE, osMutexAcquire, osStatus_t, osMutexId_t, mutex_id, uint32_t, timeout); - return osError; -} - -osStatus_t osMutexRelease(osMutexId_t mutex_id) -{ - app_call1(APP_CALL_OS_MUTEX_RELEASE, osMutexRelease, osStatus_t, osMutexId_t, mutex_id); - return osError; -} - -osSemaphoreId_t osSemaphoreNew(uint32_t max_count, uint32_t initial_count, - const osSemaphoreAttr_t *attr) -{ - app_call3(APP_CALL_OS_SEMAPHORE_NEW, osSemaphoreNew, osSemaphoreId_t, uint32_t, max_count, - uint32_t, initial_count, const osSemaphoreAttr_t *, attr); - return NULL; -} - -osStatus_t osSemaphoreAcquire(osSemaphoreId_t semaphore_id, uint32_t timeout) -{ - app_call2(APP_CALL_OS_SEMAPHORE_ACQUIRE, osSemaphoreAcquire, osStatus_t, - osSemaphoreId_t, semaphore_id, uint32_t, timeout); - return osError; -} - -osStatus_t osSemaphoreRelease(osSemaphoreId_t semaphore_id) -{ - app_call1(APP_CALL_OS_SEMAPHORE_RELEASE, osSemaphoreRelease, osStatus_t, osSemaphoreId_t, semaphore_id); - return osError; -} - -osStatus_t osSemaphoreDelete(osSemaphoreId_t semaphore_id) -{ - app_call1(APP_CALL_OS_SEMAPHORE_DELETE, osSemaphoreDelete, osStatus_t, osSemaphoreId_t, semaphore_id); - return osError; -} - -osStatus_t osThreadSuspend(osThreadId_t thread_id) -{ - app_call1(APP_CALL_OS_THREAD_SUSPEND, osThreadSuspend, osStatus_t, osThreadId_t, thread_id); - return osError; -} - -osStatus_t osThreadResume(osThreadId_t thread_id) -{ - app_call1(APP_CALL_OS_THREAD_RESUME, osThreadResume, osStatus_t, osThreadId_t, thread_id); - return osError; -} - -void *malloc(size_t size) -{ - app_call1(APP_CALL_MALLOC, malloc, void *, size_t, size); - return NULL; -} - -void free(void *pt) -{ - app_call1_ret_void(APP_CALL_FREE, free, void *, pt); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hichain.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hichain.c deleted file mode 100755 index 31ec428..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hichain.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Common operations on the hichain, including session creation and destruction. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hichain.h" - -DLL_API_PUBLIC void registe_log(struct log_func_group *log) -{ - app_call1_ret_void(APP_CALL_REGISTE_LOG, registe_log, struct log_func_group *, log); -} - -DLL_API_PUBLIC hc_handle get_instance(const struct session_identity *identity, enum hc_type type, - const struct hc_call_back *call_back) -{ - app_call3(APP_CALL_GET_INSTANCE, get_instance, hc_handle, const struct session_identity *, identity, - enum hc_type, type, const struct hc_call_back *, call_back); - return NULL; -} - -DLL_API_PUBLIC void destroy(hc_handle *handle) -{ - app_call1_ret_void(APP_CALL_DESTROY, destroy, hc_handle *, handle); -} - -DLL_API_PUBLIC void set_context(hc_handle handle, void *context) -{ - app_call2_ret_void(APP_CALL_SET_CONTEXT, set_context, hc_handle, handle, void *, context); -} - -DLL_API_PUBLIC int32_t receive_data(hc_handle handle, struct uint8_buff *data) -{ - app_call2(APP_CALL_RECEIVE_DATA, receive_data, int32_t, hc_handle, handle, struct uint8_buff *, data); - return 0; -} - -DLL_API_PUBLIC int32_t receive_data_with_json_object(hc_handle handle, const void *json_object) -{ - app_call2(APP_CALL_RECEIVE_DATA_WITH_JSON_OBJECT, receive_data_with_json_object, int32_t, - hc_handle, handle, const void *, json_object); - return 0; -} - -#ifndef _CUT_API_ -DLL_API_PUBLIC int32_t init_center(const struct hc_package_name *package_name, - const struct hc_service_type *service_type, const struct hc_auth_id *auth_id, struct hc_key_alias *dek) -{ - app_call4(APP_CALL_INIT_CENTER, init_center, int32_t, const struct hc_package_name *, package_name, - const struct hc_service_type *, service_type, const struct hc_auth_id *, auth_id, - struct hc_key_alias *, dek); - return 0; -} - -DLL_API_PUBLIC int32_t start_pake(hc_handle handle, const struct operation_parameter *params) -{ - app_call2(APP_CALL_START_PAKE, start_pake, int32_t, hc_handle, handle, const struct operation_parameter *, params); - return 0; -} - -DLL_API_PUBLIC int32_t authenticate_peer(hc_handle handle, struct operation_parameter *params) -{ - app_call2(APP_CALL_AUTHENTICATE_PEER, authenticate_peer, int32_t, - hc_handle, handle, struct operation_parameter *, params); - return 0; -} - -DLL_API_PUBLIC int32_t delete_local_auth_info(hc_handle handle, struct hc_user_info *user_info) -{ - app_call2(APP_CALL_DELETE_LOCAL_AUTH_INFO, delete_local_auth_info, int32_t, - hc_handle, handle, struct hc_user_info *, user_info); - return 0; -} - -DLL_API_PUBLIC int32_t import_auth_info(hc_handle handle, struct hc_user_info *user_info, - struct hc_auth_id *auth_id, enum hc_export_type auth_info_type, struct uint8_buff *auth_info) -{ - app_call5(APP_CALL_IMPORT_AUTH_INFO, import_auth_info, int32_t, hc_handle, handle, struct hc_user_info *, - user_info, struct hc_auth_id *, auth_id, enum hc_export_type, auth_info_type, struct uint8_buff *, auth_info); - return 0; -} - -int32_t add_auth_info(hc_handle handle, const struct operation_parameter *params, - const struct hc_auth_id *auth_id, int32_t user_type) -{ - app_call4(APP_CALL_ADD_AUTH_INFO, add_auth_info, int32_t, hc_handle, handle, - const struct operation_parameter *, params, const struct hc_auth_id *, auth_id, int32_t, user_type); - return 0; -} - -int32_t remove_auth_info(hc_handle handle, const struct operation_parameter *params, - const struct hc_auth_id *auth_id, int32_t user_type) -{ - app_call4(APP_CALL_REMOVE_AUTH_INFO, remove_auth_info, int32_t, hc_handle, handle, - const struct operation_parameter *, params, const struct hc_auth_id *, auth_id, int32_t, user_type); - return 0; -} - -DLL_API_PUBLIC int32_t is_trust_peer(hc_handle handle, struct hc_user_info *user_info) -{ - app_call2(APP_CALL_IS_TRUST_PEER, is_trust_peer, int32_t, hc_handle, handle, struct hc_user_info *, user_info); - return 0; -} - -DLL_API_PUBLIC uint32_t list_trust_peers(hc_handle handle, int32_t trust_user_type, - struct hc_auth_id *owner_auth_id, struct hc_auth_id **auth_id_list) -{ - app_call4(APP_CALL_LIST_TRUST_PEERS, list_trust_peers, uint32_t, hc_handle, handle, int32_t, trust_user_type, - struct hc_auth_id *, owner_auth_id, struct hc_auth_id **, auth_id_list); - return 0; -} -#endif /* _CUT_XXX_ */ - -DLL_API_PUBLIC void set_self_auth_id(hc_handle handle, struct uint8_buff *data) -{ - app_call2_ret_void(APP_CALL_SET_SELF_AUTH_ID, set_self_auth_id, hc_handle, handle, struct uint8_buff *, data); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_adapter.c deleted file mode 100755 index 561bb81..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_adapter.c +++ /dev/null @@ -1,327 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Common operations on the ble adapter, including session creation and destruction. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include -#include "app_call.h" -#include "ohos_bt_gatt.h" -#include "ohos_bt_def.h" -#include "ohos_bt_gatt_server.h" - -BdAddr* GetLocalAddress(void) -{ - app_call0(APP_CALL_GET_LOCAL_ADDRESS, GetLocalAddress, BdAddr*); - return NULL; -} - -bool GetLocalName(unsigned char *localName, unsigned char *length) -{ - app_call2(APP_CALL_GET_LOCAL_NAME, GetLocalName, bool, unsigned char *, localName, unsigned char *, length); - return false; -} - -bool SetLocalName(unsigned char *localName, unsigned char length) -{ - app_call2(APP_CALL_SET_LOCAL_NAME, SetLocalName, bool, unsigned char *, localName, unsigned char, length); - return false; -} - -bool BluetoothFactoryReset(void) -{ - app_call0(APP_CALL_BLUETOOTH_FACTORY_RESET, BluetoothFactoryReset, bool); - return false; -} - -int GetBtScanMode(void) -{ - app_call0(APP_CALL_GET_BT_SCAN_MODE, GetBtScanMode, int); - return 0; -} - -bool SetBtScanMode(int mode, int duration) -{ - app_call2(APP_CALL_SET_BT_SCAN_MODE, SetBtScanMode, bool, int, mode, int, duration); - return false; -} - -int ReadBtMacAddr(unsigned char *mac, unsigned int len) -{ - app_call2(APP_CALL_READ_BT_MAC_ADDR, ReadBtMacAddr, int, unsigned char *, mac, unsigned int, len); - return 0; -} - -bool GetPariedDevicesNum(unsigned int *number) -{ - app_call1(APP_CALL_GET_PARIED_DEVICES_NUM, GetPariedDevicesNum, bool, unsigned int *, number); - return false; -} - -int GetPairState(void) -{ - app_call0(APP_CALL_GET_PAIR_STATE, GetPairState, int); - return 0; -} - -bool RemovePair(const BdAddr addr) -{ - app_call1(APP_CALL_REMOVE_PAIR, RemovePair, bool, const BdAddr, addr); - return false; -} - -bool RemoveAllPairs(void) -{ - app_call0(APP_CALL_REMOVE_ALL_PAIRS, RemoveAllPairs, bool); - return false; -} - -bool ReadRemoteRssiValue(const BdAddr *bdAddr, int transport) -{ - app_call2(APP_CALL_READ_REMOTE_RSSI_VALUE, ReadRemoteRssiValue, bool, const BdAddr *, bdAddr, int, transport); - return false; -} - -bool IsAclConnected(BdAddr *addr) -{ - app_call1(APP_CALL_IS_ACL_CONNECTED, IsAclConnected, bool, BdAddr *, addr); - return false; -} - -bool DisconnectRemoteDevice(BdAddr *addr) -{ - app_call1(APP_CALL_DISCONNECT_REMOTE_DEVICE, DisconnectRemoteDevice, bool, BdAddr *, addr); - return false; -} - -bool ConnectRemoteDevice(BdAddr *addr) -{ - app_call1(APP_CALL_CONNECT_REMOTE_DEVICE, ConnectRemoteDevice, bool, BdAddr *, addr); - return false; -} - -int InitBtStack(void) -{ - app_call0(APP_CALL_INIT_BT_STACK, InitBtStack, int); - return 0; -} - -int EnableBtStack(void) -{ - app_call0(APP_CALL_ENABLE_BT_STACK, EnableBtStack, int); - return 0; -} - -int DisableBtStack(void) -{ - app_call0(APP_CALL_DISABLE_BT_STACK, DisableBtStack, int); - return 0; -} - -int SetDeviceName(const char *name, unsigned int len) -{ - app_call2(APP_CALL_SET_DEVICE_NAME, SetDeviceName, int, const char *, name, unsigned int, len); - return 0; -} - -int BleSetAdvData(int advId, const BleConfigAdvData *data) -{ - app_call2(APP_CALL_BLE_SET_ADV_DATA, BleSetAdvData, int, int, advId, const BleConfigAdvData *, data); - return 0; -} - -int BleStartAdv(int advId, const BleAdvParams *param) -{ - app_call2(APP_CALL_BLE_START_ADV, BleStartAdv, int, int, advId, const BleAdvParams *, param); - return 0; -} - -int BleStopAdv(int advId) -{ - app_call1(APP_CALL_BLE_STOP_ADV, BleStopAdv, int, int, advId); - return 0; -} - -int BleUpdateAdv(int advId, const BleAdvParams *param) -{ - app_call2(APP_CALL_BLE_UPDATE_ADV, BleUpdateAdv, int, int, advId, const BleAdvParams *, param); - return 0; -} - -int BleSetSecurityIoCap(BleIoCapMode mode) -{ - app_call1(APP_CALL_BLE_SET_SECURITY_IO_CAP, BleSetSecurityIoCap, int, BleIoCapMode, mode); - return 0; -} - -int BleSetSecurityAuthReq(BleAuthReqMode mode) -{ - app_call1(APP_CALL_BLE_SET_SECURITY_AUTH_REQ, BleSetSecurityAuthReq, int, BleAuthReqMode, mode); - return 0; -} - -int BleGattSecurityRsp(BdAddr bdAddr, bool accept) -{ - app_call2(APP_CALL_BLE_GATT_SECURITY_RSP, BleGattSecurityRsp, int, BdAddr, bdAddr, bool, accept); - return 0; -} - -int BleScanFilterParamSetup(BleAdvScanFilterParam *param) -{ - app_call1(APP_CALL_BLE_SCAN_FILTER_PARAM_SETUP, BleScanFilterParamSetup, int, BleAdvScanFilterParam *, param); - return 0; -} - -int BleScanFilterAddRemove(BleAdvScanFilterCondition *param) -{ - app_call1(APP_CALL_BLE_SCAN_FILTER_ADD_REMOVE, BleScanFilterAddRemove, int, BleAdvScanFilterCondition *, param); - return 0; -} - -int BleScanFilterClear(int clientId, int filterIndex) -{ - app_call2(APP_CALL_BLE_SCAN_FILTER_CLEAR, BleScanFilterClear, int, int, clientId, int, filterIndex); - return 0; -} - -int BleScanFilterEnable(int clientId, bool enable) -{ - app_call2(APP_CALL_BLE_SCAN_FILTER_ENABLE, BleScanFilterEnable, int, int, clientId, bool, enable); - return 0; -} - -int BleSetScanParameters(int clientId, BleScanParams *param) -{ - app_call2(APP_CALL_BLE_SET_SCAN_PARAMETERS, BleSetScanParameters, int, int, clientId, BleScanParams *, param); - return 0; -} - -int BleStartScan(void) -{ - app_call0(APP_CALL_BLE_START_SCAN, BleStartScan, int); - return 0; -} - -int BleStopScan(void) -{ - app_call0(APP_CALL_BLE_STOP_SCAN, BleStopScan, int); - return 0; -} - -int BleGattRegisterCallbacks(BtGattCallbacks *func) -{ - app_call1(APP_CALL_BLE_GATT_REGISTER_CALLBACKS, BleGattRegisterCallbacks, int, BtGattCallbacks *, func); - return 0; -} - -int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam) -{ - app_call3(APP_CALL_BLE_START_ADV_EX, BleStartAdvEx, int, int *, advId, - const StartAdvRawData, rawData, BleAdvParams, advParam); - return 0; -} - -int BleGattsRegister(BtUuid appUuid) -{ - app_call1(APP_CALL_BLE_GATTS_REGISTER, BleGattsRegister, int, BtUuid, appUuid); - return 0; -} - -int BleGattsUnRegister(int serverId) -{ - app_call1(APP_CALL_BLE_GATTS_UN_REGISTER, BleGattsUnRegister, int, int, serverId); - return 0; -} - -int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId) -{ - app_call3(APP_CALL_BLE_GATTS_DISCONNECT, BleGattsDisconnect, int, int, serverId, BdAddr, bdAddr, int, connId); - return 0; -} - -int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number) -{ - app_call4(APP_CALL_BLE_GATTS_ADD_SERVICE, BleGattsAddService, int, int, serverId, BtUuid, srvcUuid, - bool, isPrimary, int, number); - return 0; -} - -int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, - int properties, int permissions) -{ - app_call5(APP_CALL_BLE_GATTS_ADD_CHARACTERISTIC, BleGattsAddCharacteristic, int, int, serverId, int, srvcHandle, - BtUuid, characUuid, int, properties, int, permissions); - return 0; -} - -int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions) -{ - app_call4(APP_CALL_BLE_GATTS_ADD_DESCRIPTOR, BleGattsAddDescriptor, int, int, serverId, int, srvcHandle, - BtUuid, descUuid, int, permissions); - return 0; -} - -int BleGattsStartService(int serverId, int srvcHandle) -{ - app_call2(APP_CALL_BLE_GATTS_START_SERVICE, BleGattsStartService, int, int, serverId, int, srvcHandle); - return 0; -} - -int BleGattsStopService(int serverId, int srvcHandle) -{ - app_call2(APP_CALL_BLE_GATTS_STOP_SERVICE, BleGattsStopService, int, int, serverId, int, srvcHandle); - return 0; -} - -int BleGattsDeleteService(int serverId, int srvcHandle) -{ - app_call2(APP_CALL_BLE_GATTS_DELETE_SERVICE, BleGattsDeleteService, int, int, serverId, int, srvcHandle); - return 0; -} - -int BleGattsClearServices(int serverId) -{ - app_call1(APP_CALL_BLE_GATTS_CLEAR_SERVICES, BleGattsClearServices, int, int, serverId); - return 0; -} - -int BleGattsSendResponse(int serverId, GattsSendRspParam *param) -{ - app_call2(APP_CALL_BLE_GATTS_SEND_RESPONSE, BleGattsSendResponse, int, int, serverId, GattsSendRspParam *, param); - return 0; -} - -int BleGattsSendIndication(int serverId, GattsSendIndParam *param) -{ - app_call2(APP_CALL_BLE_GATTS_SEND_INDICATION, BleGattsSendIndication, int, - int, serverId, GattsSendIndParam *, param); - return 0; -} - -int BleGattsSetEncryption(BdAddr bdAddr, BleSecAct secAct) -{ - app_call2(APP_CALL_BLE_GATTS_SET_ENCRYPTION, BleGattsSetEncryption, int, BdAddr, bdAddr, BleSecAct, secAct); - return 0; -} - -int BleGattsRegisterCallbacks(BtGattServerCallbacks *func) -{ - app_call1(APP_CALL_BLE_GATTS_REGISTER_CALLBACKS, BleGattsRegisterCallbacks, int, BtGattServerCallbacks *, func); - return 0; -} - -int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo) -{ - app_call2(APP_CALL_BLE_GATTS_START_SERVICE_EX, BleGattsStartServiceEx, int, int *, srvcHandle, - BleGattService *, srvcInfo); - return 0; -} - -int BleGattsStopServiceEx(int srvcHandle) -{ - app_call1(APP_CALL_BLE_GATTS_STOP_SERVICE_EX, BleGattsStopServiceEx, int, int, srvcHandle); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_main.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_main.c deleted file mode 100755 index 5557cb8..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_ble_main.c +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Common operations on the ble main, including session creation and destruction. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_bt_api.h" - -void HILINK_GetDeviceSn(unsigned int len, char *sn) -{ - app_call2_ret_void(APP_CALL_HILINK_GET_DEVICE_SN, HILINK_GetDeviceSn, unsigned int, len, char *, sn); -} - -int HILINK_GetSubProdId(char *subProdId, int len) -{ - app_call2(APP_CALL_HILINK_GET_SUB_PROD_ID, HILINK_GetSubProdId, int, char *, subProdId, int, len); - return 0; -} - -int HILINK_BT_GetDevSurfacePower(char *power) -{ - app_call1(APP_CALL_HILINK_BT_GET_DEV_SURFACE_POWER, HILINK_BT_GetDevSurfacePower, int, char *, power); - return 0; -} - -HILINK_BT_DevInfo *HILINK_BT_GetDevInfo(void) -{ - app_call0(APP_CALL_HILINK_BT_GET_DEV_INFO, HILINK_BT_GetDevInfo, HILINK_BT_DevInfo *); - return NULL; -} - -int HILINK_GetCustomInfo(char *customInfo, unsigned int len) -{ - app_call2(APP_CALL_HILINK_GET_CUSTOM_INFO, HILINK_GetCustomInfo, int, char *, customInfo, unsigned int, len); - return 0; -} - -int HILINK_GetManuId(char *manuId, unsigned int len) -{ - app_call2(APP_CALL_HILINK_GET_MANU_ID, HILINK_GetManuId, int, char *, manuId, unsigned int, len); - return 0; -} - -int HILINK_BT_GetMacAddr(unsigned char *mac, unsigned int len) -{ - app_call2(APP_CALL_HILINK_BT_GET_MAC_ADDR, HILINK_BT_GetMacAddr, int, unsigned char *, mac, unsigned int, len); - return 0; -} - -int getDeviceVersion(char* *firmwareVer, char* *softwareVer, char* *hardwareVer) -{ - app_call3(APP_CALL_GET_DEVICE_VERSION, getDeviceVersion, int, char* *, firmwareVer, - char* *, softwareVer, char* *, hardwareVer); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_device.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_device.c deleted file mode 100755 index 4ee0437..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_device.c +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Source file for HiLink adaptation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_device.h" - -#include "hilink_stdio_adapter.h" -int HILINK_GetDevInfo(HILINK_DevInfo *devinfo) -{ - app_call1(APP_CALL_HILINK_GET_DEV_INFO, HILINK_GetDevInfo, int, HILINK_DevInfo *, devinfo); - return 0; -} - -int HILINK_GetSvcInfo(HILINK_SvcInfo *svcInfo[], unsigned int size) -{ - app_call2(APP_CALL_HILINK_GET_SVC_INFO, HILINK_GetSvcInfo, int, HILINK_SvcInfo *[], svcInfo, unsigned int, size); - return 0; -} - -unsigned char *HILINK_GetAutoAc(void) -{ - app_call0(APP_CALL_HILINK_GET_AUTO_AC, HILINK_GetAutoAc, unsigned char *); - return NULL; -} - -int HILINK_PutCharState(const char *svcId, const char *payload, unsigned int len) -{ - app_call3(APP_CALL_HILINK_PUT_CHAR_STATE, HILINK_PutCharState, int, - const char *, svcId, const char *, payload, unsigned int, len); - return 0; -} - -int HILINK_ControlCharState(const char *payload, unsigned int len) -{ - app_call2(APP_CALL_HILINK_CONTROL_CHAR_STATE, HILINK_ControlCharState, int, - const char *, payload, unsigned int, len); - return 0; -} - -int HILINK_GetCharState(const char *svcId, const char *in, unsigned int inLen, char **out, unsigned int *outLen) -{ - app_call5(APP_CALL_HILINK_GET_CHAR_STATE, HILINK_GetCharState, int, const char *, svcId, - const char *, in, unsigned int, inLen, char **, out, unsigned int *, outLen); - return 0; -} - -int HILINK_GetPinCode(void) -{ - app_call0(APP_CALL_HILINK_GET_PIN_CODE, HILINK_GetPinCode, int); - return 0; -} - -void HILINK_NotifyDevStatus(int status) -{ - app_call1_ret_void(APP_CALL_HILINK_NOTIFY_DEV_STATUS, HILINK_NotifyDevStatus, int, status); -} - -int HILINK_ProcessBeforeRestart(int flag) -{ - app_call1(APP_CALL_HILINK_PROCESS_BEFORE_RESTART, HILINK_ProcessBeforeRestart, int, int, flag); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_kv_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_kv_adapter.c deleted file mode 100755 index 9a120e3..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_kv_adapter.c +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Source file for HiLink adaptation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ -#include "app_call.h" -#include "hilink_kv_adapter.h" - -int HILINK_KVStoreInit(const char *path, const char *key[], unsigned int num) -{ - app_call3(APP_CALL_HILINK_KVSTORE_INIT, HILINK_KVStoreInit, int, - const char *, path, const char *[], key, unsigned int, num); - return 0; -} - -int HILINK_SetValue(const char *key, unsigned int offset, const unsigned char *value, unsigned int len) -{ - app_call4(APP_CALL_HILINK_SET_VALUE, HILINK_SetValue, int, const char *, key, unsigned int, offset, - const unsigned char *, value, unsigned int, len); - return 0; -} - -int HILINK_GetValue(const char *key, unsigned int offset, unsigned char *value, unsigned int len) -{ - app_call4(APP_CALL_HILINK_GET_VALUE, HILINK_GetValue, int, const char *, key, unsigned int, offset, - unsigned char *, value, unsigned int, len); - return 0; -} - -void HILINK_DeleteValue(const char * key) -{ - app_call1_ret_void(APP_CALL_HILINK_DELETE_VALUE, HILINK_DeleteValue, const char *, key); -} - -int HILINK_GetFileName(const char *key, char *out, unsigned int len) -{ - app_call3(APP_CALL_HILINK_GET_FILE_NAME, HILINK_GetFileName, int, - const char *, key, char *, out, unsigned int, len); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_mem_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_mem_adapter.c deleted file mode 100755 index cf2573b..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_mem_adapter.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the memory interface at the system adaptation layer. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -void *HILINK_Malloc(unsigned int size) -{ - app_call1(APP_CALL_HILINK_MALLOC, HILINK_Malloc, void *, unsigned int, size); - return NULL; -} - -void HILINK_Free(void *pt) -{ - app_call1_ret_void(APP_CALL_HILINK_FREE, HILINK_Free, void *, pt); -} - -int HILINK_Memcmp(const void *buf1, const void *buf2, unsigned int len) -{ - app_call3(APP_CALL_HILINK_MEMCMP, HILINK_Memcmp, int, const void *, buf1, const void *, buf2, unsigned int, len); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_network_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_network_adapter.c deleted file mode 100755 index 7472b6d..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_network_adapter.c +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Network adaptation implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -int HILINK_GetLocalIp(char *localIp, unsigned char len) -{ - app_call2(APP_CALL_HILINK_GET_LOCAL_IP, HILINK_GetLocalIp, int, char *, localIp, unsigned char, len); - return 0; -} - -int HILINK_GetMacAddr(unsigned char *mac, unsigned char len) -{ - app_call2(APP_CALL_HILINK_GET_MAC_ADDR, HILINK_GetMacAddr, int, unsigned char *, mac, unsigned char, len); - return 0; -} - -int HILINK_GetWiFiSsid(char *ssid, unsigned int *ssidLen) -{ - app_call2(APP_CALL_HILINK_GET_WI_FI_SSID, HILINK_GetWiFiSsid, int, char *, ssid, unsigned int *, ssidLen); - return 0; -} - -int HILINK_SetWiFiInfo(const char *ssid, unsigned int ssidLen, const char *pwd, unsigned int pwdLen) -{ - app_call4(APP_CALL_HILINK_SET_WI_FI_INFO, HILINK_SetWiFiInfo, int, - const char *, ssid, unsigned int, ssidLen, const char *, pwd, unsigned int, pwdLen); - return 0; -} - -void HILINK_ReconnectWiFi(void) -{ - app_call0_ret_void(APP_CALL_HILINK_RECONNECT_WI_FI, HILINK_ReconnectWiFi); -} - -int HILINK_ConnectWiFi(void) -{ - app_call0(APP_CALL_HILINK_CONNECT_WI_FI, HILINK_ConnectWiFi, int); - return 0; -} - -int HILINK_GetNetworkState(int *state) -{ - app_call1(APP_CALL_HILINK_GET_NETWORK_STATE, HILINK_GetNetworkState, int, int *, state); - return 0; -} - -int HILINK_GetWiFiBssid(unsigned char *bssid, unsigned char *bssidLen) -{ - app_call2(APP_CALL_HILINK_GET_WI_FI_BSSID, HILINK_GetWiFiBssid, int, - unsigned char *, bssid, unsigned char *, bssidLen); - return 0; -} - -int HILINK_GetWiFiRssi(signed char *rssi) -{ - app_call1(APP_CALL_HILINK_GET_WI_FI_RSSI, HILINK_GetWiFiRssi, int, signed char *, rssi); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_adapter.c deleted file mode 100755 index c4a7286..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_adapter.c +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: OTA Adaptation Implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include -#include "app_call.h" - -bool HILINK_OtaAdapterFlashInit(void) -{ - app_call0(APP_CALL_HILINK_OTA_ADAPTER_FLASH_INIT, HILINK_OtaAdapterFlashInit, bool); - return false; -} - -unsigned int HILINK_OtaAdapterGetUpdateIndex(void) -{ - app_call0(APP_CALL_HILINK_OTA_ADAPTER_GET_UPDATE_INDEX, HILINK_OtaAdapterGetUpdateIndex, unsigned int); - return 0; -} - -int HILINK_OtaAdapterFlashErase(unsigned int size) -{ - app_call1(APP_CALL_HILINK_OTA_ADAPTER_FLASH_ERASE, HILINK_OtaAdapterFlashErase, int, unsigned int, size); - return 0; -} - -int HILINK_OtaAdapterFlashWrite(const unsigned char *buf, unsigned int bufLen) -{ - app_call2(APP_CALL_HILINK_OTA_ADAPTER_FLASH_WRITE, HILINK_OtaAdapterFlashWrite, int, - const unsigned char *, buf, unsigned int, bufLen); - return 0; -} - -int HILINK_OtaAdapterFlashRead(unsigned int offset, unsigned char *buf, unsigned int bufLen) -{ - app_call3(APP_CALL_HILINK_OTA_ADAPTER_FLASH_READ, HILINK_OtaAdapterFlashRead, int, - unsigned int, offset, unsigned char *, buf, unsigned int, bufLen); - return 0; -} - -bool HILINK_OtaAdapterFlashFinish(void) -{ - app_call0(APP_CALL_HILINK_OTA_ADAPTER_FLASH_FINISH, HILINK_OtaAdapterFlashFinish, bool); - return false; -} - -unsigned int HILINK_OtaAdapterFlashMaxSize(void) -{ - app_call0(APP_CALL_HILINK_OTA_ADAPTER_FLASH_MAX_SIZE, HILINK_OtaAdapterFlashMaxSize, unsigned int); - return 0; -} - -void HILINK_OtaAdapterRestart(int flag) -{ - app_call1_ret_void(APP_CALL_HILINK_OTA_ADAPTER_RESTART, HILINK_OtaAdapterRestart, int, flag); -} - -int HILINK_OtaStartProcess(int type) -{ - app_call1(APP_CALL_HILINK_OTA_START_PROCESS, HILINK_OtaStartProcess, int, int, type); - return 0; -} - -int HILINK_OtaEndProcess(int status) -{ - app_call1(APP_CALL_HILINK_OTA_END_PROCESS, HILINK_OtaEndProcess, int, int, status); - return 0; -} - -int HILINK_GetRebootFlag(void) -{ - app_call0(APP_CALL_HILINK_GET_REBOOT_FLAG, HILINK_GetRebootFlag, int); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_mcu_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_mcu_adapter.c deleted file mode 100755 index 0fde38e..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_open_ota_mcu_adapter.c +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Upgrade and adaptation of the external MCU. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -int HILINK_GetMcuVersion(char *version, unsigned int inLen, unsigned int *outLen) -{ - app_call3(APP_CALL_HILINK_GET_MCU_VERSION, HILINK_GetMcuVersion, int, - char *, version, unsigned int, inLen, unsigned int *, outLen); - return 0; -} - -int HILINK_NotifyOtaStatus(int flag, unsigned int len, unsigned int type) -{ - app_call3(APP_CALL_HILINK_NOTIFY_OTA_STATUS, HILINK_NotifyOtaStatus, int, - int, flag, unsigned int, len, unsigned int, type); - return 0; -} - -int HILINK_NotifyOtaData(const unsigned char *data, unsigned int len, unsigned int offset) -{ - app_call3(APP_CALL_HILINK_NOTIFY_OTA_DATA, HILINK_NotifyOtaData, int, - const unsigned char *, data, unsigned int, len, unsigned int, offset); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_aes.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_aes.c deleted file mode 100755 index ab9071c..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_aes.c +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the AES Encryption and Decryption Adaptation Layer Interfaces. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_aes.h" - -int HILINK_SAL_AesGcmEncrypt(const HiLinkAesGcmParam *param, unsigned char *tag, - unsigned int tagLen, unsigned char *buf) -{ - app_call4(APP_CALL_HILINK_SAL_AES_GCM_ENCRYPT, HILINK_SAL_AesGcmEncrypt, int, - const HiLinkAesGcmParam *, param, unsigned char *, tag, unsigned int, tagLen, unsigned char *, buf); - return 0; -} - -int HILINK_SAL_AesGcmDecrypt(const HiLinkAesGcmParam *param, const unsigned char *tag, - unsigned int tagLen, unsigned char *buf) -{ - app_call4(APP_CALL_HILINK_SAL_AES_GCM_DECRYPT, HILINK_SAL_AesGcmDecrypt, int, - const HiLinkAesGcmParam *, param, const unsigned char *, tag, unsigned int, tagLen, unsigned char *, buf); - return 0; -} - -int HILINK_SAL_AddPadding(HiLinkPaddingMode mode, unsigned char *out, unsigned int outLen, unsigned int dataLen) -{ - app_call4(APP_CALL_HILINK_SAL_ADD_PADDING, HILINK_SAL_AddPadding, int, - HiLinkPaddingMode, mode, unsigned char *, out, unsigned int, outLen, unsigned int, dataLen); - return 0; -} - -int HILINK_SAL_GetPadding(HiLinkPaddingMode mode, const unsigned char *input, - unsigned int inputLen, unsigned int *dataLen) -{ - app_call4(APP_CALL_HILINK_SAL_GET_PADDING, HILINK_SAL_GetPadding, int, - HiLinkPaddingMode, mode, const unsigned char *, input, unsigned int, inputLen, unsigned int *, dataLen); - return 0; -} - -int HILINK_SAL_AesCbcEncrypt(const HiLinkAesCbcParam *param, unsigned char *buf) -{ - app_call2(APP_CALL_HILINK_SAL_AES_CBC_ENCRYPT, HILINK_SAL_AesCbcEncrypt, int, - const HiLinkAesCbcParam *, param, unsigned char *, buf); - return 0; -} - -int HILINK_SAL_AesCbcDecrypt(const HiLinkAesCbcParam *param, unsigned char *buf) -{ - app_call2(APP_CALL_HILINK_SAL_AES_CBC_DECRYPT, HILINK_SAL_AesCbcDecrypt, int, - const HiLinkAesCbcParam *, param, unsigned char *, buf); - return 0; -} - -int HILINK_SAL_AesCcmDecrypt(const HiLinkAesCcmParam *param, const unsigned char *tag, - unsigned int tagLen, unsigned char *buf) -{ - app_call4(APP_CALL_HILINK_SAL_AES_CCM_DECRYPT, HILINK_SAL_AesCcmDecrypt, int, - const HiLinkAesCcmParam *, param, const unsigned char *, tag, unsigned int, tagLen, unsigned char *, buf); - return 0; -} - -int HILINK_SAL_AesCcmEncrypt(const HiLinkAesCcmParam *param, unsigned char *tag, unsigned int tagLen, - unsigned char *buf) -{ - app_call4(APP_CALL_HILINK_SAL_AES_CCM_ENCRYPT, HILINK_SAL_AesCcmEncrypt, int, const HiLinkAesCcmParam *, param, - unsigned char *, tag, unsigned int, tagLen, unsigned char *, buf); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_base64.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_base64.c deleted file mode 100755 index 0737523..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_base64.c +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Base64 encoding and decoding adaptation layer interface implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -int HILINK_SAL_Base64Encode(const unsigned char *inData, unsigned int inLen, - unsigned char *outData, unsigned int *outLen) -{ - app_call4(APP_CALL_HILINK_SAL_BASE64_ENCODE, HILINK_SAL_Base64Encode, int, - const unsigned char *, inData, unsigned int, inLen, unsigned char *, outData, unsigned int *, outLen); - return 0; -} - -int HILINK_SAL_Base64Decode(const unsigned char *inData, unsigned int inLen, - unsigned char *outData, unsigned int *outLen) -{ - app_call4(APP_CALL_HILINK_SAL_BASE64_DECODE, HILINK_SAL_Base64Decode, int, - const unsigned char *, inData, unsigned int, inLen, unsigned char *, outData, unsigned int *, outLen); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_drbg.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_drbg.c deleted file mode 100755 index 7a9e415..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_drbg.c +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of secure random number Adaptation Layer Interfaces. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_drbg.h" - -HiLinkDrbgContext HILINK_SAL_DrbgInit(const char *custom) -{ - app_call1(APP_CALL_HILINK_SAL_DRBG_INIT, HILINK_SAL_DrbgInit, HiLinkDrbgContext, const char *, custom); - return NULL; -} - -void HILINK_SAL_DrbgDeinit(HiLinkDrbgContext ctx) -{ - app_call1_ret_void(APP_CALL_HILINK_SAL_DRBG_DEINIT, HILINK_SAL_DrbgDeinit, HiLinkDrbgContext, ctx); -} - -int HILINK_SAL_DrbgRandom(HiLinkDrbgContext ctx, unsigned char *out, unsigned int outLen) -{ - app_call3(APP_CALL_HILINK_SAL_DRBG_RANDOM, HILINK_SAL_DrbgRandom, int, - HiLinkDrbgContext, ctx, unsigned char *, out, unsigned int, outLen); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_kdf.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_kdf.c deleted file mode 100755 index 5d01816..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_kdf.c +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Key derivation algorithm adaptation layer interface implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_kdf.h" - -int HILINK_SAL_Hkdf(const HiLinkHkdfParam *param, unsigned char *key, unsigned int keyLen) -{ - app_call3(APP_CALL_HILINK_SAL_HKDF, HILINK_SAL_Hkdf, int, - const HiLinkHkdfParam *, param, unsigned char *, key, unsigned int, keyLen); - return 0; -} - -int HILINK_SAL_Pkcs5Pbkdf2Hmac(const HiLinkPbkdf2HmacParam *param, unsigned char *key, unsigned int keyLen) -{ - app_call3(APP_CALL_HILINK_SAL_PKCS5_PBKDF2_HMAC, HILINK_SAL_Pkcs5Pbkdf2Hmac, int, - const HiLinkPbkdf2HmacParam *, param, unsigned char *, key, unsigned int, keyLen); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_md.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_md.c deleted file mode 100755 index b708fbf..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_md.c +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the Message Digest Algorithm Adaptation Layer Interface. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_md.h" - -int HILINK_SAL_MdCalc(HiLinkMdType type, const unsigned char *inData, unsigned int inLen, - unsigned char *md, unsigned int mdLen) -{ - app_call5(APP_CALL_HILINK_SAL_MD_CALC, HILINK_SAL_MdCalc, int, HiLinkMdType, type, - const unsigned char *, inData, unsigned int, inLen, unsigned char *, md, unsigned int, mdLen); - return 0; -} - -int HILINK_SAL_HmacCalc(const HiLinkHmacParam *param, unsigned char *hmac, unsigned int hmacLen) -{ - app_call3(APP_CALL_HILINK_SAL_HMAC_CALC, HILINK_SAL_HmacCalc, int, const HiLinkHmacParam *, param, - unsigned char *, hmac, unsigned int, hmacLen); - return 0; -} - -HiLinkMdContext HILINK_SAL_MdInit(HiLinkMdType type) -{ - app_call1(APP_CALL_HILINK_SAL_MD_INIT, HILINK_SAL_MdInit, HiLinkMdContext, HiLinkMdType, type); - return NULL; -} - -int HILINK_SAL_MdUpdate(HiLinkMdContext ctx, const unsigned char *inData, unsigned int inLen) -{ - app_call3(APP_CALL_HILINK_SAL_MD_UPDATE, HILINK_SAL_MdUpdate, int, - HiLinkMdContext, ctx, const unsigned char *, inData, unsigned int, inLen); - return 0; -} - -int HILINK_SAL_MdFinish(HiLinkMdContext ctx, unsigned char *outData, unsigned int outLen) -{ - app_call3(APP_CALL_HILINK_SAL_MD_FINISH, HILINK_SAL_MdFinish, int, - HiLinkMdContext, ctx, unsigned char *, outData, unsigned int, outLen); - return 0; -} - -void HILINK_SAL_MdFree(HiLinkMdContext ctx) -{ - app_call1_ret_void(APP_CALL_HILINK_SAL_MD_FREE, HILINK_SAL_MdFree, HiLinkMdContext, ctx); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_mpi.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_mpi.c deleted file mode 100755 index d8e8aa7..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_mpi.c +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Multi-precision integer implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_mpi.h" - -HiLinkMpi HILINK_SAL_MpiInit(void) -{ - app_call0(APP_CALL_HILINK_SAL_MPI_INIT, HILINK_SAL_MpiInit, HiLinkMpi); - return NULL; -} - -void HILINK_SAL_MpiFree(HiLinkMpi mpi) -{ - app_call1_ret_void(APP_CALL_HILINK_SAL_MPI_FREE, HILINK_SAL_MpiFree, HiLinkMpi, mpi); -} - -int HILINK_SAL_MpiExpMod(HiLinkMpi x, HiLinkMpi a, HiLinkMpi e, HiLinkMpi n) -{ - app_call4(APP_CALL_HILINK_SAL_MPI_EXP_MOD, HILINK_SAL_MpiExpMod, int, - HiLinkMpi, x, HiLinkMpi, a, HiLinkMpi, e, HiLinkMpi, n); - return 0; -} - -int HILINK_SAL_MpiCmpInt(HiLinkMpi x, int64_t z) -{ - app_call2(APP_CALL_HILINK_SAL_MPI_CMP_INT, HILINK_SAL_MpiCmpInt, int, HiLinkMpi, x, int64_t, z); - return 0; -} - -int HILINK_SAL_MpiSubInt(HiLinkMpi x, HiLinkMpi a, int64_t b) -{ - app_call3(APP_CALL_HILINK_SAL_MPI_SUB_INT, HILINK_SAL_MpiSubInt, int, HiLinkMpi, x, HiLinkMpi, a, int64_t, b); - return 0; -} - -int HILINK_SAL_MpiCmpMpi(HiLinkMpi x, HiLinkMpi y) -{ - app_call2(APP_CALL_HILINK_SAL_MPI_CMP_MPI, HILINK_SAL_MpiCmpMpi, int, HiLinkMpi, x, HiLinkMpi, y); - return 0; -} - -int HILINK_SAL_MpiReadString(HiLinkMpi mpi, unsigned char radix, const char *s) -{ - app_call3(APP_CALL_HILINK_SAL_MPI_READ_STRING, HILINK_SAL_MpiReadString, int, - HiLinkMpi, mpi, unsigned char, radix, const char *, s); - return 0; -} - -int HILINK_SAL_MpiWriteString(HiLinkMpi mpi, unsigned int radix, char *buf, unsigned int *bufLen) -{ - app_call4(APP_CALL_HILINK_SAL_MPI_WRITE_STRING, HILINK_SAL_MpiWriteString, int, - HiLinkMpi, mpi, unsigned int, radix, char *, buf, unsigned int *, bufLen); - return 0; -} - -int HILINK_SAL_MpiReadBinary(HiLinkMpi mpi, const unsigned char *buf, unsigned int bufLen) -{ - app_call3(APP_CALL_HILINK_SAL_MPI_READ_BINARY, HILINK_SAL_MpiReadBinary, int, - HiLinkMpi, mpi, const unsigned char *, buf, unsigned int, bufLen); - return 0; -} - -int HILINK_SAL_MpiWriteBinary(HiLinkMpi mpi, unsigned char *buf, unsigned int bufLen) -{ - app_call3(APP_CALL_HILINK_SAL_MPI_WRITE_BINARY, HILINK_SAL_MpiWriteBinary, int, - HiLinkMpi, mpi, unsigned char *, buf, unsigned int, bufLen); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_rsa.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_rsa.c deleted file mode 100755 index ecda703..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sal_rsa.c +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of RSA Encryption and Decryption Adaptation Layer Interfaces. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sal_rsa.h" - -HiLinkRsaContext HILINK_SAL_RsaInit(HiLinkRsaPkcs1Mode padding, HiLinkMdType md) -{ - app_call2(APP_CALL_HILINK_SAL_RSA_INIT, HILINK_SAL_RsaInit, HiLinkRsaContext, - HiLinkRsaPkcs1Mode, padding, HiLinkMdType, md); - return NULL; -} - -void HILINK_SAL_RsaFree(HiLinkRsaContext ctx) -{ - app_call1_ret_void(APP_CALL_HILINK_SAL_RSA_FREE, HILINK_SAL_RsaFree, HiLinkRsaContext, ctx); -} - -int HILINK_SAL_RsaParamImport(HiLinkRsaContext ctx, const HiLinkRsaParam *param) -{ - app_call2(APP_CALL_HILINK_SAL_RSA_PARAM_IMPORT, HILINK_SAL_RsaParamImport, int, - HiLinkRsaContext, ctx, const HiLinkRsaParam *, param); - return 0; -} - -int HILINK_RsaPkcs1Verify(HiLinkRsaContext ctx, HiLinkMdType md, const unsigned char *hash, - unsigned int hashLen, const unsigned char *sig, unsigned int sigLen) -{ - app_call6(APP_CALL_HILINK_RSA_PKCS1_VERIFY, HILINK_RsaPkcs1Verify, int, HiLinkRsaContext, ctx, HiLinkMdType, md, - const unsigned char *, hash, unsigned int, hashLen, const unsigned char *, sig, unsigned int, sigLen); - return 0; -} - -int HILINK_RsaPkcs1Decrypt(const HiLinkRsaCryptParam *param, unsigned char *buf, unsigned int *len) -{ - app_call3(APP_CALL_HILINK_RSA_PKCS1_DECRYPT, HILINK_RsaPkcs1Decrypt, int, const HiLinkRsaCryptParam *, param, - unsigned char *, buf, unsigned int *, len); - return 0; -} - -int HILINK_RsaPkcs1Encrypt(const HiLinkRsaCryptParam *param, unsigned char *buf, unsigned int len) -{ - app_call3(APP_CALL_HILINK_RSA_PKCS1_ENCRYPT, HILINK_RsaPkcs1Encrypt, int, const HiLinkRsaCryptParam *, param, - unsigned char *, buf, unsigned int, len); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_socket_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_socket_adapter.c deleted file mode 100755 index c476f65..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_socket_adapter.c +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the Network Socket Interface at the System Adaptation Layer. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_socket_adapter.h" - -int HILINK_GetAddrInfo(const char *nodename, const char *servname, - const HiLinkAddrInfo *hints, HiLinkAddrInfo **result) -{ - app_call4(APP_CALL_HILINK_GET_ADDR_INFO, HILINK_GetAddrInfo, int, const char *, nodename, const char *, servname, - const HiLinkAddrInfo *, hints, HiLinkAddrInfo **, result); - return 0; -} - -void HILINK_FreeAddrInfo(HiLinkAddrInfo *addrInfo) -{ - app_call1_ret_void(APP_CALL_HILINK_FREE_ADDR_INFO, HILINK_FreeAddrInfo, HiLinkAddrInfo *, addrInfo); -} - -int HILINK_Socket(HiLinkSocketDomain domain, HiLinkSocketType type, HiLinkSocketProto proto) -{ - app_call3(APP_CALL_HILINK_SOCKET, HILINK_Socket, int, - HiLinkSocketDomain, domain, HiLinkSocketType, type, HiLinkSocketProto, proto); - return 0; -} - -void HILINK_Close(int fd) -{ - app_call1_ret_void(APP_CALL_HILINK_CLOSE, HILINK_Close, int, fd); -} - -int HILINK_SetSocketOpt(int fd, HiLinkSocketOption option, const void *value, unsigned int len) -{ - app_call4(APP_CALL_HILINK_SET_SOCKET_OPT, HILINK_SetSocketOpt, int, int, fd, HiLinkSocketOption, option, - const void *, value, unsigned int, len); - return 0; -} - -int HILINK_Bind(int fd, const HiLinkSockaddr *addr, unsigned int addrLen) -{ - app_call3(APP_CALL_HILINK_BIND, HILINK_Bind, int, int, fd, const HiLinkSockaddr *, addr, unsigned int, addrLen); - return 0; -} - -int HILINK_Connect(int fd, const HiLinkSockaddr *addr, unsigned int addrLen) -{ - app_call3(APP_CALL_HILINK_CONNECT, HILINK_Connect, int, - int, fd, const HiLinkSockaddr *, addr, unsigned int, addrLen); - return 0; -} - -int HILINK_Recv(int fd, unsigned char *buf, unsigned int len) -{ - app_call3(APP_CALL_HILINK_RECV, HILINK_Recv, int, int, fd, unsigned char *, buf, unsigned int, len); - return 0; -} - -int HILINK_Send(int fd, const unsigned char *buf, unsigned int len) -{ - app_call3(APP_CALL_HILINK_SEND, HILINK_Send, int, int, fd, const unsigned char *, buf, unsigned int, len); - return 0; -} - -int HILINK_RecvFrom(int fd, unsigned char *buf, unsigned int len, - HiLinkSockaddr *from, unsigned int *fromLen) -{ - app_call5(APP_CALL_HILINK_RECV_FROM, HILINK_RecvFrom, int, int, fd, unsigned char *, buf, unsigned int, len, - HiLinkSockaddr *, from, unsigned int *, fromLen); - return 0; -} - -int HILINK_SendTo(int fd, const unsigned char *buf, unsigned int len, - const HiLinkSockaddr *to, unsigned int toLen) -{ - app_call5(APP_CALL_HILINK_SEND_TO, HILINK_SendTo, int, int, fd, const unsigned char *, buf, unsigned int, len, - const HiLinkSockaddr *, to, unsigned int, toLen); - return 0; -} - -int HILINK_Select(HiLinkFdSet *readSet, HiLinkFdSet *writeSet, HiLinkFdSet *exceptSet, unsigned int ms) -{ - app_call4(APP_CALL_HILINK_SELECT, HILINK_Select, int, HiLinkFdSet *, readSet, - HiLinkFdSet *, writeSet, HiLinkFdSet *, exceptSet, unsigned int, ms); - return 0; -} - -int HILINK_GetSocketErrno(int fd) -{ - app_call1(APP_CALL_HILINK_GET_SOCKET_ERRNO, HILINK_GetSocketErrno, int, int, fd); - return 0; -} - -unsigned int HILINK_Htonl(unsigned int hl) -{ - app_call1(APP_CALL_HILINK_HTONL, HILINK_Htonl, unsigned int, unsigned int, hl); - return 0; -} - -unsigned int HILINK_Ntohl(unsigned int nl) -{ - app_call1(APP_CALL_HILINK_NTOHL, HILINK_Ntohl, unsigned int, unsigned int, nl); - return 0; -} - -unsigned short HILINK_Htons(unsigned short hs) -{ - app_call1(APP_CALL_HILINK_HTONS, HILINK_Htons, unsigned short, unsigned short, hs); - return 0; -} - -unsigned short HILINK_Ntohs(unsigned short ns) -{ - app_call1(APP_CALL_HILINK_NTOHS, HILINK_Ntohs, unsigned short, unsigned short, ns); - return 0; -} - -unsigned int HILINK_InetAton(const char *ip, unsigned int *addr) -{ - app_call2(APP_CALL_HILINK_INET_ATON, HILINK_InetAton, unsigned int, const char *, ip, unsigned int *, addr); - return 0; -} - -unsigned int HILINK_InetAddr(const char *ip) -{ - app_call1(APP_CALL_HILINK_INET_ADDR, HILINK_InetAddr, unsigned int, const char *, ip); - return 0; -} - -const char *HILINK_InetNtoa(unsigned int addr, char *buf, unsigned int buflen) -{ - app_call3(APP_CALL_HILINK_INET_NTOA, HILINK_InetNtoa, const char *, - unsigned int, addr, char *, buf, unsigned int, buflen); - return NULL; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_softap_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_softap_adapter.c deleted file mode 100755 index d573307..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_softap_adapter.c +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: SoftAP Adaptation Implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -int HILINK_StartSoftAp(const char *ssid, unsigned int ssidLen) -{ - app_call2(APP_CALL_HILINK_START_SOFT_AP, HILINK_StartSoftAp, int, const char *, ssid, unsigned int, ssidLen); - return 0; -} - -int HILINK_StopSoftAp(void) -{ - app_call0(APP_CALL_HILINK_STOP_SOFT_AP, HILINK_StopSoftAp, int); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_stdio_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_stdio_adapter.c deleted file mode 100755 index e6dd3e2..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_stdio_adapter.c +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the standard output interface of the system adaptation layer. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include -#include -#include "app_call.h" - -int HILINK_Vprintf(const char *format, va_list ap) -{ - app_call2(APP_CALL_HILINK_VPRINTF, HILINK_Vprintf, int, const char *, format, va_list, ap); - return 0; -} - -int HILINK_Printf(const char *format, ...) -{ - if (format == NULL) { - return 0; - } - va_list ap; - va_start(ap, format); - int ret = HILINK_Vprintf(format, ap); - va_end(ap); - - return ret; -} - -int HILINK_Rand(unsigned char *input, unsigned int len) -{ - app_call2(APP_CALL_HILINK_RAND, HILINK_Rand, int, unsigned char *, input, unsigned int, len); - return 0; -} - -int HILINK_Trng(unsigned char *input, unsigned int len) -{ - app_call2(APP_CALL_HILINK_TRNG, HILINK_Trng, int, unsigned char *, input, unsigned int, len); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_str_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_str_adapter.c deleted file mode 100755 index 47c8702..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_str_adapter.c +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the character string interface at the system adaptation layer. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" - -unsigned int HILINK_Strlen(const char *src) -{ - app_call1(APP_CALL_HILINK_STRLEN, HILINK_Strlen, unsigned int, const char *, src); - return 0; -} - -char *HILINK_Strchr(const char *str, int ch) -{ - app_call2(APP_CALL_HILINK_STRCHR, HILINK_Strchr, char *, const char *, str, int, ch); - return NULL; -} - -char *HILINK_Strrchr(const char *str, int ch) -{ - app_call2(APP_CALL_HILINK_STRRCHR, HILINK_Strrchr, char *, const char *, str, int, ch); - return NULL; -} - -int HILINK_Atoi(const char *str) -{ - app_call1(APP_CALL_HILINK_ATOI, HILINK_Atoi, int, const char *, str); - return 0; -} - -char *HILINK_Strstr(const char *str1, const char *str2) -{ - app_call2(APP_CALL_HILINK_STRSTR, HILINK_Strstr, char *, const char *, str1, const char *, str2); - return NULL; -} - -int HILINK_Strcmp(const char *str1, const char *str2) -{ - app_call2(APP_CALL_HILINK_STRCMP, HILINK_Strcmp, int, const char *, str1, const char *, str2); - return 0; -} - -int HILINK_Strncmp(const char *str1, const char *str2, unsigned int len) -{ - app_call3(APP_CALL_HILINK_STRNCMP, HILINK_Strncmp, int, const char *, str1, const char *, str2, unsigned int, len); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sys_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sys_adapter.c deleted file mode 100755 index fabe297..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_sys_adapter.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: System adaptation layer interface implementation. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_sys_adapter.h" - -int HILINK_Restart(void) -{ - app_call0(APP_CALL_HILINK_RESTART, HILINK_Restart, int); - return 0; -} - -unsigned char HILINK_GetSystemBootReason(void) -{ - app_call0(APP_CALL_HILINK_GET_SYSTEM_BOOT_REASON, HILINK_GetSystemBootReason, unsigned char); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_thread_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_thread_adapter.c deleted file mode 100755 index 5411da3..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_thread_adapter.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Thread adaptation layer interface. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_thread_adapter.h" - -HiLinkTaskId HILINK_CreateTask(HiLinkTaskParam *param) -{ - app_call1(APP_CALL_HILINK_CREATE_TASK, HILINK_CreateTask, HiLinkTaskId, HiLinkTaskParam *, param); - return NULL; -} - -int HILINK_ThreadSuspend(HiLinkTaskId handle) -{ - app_call1(APP_CALL_HILINK_THREAD_SUSPEND, HILINK_ThreadSuspend, int, HiLinkTaskId, handle); - return 0; -} - -int HILINK_ThreadResume(HiLinkTaskId handle) -{ - app_call1(APP_CALL_HILINK_THREAD_RESUME, HILINK_ThreadResume, int, HiLinkTaskId, handle); - return 0; -} - -void HILINK_DeleteTask(HiLinkTaskId handle) -{ - app_call1_ret_void(APP_CALL_HILINK_DELETE_TASK, HILINK_DeleteTask, HiLinkTaskId, handle); -} - -HiLinkTaskId HILINK_GetCurrentTaskId(void) -{ - app_call0(APP_CALL_HILINK_GET_CURRENT_TASK_ID, HILINK_GetCurrentTaskId, HiLinkTaskId); - return NULL; -} - -HiLinkMutexId HILINK_MutexCreate(void) -{ - app_call0(APP_CALL_HILINK_MUTEX_CREATE, HILINK_MutexCreate, HiLinkMutexId); - return NULL; -} - -int HILINK_MutexLock(HiLinkMutexId mutex, unsigned int ms) -{ - app_call2(APP_CALL_HILINK_MUTEX_LOCK, HILINK_MutexLock, int, HiLinkMutexId, mutex, unsigned int, ms); - return 0; -} - -int HILINK_MutexUnlock(HiLinkMutexId mutex) -{ - app_call1(APP_CALL_HILINK_MUTEX_UNLOCK, HILINK_MutexUnlock, int, HiLinkMutexId, mutex); - return 0; -} - -void HILINK_MutexDestroy(HiLinkMutexId mutex) -{ - app_call1_ret_void(APP_CALL_HILINK_MUTEX_DESTROY, HILINK_MutexDestroy, HiLinkMutexId, mutex); -} - -HiLinkSemId HILINK_SemCreate(unsigned int count) -{ - app_call1(APP_CALL_HILINK_SEM_CREATE, HILINK_SemCreate, HiLinkSemId, unsigned int, count); - return NULL; -} - -int HILINK_SemWait(HiLinkSemId handle, unsigned int ms) -{ - app_call2(APP_CALL_HILINK_SEM_WAIT, HILINK_SemWait, int, HiLinkSemId, handle, unsigned int, ms); - return 0; -} - -int HILINK_SemPost(HiLinkSemId handle) -{ - app_call1(APP_CALL_HILINK_SEM_POST, HILINK_SemPost, int, HiLinkSemId, handle); - return 0; -} - -void HILINK_SemDestroy(HiLinkSemId handle) -{ - app_call1_ret_void(APP_CALL_HILINK_SEM_DESTROY, HILINK_SemDestroy, HiLinkSemId, handle); -} - -int HILINK_MilliSleep(unsigned int ms) -{ - app_call1(APP_CALL_HILINK_MILLI_SLEEP, HILINK_MilliSleep, int, unsigned int, ms); - return 0; -} - -void HILINK_SchedYield(void) -{ - app_call0_ret_void(APP_CALL_HILINK_SCHED_YIELD, HILINK_SchedYield); -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_time_adapter.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_time_adapter.c deleted file mode 100755 index 00b8841..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_time_adapter.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the Time Adaptation Layer Interface. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_time_adapter.h" - -int HILINK_GetOsTime(HiLinkTimeval *time) -{ - app_call1(APP_CALL_HILINK_GET_OS_TIME, HILINK_GetOsTime, int, HiLinkTimeval *, time); - return 0; -} - -int HILINK_GetUtcTime(HiLinkTimeval *time) -{ - app_call1(APP_CALL_HILINK_GET_UTC_TIME, HILINK_GetUtcTime, int, HiLinkTimeval *, time); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_tls_client.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_tls_client.c deleted file mode 100755 index 8237252..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_hilink_tls_client.c +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Common operations on the TLS client, including session creation and destruction. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "app_call.h" -#include "hilink_tls_client.h" - -HiLinkTlsClient *HILINK_TlsClientCreate(const char *custom) -{ - app_call1(APP_CALL_HILINK_TLS_CLIENT_CREATE, HILINK_TlsClientCreate, HiLinkTlsClient *, const char *, custom); - return NULL; -} - -int HILINK_SetTlsClientOption(HiLinkTlsClient *ctx, HiLinkTlsOption option, const void *value, unsigned int len) -{ - app_call4(APP_CALL_HILINK_SET_TLS_CLIENT_OPTION, HILINK_SetTlsClientOption, int, - HiLinkTlsClient *, ctx, HiLinkTlsOption, option, const void *, value, unsigned int, len); - return 0; -} - -int HILINK_TlsClientConnect(HiLinkTlsClient *ctx) -{ - app_call1(APP_CALL_HILINK_TLS_CLIENT_CONNECT, HILINK_TlsClientConnect, int, HiLinkTlsClient *, ctx); - return 0; -} - -int HILINK_TlsClientGetContextFd(HiLinkTlsClient *ctx) -{ - app_call1(APP_CALL_HILINK_TLS_CLIENT_GET_CONTEXT_FD, HILINK_TlsClientGetContextFd, int, HiLinkTlsClient *, ctx); - return 0; -} - -int HILINK_TlsClientRead(HiLinkTlsClient *ctx, unsigned char *buf, size_t len) -{ - app_call3(APP_CALL_HILINK_TLS_CLIENT_READ, HILINK_TlsClientRead, int, - HiLinkTlsClient *, ctx, unsigned char *, buf, size_t, len); - return 0; -} - -int HILINK_TlsClientWrite(HiLinkTlsClient *ctx, const unsigned char *buf, size_t len) -{ - app_call3(APP_CALL_HILINK_TLS_CLIENT_WRITE, HILINK_TlsClientWrite, int, - HiLinkTlsClient *, ctx, const unsigned char *, buf, size_t, len); - return 0; -} - -bool HILINK_TlsClientIsValidCert(HiLinkTlsClient *ctx) -{ - app_call1(APP_CALL_HILINK_TLS_CLIENT_IS_VALID_CERT, HILINK_TlsClientIsValidCert, bool, HiLinkTlsClient *, ctx); - return false; -} - -int HILINK_TlsClientFreeResource(HiLinkTlsClient *ctx) -{ - app_call1(APP_CALL_HILINK_TLS_CLIENT_FREE_RESOURCE, HILINK_TlsClientFreeResource, int, HiLinkTlsClient *, ctx); - return 0; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_mbed_tls.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_mbed_tls.c deleted file mode 100755 index 107c5ad..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_mbed_tls.c +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of cJSON in sdk side. \n - * - * History: \n - * 2024-11-26, Create file. \n - */ - -#include "app_call.h" -#include "mbedtls/md.h" -#include "mbedtls/ctr_drbg.h" -#include "mbedtls/bignum.h" -#include "mbedtls/ecdh.h" -#include "mbedtls/hkdf.h" -#include "mbedtls/entropy.h" -#include "mbedtls/sha256.h" -#include "mbedtls/ecp.h" - -const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type) -{ - app_call1(APP_CALL_MBEDTLS_MD_INFO_FROM_TYPE, mbedtls_md_info_from_type, const mbedtls_md_info_t *, - mbedtls_md_type_t, md_type); - return NULL; -} - -void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_CTR_DRBG_INIT, mbedtls_ctr_drbg_init, mbedtls_ctr_drbg_context *, ctx); -} - -void mbedtls_mpi_init(mbedtls_mpi *X) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_MPI_INIT, mbedtls_mpi_init, mbedtls_mpi *, X); -} - -void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_ECDH_INIT, mbedtls_ecdh_init, mbedtls_ecdh_context *, ctx); -} - -int mbedtls_ctr_drbg_random(void *p_rng, unsigned char *output, size_t output_len) -{ - app_call3(APP_CALL_MBEDTLS_CTR_DRBG_RANDOM, mbedtls_ctr_drbg_random, int, - void *, p_rng, unsigned char *, output, size_t, output_len); - return 0; -} - -int mbedtls_mpi_read_binary(mbedtls_mpi *X, const unsigned char *buf, size_t buflen) -{ - app_call3(APP_CALL_MBEDTLS_MPI_READ_BINARY, mbedtls_mpi_read_binary, int, - mbedtls_mpi *, X, const unsigned char *, buf, size_t, buflen); - return 0; -} - -int mbedtls_mpi_sub_mpi(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *B) -{ - app_call3(APP_CALL_MBEDTLS_MPI_SUB_MPI, mbedtls_mpi_sub_mpi, int, - mbedtls_mpi *, X, const mbedtls_mpi *, A, const mbedtls_mpi *, B); - return 0; -} - -int mbedtls_hkdf(const mbedtls_md_info_t *md, const unsigned char *salt, - size_t salt_len, const unsigned char *ikm, size_t ikm_len, - const unsigned char *info, size_t info_len, - unsigned char *okm, size_t okm_len) -{ - app_call9(APP_CALL_MBEDTLS_HKDF, mbedtls_hkdf, int, - const mbedtls_md_info_t *, md, const unsigned char *, salt, - size_t, salt_len, const unsigned char *, ikm, size_t, ikm_len, - const unsigned char *, info, size_t, info_len, - unsigned char *, okm, size_t, okm_len); - return 0; -} - -unsigned char mbedtls_md_get_size(const mbedtls_md_info_t *md_info) -{ - app_call1(APP_CALL_MBEDTLS_MD_GET_SIZE, mbedtls_md_get_size, unsigned char, - const mbedtls_md_info_t *, md_info); - return 0; -} - -void mbedtls_entropy_init(mbedtls_entropy_context *ctx) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_ENTROPY_INIT, mbedtls_entropy_init, mbedtls_entropy_context *, ctx); -} - -int mbedtls_mpi_cmp_mpi(const mbedtls_mpi *X, const mbedtls_mpi *Y ) -{ - app_call2(APP_CALL_MBEDTLS_MPI_CMP_MPI, mbedtls_mpi_cmp_mpi, int, - const mbedtls_mpi *, X, const mbedtls_mpi *, Y); - return 0; -} - -typedef int (*func_rng_t)(void *, unsigned char *, size_t); -int mbedtls_ecdh_compute_shared(mbedtls_ecp_group *grp, mbedtls_mpi *z, - const mbedtls_ecp_point *Q, const mbedtls_mpi *d, - func_rng_t f_rng, - void *p_rng) -{ - app_call6(APP_CALL_MBEDTLS_ECDH_COMPUTE_SHARED, mbedtls_ecdh_compute_shared, int, - mbedtls_ecp_group *, grp, mbedtls_mpi *, z, - const mbedtls_ecp_point *, Q, const mbedtls_mpi *, d, - func_rng_t, f_rng, - void *, p_rng); - return 0; -} - -int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, - const mbedtls_mpi *E, const mbedtls_mpi *N, - mbedtls_mpi *prec_RR) -{ - app_call5(APP_CALL_MBEDTLS_MPI_EXP_MOD, mbedtls_mpi_exp_mod, int, - mbedtls_mpi *, X, const mbedtls_mpi *, A, - const mbedtls_mpi *, E, const mbedtls_mpi *, N, - mbedtls_mpi *, prec_RR); - return 0; -} - -int mbedtls_mpi_mod_mpi(mbedtls_mpi *R, const mbedtls_mpi *A, const mbedtls_mpi *B) -{ - app_call3(APP_CALL_MBEDTLS_MPI_MOD_MPI, mbedtls_mpi_mod_mpi, int, - mbedtls_mpi *, R, const mbedtls_mpi *, A, const mbedtls_mpi *, B); - return 0; -} - -int mbedtls_sha256(const unsigned char *input, size_t ilen, unsigned char *output, int is224) -{ - app_call4(APP_CALL_MBEDTLS_SHA256, mbedtls_sha256, int, - const unsigned char *, input, size_t, ilen, unsigned char *, output, int, is224); - return 0; -} - -void mbedtls_mpi_free(mbedtls_mpi *X) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_MPI_FREE, mbedtls_mpi_free, mbedtls_mpi *, X); -} - -int mbedtls_mpi_write_binary(const mbedtls_mpi *X, unsigned char *buf, size_t buflen) -{ - app_call3(APP_CALL_MBEDTLS_MPI_WRITE_BINARY, mbedtls_sha256, int, - const mbedtls_mpi *, X, unsigned char *, buf, size_t, buflen); - return 0; -} - -int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *B) -{ - app_call3(APP_CALL_MBEDTLS_MPI_MUL_MPI, mbedtls_mpi_mul_mpi, int, - mbedtls_mpi *, X, const mbedtls_mpi *, A, const mbedtls_mpi *, B); - return 0; -} - -int mbedtls_mpi_add_mpi(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *B) -{ - app_call3(APP_CALL_MBEDTLS_MPI_ADD_MPI, mbedtls_mpi_add_mpi, int, - mbedtls_mpi *, X, const mbedtls_mpi *, A, const mbedtls_mpi *, B); - return 0; -} - -int mbedtls_entropy_func(void *data, unsigned char *output, size_t len) -{ - app_call3(APP_CALL_MBEDTLS_ENTROPY_FUNC, mbedtls_entropy_func, int, - void *, data, unsigned char *, output, size_t, len); - return 0; -} - -void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_ECDH_FREE, mbedtls_ecdh_free, mbedtls_ecdh_context *, ctx); -} - -int mbedtls_mpi_inv_mod(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *N) -{ - app_call3(APP_CALL_MBEDTLS_MPI_INV_MOD, mbedtls_mpi_inv_mod, int, - mbedtls_mpi *, X, const mbedtls_mpi *, A, const mbedtls_mpi *, N); - return 0; -} - -typedef int (*func_entropy_t)(void *, unsigned char *, size_t); -int mbedtls_ctr_drbg_seed(mbedtls_ctr_drbg_context *ctx, - func_entropy_t f_entropy, - void *p_entropy, const unsigned char *custom, size_t len) -{ - app_call5(APP_CALL_MBEDTLS_CTR_DRBG_SEED, mbedtls_ctr_drbg_seed, int, - mbedtls_ctr_drbg_context *, ctx, - func_entropy_t, f_entropy, - void *, p_entropy, const unsigned char *, custom, size_t, len); - return 0; -} - -void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_CTR_DRBG_FREE, mbedtls_ctr_drbg_free, mbedtls_ctr_drbg_context *, ctx); - -} - -int mbedtls_mpi_copy(mbedtls_mpi *X, const mbedtls_mpi *Y) -{ - app_call2(APP_CALL_MBEDTLS_MPI_COPY, mbedtls_mpi_copy, int, - mbedtls_mpi *, X, const mbedtls_mpi *, Y); - return 0; -} - -void mbedtls_entropy_free( mbedtls_entropy_context *ctx ) -{ - app_call1_ret_void(APP_CALL_MBEDTLS_ENTROPY_FREE, mbedtls_entropy_free, mbedtls_entropy_context *, ctx); -} - -int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) -{ - app_call2(APP_CALL_MBEDTLS_ECP_GROUP_LOAD, mbedtls_ecp_group_load, int, - mbedtls_ecp_group *, grp, mbedtls_ecp_group_id, id); - return 0; -} - -int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char assign ) -{ - app_call3(APP_CALL_MBEDTLS_MPI_SAFE_COND_SWAP, mbedtls_mpi_safe_cond_swap, int, - mbedtls_mpi *, X, mbedtls_mpi *, Y, unsigned char, assign); - return 0; -} - -int mbedtls_mpi_lset( mbedtls_mpi *X, mbedtls_mpi_sint z ) -{ - app_call2(APP_CALL_MBEDTLS_MPI_LSET, mbedtls_mpi_lset, int, - mbedtls_mpi *, X, mbedtls_mpi_sint, z); - return 0; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_connection_manager.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_connection_manager.c deleted file mode 100755 index eb747f5..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_connection_manager.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the sle connection manager. \n - * - * History: \n - * 2024-11-13, Create file. \n - */ - -#include "app_call.h" -#include "oh_sle_common.h" -#include "oh_sle_connection_manager.h" -#include "oh_sle_errcode.h" - -ErrCodeType SleDisconnectRemoteDevice(const SleAddr *addr) -{ - app_call1(APP_CALL_SLE_DISCONNECT_REMOTE_DEVICE, SleDisconnectRemoteDevice, ErrCodeType, - const SleAddr *, addr); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleConnectionRegisterCallbacks(SleConnectionCallbacks *func) -{ - app_call1(APP_CALL_SLE_CONNECTION_REGISTER_CALLBACKS, SleConnectionRegisterCallbacks, ErrCodeType, - SleConnectionCallbacks *, func); - return OH_ERRCODE_SLE_MAX; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_device_discovery.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_device_discovery.c deleted file mode 100755 index 0e80f92..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_device_discovery.c +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the sle device discovery. \n - * - * History: \n - * 2024-11-13, Create file. \n - */ - -#include "app_call.h" -#include "oh_sle_device_discovery.h" -#include "oh_sle_errcode.h" - -ErrCodeType EnableSle(void) -{ - app_call0(APP_CALL_ENABLE_SLE, EnableSle, ErrCodeType); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType DisableSle(void) -{ - app_call0(APP_CALL_DISABLE_SLE, DisableSle, ErrCodeType); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleGetLocalAddr(SleAddr *addr) -{ - app_call1(APP_CALL_SLE_GET_LOCAL_ADDR, SleGetLocalAddr, ErrCodeType, - SleAddr *, addr); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleSetLocalName(const uint8_t *name, uint8_t len) -{ - app_call2(APP_CALL_SLE_SET_LOCAL_NAME, SleSetLocalName, ErrCodeType, - const uint8_t *, name, uint8_t, len); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleSetAnnounceData(uint8_t announceId, const SleAnnounceData *data) -{ - app_call2(APP_CALL_SLE_SET_ANNOUNCE_DATA, SleSetAnnounceData, ErrCodeType, - uint8_t, announceId, const SleAnnounceData *, data); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleSetAnnounceParam(uint8_t announceId, const SleAnnounceParam *param) -{ - app_call2(APP_CALL_SLE_SET_ANNOUNCE_PARAM, SleSetAnnounceParam, ErrCodeType, - uint8_t, announceId, const SleAnnounceParam *, param); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleStartAnnounce(uint8_t announceId) -{ - app_call1(APP_CALL_SLE_START_ANNOUNCE, SleStartAnnounce, ErrCodeType, - uint8_t, announceId); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleStopAnnounce(uint8_t announceId) -{ - app_call1(APP_CALL_SLE_STOP_ANNOUNCE, SleStopAnnounce, ErrCodeType, - uint8_t, announceId); - return OH_ERRCODE_SLE_MAX; -} - -ErrCodeType SleAnnounceSeekRegisterCallbacks(SleAnnounceSeekCallbacks *func) -{ - app_call1(APP_CALL_SLE_ANNOUNCE_SEEK_REGISTER_CALLBACKS, SleAnnounceSeekRegisterCallbacks, ErrCodeType, - SleAnnounceSeekCallbacks *, func); - return OH_ERRCODE_SLE_MAX; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_ssap_server.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_ssap_server.c deleted file mode 100755 index e29624d..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/app_uapi/uapi_oh_sle_ssap_server.c +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. - * - * Description: Implementation of the sle ssap server. \n - * - * History: \n - * 2024-11-13, Create file. \n - */ - -#include "app_call.h" -#include "oh_sle_ssap_server.h" -#include "errcode.h" - -errcode_t ssapsRegisterServer(SleUuid *appUuid, uint8_t *serverId) -{ - app_call2(APP_CALL_SSAPS_REGISTER_SERVER, ssapsRegisterServer, errcode_t, - SleUuid *, appUuid, uint8_t *, serverId); - return ERRCODE_FAIL; -} - -errcode_t SsapsAddServiceSync(uint8_t serverId, SleUuid *serviceUuid, bool isPrimary, uint16_t *handle) -{ - app_call4(APP_CALL_SSAPS_ADD_SERVICE_SYNC, SsapsAddServiceSync, errcode_t, - uint8_t, serverId, SleUuid *, serviceUuid, bool, isPrimary, uint16_t *, handle); - return ERRCODE_FAIL; -} - -errcode_t SsapsAddPropertySync(uint8_t serverId, uint16_t serviceHandle, SsapsPropertyInfo *property, - uint16_t *handle) -{ - app_call4(APP_CALL_SSAPS_ADD_PROPERTY_SYNC, SsapsAddPropertySync, errcode_t, - uint8_t, serverId, uint16_t, serviceHandle, SsapsPropertyInfo *, property, uint16_t *, handle); - return ERRCODE_FAIL; -} - -errcode_t SsapsAddDescriptorSync(uint8_t serverId, uint16_t serviceHandle, uint16_t propertyHandle, - SsapsDescInfo *descriptor) -{ - app_call4(APP_CALL_SSAPS_ADD_DESCRIPTOR_SYNC, SsapsAddDescriptorSync, errcode_t, - uint8_t, serverId, uint16_t, serviceHandle, uint16_t, propertyHandle, SsapsDescInfo *, descriptor); - return ERRCODE_FAIL; -} - -errcode_t SsapsStartService(uint8_t serverId, uint16_t serviceHandle) -{ - app_call2(APP_CALL_SSAPS_START_SERVICE, SsapsStartService, errcode_t, - uint8_t, serverId, uint16_t, serviceHandle); - return ERRCODE_FAIL; -} - -errcode_t SsapsDeleteAllServices(uint8_t serverId) -{ - app_call1(APP_CALL_SSAPS_DELETE_ALL_SERVICES, SsapsDeleteAllServices, errcode_t, - uint8_t, serverId); - return ERRCODE_FAIL; -} - -errcode_t SsapsSendResponse(uint8_t serverId, uint16_t connId, SsapsSendRsp *param) -{ - app_call3(APP_CALL_SSAPS_SEND_RESPONSE, SsapsSendResponse, errcode_t, - uint8_t, serverId, uint16_t, connId, SsapsSendRsp *, param); - return ERRCODE_FAIL; -} - -errcode_t SsapsNotifyIndicate(uint8_t serverId, uint16_t connId, SsapsNtfInd *param) -{ - app_call3(APP_CALL_SSAPS_NOTIFY_INDICATE, SsapsNotifyIndicate, errcode_t, - uint8_t, serverId, uint16_t, connId, SsapsNtfInd *, param); - return ERRCODE_FAIL; -} - -errcode_t SsapsRegisterCallbacks(SsapsCallbacks *func) -{ - app_call1(APP_CALL_SSAPS_REGISTER_CALLBACKS, SsapsRegisterCallbacks, errcode_t, - SsapsCallbacks *, func); - return ERRCODE_FAIL; -} \ No newline at end of file diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.c deleted file mode 100755 index 6177950..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.c +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: hilink call entry. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#include "hilink_call_entry.h" -#include "hilink_function_mapping.h" -#include "func_call.h" - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0L -#else -#define NULL ((void*)0) -#endif -#endif - -#define BITS_PER_BYTES 8 -#define CRC32_TBL_SIZE 256 - -unsigned int g_crc32_tbl[CRC32_TBL_SIZE] = { 0 }; - -static api_get g_app_api_get = NULL; - -void *get_app_api_addr(unsigned int index, const char *prototype) -{ - return g_app_api_get == NULL ? NULL : g_app_api_get(index, prototype); -} - -static void init_crc32_table(void) -{ - for (unsigned int i = 0; i < CRC32_TBL_SIZE; i++) { - unsigned int tmp = i; - for (unsigned char bit = 0; bit < BITS_PER_BYTES; bit++) { - if ((tmp & 1) != 0) { - /* 0xEDB88320 为 CRC32 的生成多项式的反转 */ - tmp = (tmp >> 1) ^ 0xEDB88320; - } else { - tmp = tmp >> 1; - } - } - g_crc32_tbl[i] = tmp; - } -} - -static unsigned int prototype_cal_crc32(const char *input) -{ - unsigned int checksum = 0xFFFFFFFF; - for (unsigned int i = 0; input[i] != 0; i++) { - if (input[i] == ' ') { - continue; - } - checksum = (checksum >> BITS_PER_BYTES) ^ (g_crc32_tbl[(checksum ^ input[i]) & 0xFF]); - } - return ~checksum; -} - -/* copy ram */ -static void copy_bin_to_ram(unsigned int *start_addr, - const unsigned int *const load_addr, unsigned int size) -{ - unsigned int i; - - for (i = 0; i < size / sizeof(unsigned int); i++) { - *(start_addr + i) = *(load_addr + i); - } -} - -/* init ram value */ -static void init_mem_value(unsigned int *start_addr, - const unsigned int *const end_addr, unsigned int init_val) -{ - unsigned int *dest = start_addr; - - while (dest < end_addr) { - *dest = init_val; - dest++; - } -} - -static void *hilink_api_get(unsigned int index, const char *prototype) -{ - const struct mapping_tbl *hilink_call_tbl = get_hilink_mapping_tbl(); - unsigned int size = get_hilink_mapping_tbl_size(); - if (hilink_call_tbl == NULL || size == 0) { - return NULL; - } - - unsigned int checksum = prototype_cal_crc32(prototype); - if ((index < size) && (hilink_call_tbl[index].checksum == checksum)) { - return hilink_call_tbl[index].addr; - } - /* 对应校验和不匹配,尝试全部匹配 */ - for (unsigned int i = 0; i < size; i++) { - if (hilink_call_tbl[i].checksum == checksum) { - return hilink_call_tbl[i].addr; - } - } - return NULL; -} - -static void hilink_info_entry(api_get *hilink_get, api_get app_get) -{ - if (hilink_get == NULL || app_get == NULL) { - return; - } -#ifndef CHIP_EDA - /* copy sram_text from flash to SRAM */ - copy_bin_to_ram(&__sram_text_begin__, &__sram_text_load__, (unsigned int)&__sram_text_size__); - /* copy data from flash to SRAM */ - copy_bin_to_ram(&__data_begin__, &__data_load__, (unsigned int)&__data_size__); - /* clear bss on SRAM */ - init_mem_value(&__bss_begin__, &__bss_end__, 0); -#endif - - *hilink_get = hilink_api_get; - g_app_api_get = app_get; - init_crc32_table(); -} - -__attribute__ ((used, section(".hilink_info"))) struct hilink_info_stru hilink_info = { - hilink_info_entry, -}; diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.h deleted file mode 100755 index e6c97d6..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_call_entry.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: hilink call entry. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#ifndef HILINK_CALL_ENTRY_H -#define HILINK_CALL_ENTRY_H - -#ifdef __cplusplus -extern "C" { -#endif - -void *get_app_api_addr(unsigned int index, const char *prototype); - -extern unsigned int __bss_begin__; -extern unsigned int __bss_end__; -extern unsigned int __data_begin__; -extern unsigned int __data_load__; -extern unsigned int __data_size__; - -extern unsigned int __sram_text_begin__; -extern unsigned int __sram_text_load__; -extern unsigned int __sram_text_size__; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.c b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.c deleted file mode 100755 index 37b4c02..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.c +++ /dev/null @@ -1,89 +0,0 @@ - -#include "hilink_function_mapping.h" -#include "func_call.h" -#include "func_call_list.h" -#include "hilink.h" -#include "hilink_log_manage.h" -#include "ble_cfg_net_api.h" -#include "hilink_bt_function.h" -#include "hilink_custom.h" -#include "hilink_sle_api.h" -#include "hilink_quick_netcfg_api.h" -#include "hilink_quick_netcfg_adapter.h" -#include "hilink_bt_api.h" -#include "hilink_device.h" -#include "hilink_network_adapter.h" -#include "hilink_socket_adapter.h" - -static const struct mapping_tbl g_hilink_call_tbl[HILINK_CALL_MAX] = { - [HILINK_CALL_HILINK_REGISTER_BASE_CALLBACK] = { HILINK_RegisterBaseCallback, 0xBEC62B3A }, - [HILINK_CALL_HILINK_MAIN] = { HILINK_Main, 0x1B90717B }, - [HILINK_CALL_HILINK_RESET] = { HILINK_Reset, 0xABD8C9AD }, - [HILINK_CALL_HILINK_SET_SDK_ATTR] = { HILINK_SetSdkAttr, 0x15D3BE15 }, - [HILINK_CALL_HILINK_GET_SDK_ATTR] = { HILINK_GetSdkAttr, 0x60977111 }, - [HILINK_CALL_HILINK_RESTORE_FACTORY_SETTINGS] = { HILINK_RestoreFactorySettings, 0xA022C59C }, - [HILINK_CALL_HILINK_GET_DEV_STATUS] = { HILINK_GetDevStatus, 0xEF399A97 }, - [HILINK_CALL_HILINK_GET_SDK_VERSION] = { HILINK_GetSdkVersion, 0xE8B1D1D2 }, - [HILINK_CALL_HILINK_REPORT_CHAR_STATE] = { HILINK_ReportCharState, 0xD981EE97 }, - [HILINK_CALL_HILINK_IS_REGISTER] = { HILINK_IsRegister, 0x2F4C881D }, - [HILINK_CALL_HILINK_GET_NETWORKING_MODE] = { HILINK_GetNetworkingMode, 0x0D3D30D8 }, - [HILINK_CALL_HILINK_GET_REGISTER_STATUS] = { HILINK_GetRegisterStatus, 0x165FA46B }, - [HILINK_CALL_HILINK_SET_SCHEDULE_INTERVAL] = { HILINK_SetScheduleInterval, 0xEB1F07B4 }, - [HILINK_CALL_HILINK_SET_MONITOR_SCHEDULE_INTERVAL] = { HILINK_SetMonitorScheduleInterval, 0xB8F1AECE }, - [HILINK_CALL_HILINK_SET_NET_CONFIG_MODE] = { HILINK_SetNetConfigMode, 0xA4335DFC }, - [HILINK_CALL_HILINK_GET_NET_CONFIG_MODE] = { HILINK_GetNetConfigMode, 0x7388E123 }, - [HILINK_CALL_HILINK_SET_NET_CONFIG_TIMEOUT] = { HILINK_SetNetConfigTimeout, 0x4641EDD1 }, - [HILINK_CALL_HILINK_SET_OTA_BOOT_TIME] = { HILINK_SetOtaBootTime, 0xAF31DFED }, - [HILINK_CALL_HILINK_ENABLE_KITFRAMEWORK] = { HILINK_EnableKitframework, 0xB616EBF0 }, - [HILINK_CALL_HILINK_ENABLE_BATCH_CONTROL] = { HILINK_EnableBatchControl, 0xA9900778 }, - [HILINK_CALL_HILINK_ENABLE_PROCESS_DEL_ERR_CODE] = { HILINK_EnableProcessDelErrCode, 0xC03C4467 }, - [HILINK_CALL_HILINK_UNBIND_DEVICE] = { HILINK_UnbindDevice, 0xD3CBCD65 }, - [HILINK_CALL_HILINK_SET_DEVICE_INSTALL_TYPE] = { HILINK_SetDeviceInstallType, 0x40F51D66 }, - [HILINK_CALL_HILINK_GET_DEV_SETUP_TYPE] = { HILINK_GetDevSetupType, 0xCBE0FF99 }, - [HILINK_CALL_HILINK_ENABLE_DEV_ID_INHERIT] = { HILINK_EnableDevIdInherit, 0x8506BA06 }, - [HILINK_CALL_HILINK_NOTIFY_NETWORK_AVAILABLE] = { HILINK_NotifyNetworkAvailable, 0x448D8BEB }, - [HILINK_CALL_HILINK_SET_LOG_LEVEL] = { HILINK_SetLogLevel, 0x6CDA8E9E }, - [HILINK_CALL_HILINK_GET_LOG_LEVEL] = { HILINK_GetLogLevel, 0x79BE4C8B }, - [HILINK_CALL_HILINK_REGISTER_GET_AC_V2_FUNC] = { HILINK_RegisterGetAcV2Func, 0xF15449A4 }, - [HILINK_CALL_BLE_CFG_NET_INIT] = { BLE_CfgNetInit, 0xDEFEB22F }, - [HILINK_CALL_BLE_CFG_NET_DE_INIT] = { BLE_CfgNetDeInit, 0x342B09F0 }, - [HILINK_CALL_BLE_CFG_NET_ADV_CTRL] = { BLE_CfgNetAdvCtrl, 0x3683E17D }, - [HILINK_CALL_BLE_CFG_NET_ADV_UPDATE] = { BLE_CfgNetAdvUpdate, 0x699DA475 }, - [HILINK_CALL_BLE_CFG_NET_DIS_CONNECT] = { BLE_CfgNetDisConnect, 0xD08A2F07 }, - [HILINK_CALL_BLE_SEND_CUSTOM_DATA] = { BLE_SendCustomData, 0x9EDA59B9 }, - [HILINK_CALL_BLE_GET_ADV_TYPE] = { BLE_GetAdvType, 0x9A96CD0E }, - [HILINK_CALL_BLE_SET_ADV_TYPE] = { BLE_SetAdvType, 0x468B0892 }, - [HILINK_CALL_BLE_SET_ADV_NAME_MPP] = { BLE_SetAdvNameMpp, 0x24120EE9 }, - [HILINK_CALL_BLE_NEAR_DISCOVERY_INIT] = { BLE_NearDiscoveryInit, 0x6B86A8BB }, - [HILINK_CALL_BLE_NEAR_DISCOVERY_ENABLE] = { BLE_NearDiscoveryEnable, 0x4B250B35 }, - [HILINK_CALL_HILINK_BT_GET_TASK_STACK_SIZE] = { HILINK_BT_GetTaskStackSize, 0xE0E8B8A1 }, - [HILINK_CALL_HILINK_BT_SET_TASK_STACK_SIZE] = { HILINK_BT_SetTaskStackSize, 0xE77FE8A1 }, - [HILINK_CALL_HILINK_BT_SET_SDK_EVENT_CALLBACK] = { HILINK_BT_SetSdkEventCallback, 0x3F50CF8B }, - [HILINK_CALL_HILINK_BT_HARD_REVOKE] = { HILINK_BT_HardRevoke, 0x018FA5A9 }, - [HILINK_CALL_HILINK_REG_WI_FI_RECOVERY_CALLBACK] = { HILINK_RegWiFiRecoveryCallback, 0x1475DDA9 }, - [HILINK_CALL_HILINK_REGISTER_ERRNO_CALLBACK] = { HILINK_RegisterErrnoCallback, 0x32141DAF }, - [HILINK_CALL_HILINK_SET_PROT_TYPE] = { HILINK_SetProtType, 0x1F5C4D9C }, - [HILINK_CALL_HILINK_ENABLE_PRESCAN] = { HILINK_EnablePrescan, 0x5D7F8DC8 }, - [HILINK_CALL_HILINK_SET_NET_CONFIG_INFO] = { HILINK_SetNetConfigInfo, 0xE3CB582D }, - [HILINK_CALL_HILINK_SET_SOFT_APMODE] = { HILINK_SetSoftAPMode, 0x0DB0EA88 }, - [HILINK_CALL_HILINK_REQUEST_REG_INFO] = { HILINK_RequestRegInfo, 0x23396BF6 }, - [HILINK_CALL_HILINK_DIAGNOSIS_INFO_RECORD] = { HILINK_DiagnosisInfoRecord, 0xBC0A30D6 }, - [HILINK_CALL_HILINK_ENABLE_SLE] = { HILINK_EnableSle, 0x8B968BEE }, - [HILINK_CALL_HILINK_SET_QUICK_CFG_COMMON_LOADER] = { HILINK_SetQuickCfgCommonLoader, 0x77AB6014 }, - [HILINK_CALL_HILINK_START_QUICK_CFG] = { HILINK_StartQuickCfg, 0x036385A6 }, - [HILINK_CALL_HILINK_FRAME_PARSE] = { HILINK_FrameParse, 0x8BB35701 }, - [HILINK_CALL_HILINK_QUICK_CFG_CMD_PARSE] = { HILINK_QuickCfgCmdParse, 0xD274404A }, - [HILINK_CALL_HILINK_SET_DEVICE_TYPE] = { HILINK_SetDeviceType, 0x9BFA2434 }, - [HILINK_CALL_HILINK_SET_QUICK_CFG_WIFI_LOADER] = { HILINK_SetQuickCfgWifiLoader, 0x8E7321F6 }, - [HILINK_CALL_HILINK_ENABLE_QUICK_NET_CFG] = { HILINK_EnableQuickNetCfg, 0x3FEA98B7 }, -}; - -const struct mapping_tbl *get_hilink_mapping_tbl(void) -{ - return g_hilink_call_tbl; -} - -unsigned int get_hilink_mapping_tbl_size(void) -{ - return HILINK_CALL_MAX; -} diff --git a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.h b/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.h deleted file mode 100755 index f75dd44..0000000 --- a/application/samples/wifi/hilink_indie_upgrade/address_mapping/hilinksdk/hilink_function_mapping.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2025. All rights reserved. - * - * Description: hilink function mapping. \n - * - * History: \n - * 2024-01-27, Create file. \n - */ - -#ifndef HILINK_FUNCTION_MAPPING_H -#define HILINK_FUNCTION_MAPPING_H - -#ifdef __cplusplus -extern "C" { -#endif - -const struct mapping_tbl *get_hilink_mapping_tbl(void); -unsigned int get_hilink_mapping_tbl_size(void); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/application/samples/wifi/ohos_connect/CMakeLists.txt b/application/samples/wifi/ohos_connect/CMakeLists.txt deleted file mode 100755 index 2842656..0000000 --- a/application/samples/wifi/ohos_connect/CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -#=============================================================================== -set(HILINK_LIBS_DIR ${ROOT_DIR}/application/samples/wifi/libhilink) - -if (NOT DEFINES MATCHES "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE") -set(COMPONENT_NAME "hilinkdevicesdk") -set(LIBS ${HILINK_LIBS_DIR}/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -set(COMPONENT_NAME "hilinkota") -set(LIBS ${HILINK_LIBS_DIR}/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -set(COMPONENT_NAME "hilinkbtsdk") -set(LIBS ${HILINK_LIBS_DIR}/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() - -if (DEFINES MATCHES "SUPPORT_QUICK_NETCFG") -set(COMPONENT_NAME "hilinkquickcfg") -set(LIBS ${HILINK_LIBS_DIR}/lib${COMPONENT_NAME}.a) -set(WHOLE_LINK - true -) -build_component() -endif() - -endif() - -set(COMPONENT_NAME "hilink") - -set(CMAKE_HILINK_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}) - -set(SOURCES - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/product/hilink_device.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_kv_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_open_ota_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_base64.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_md.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_socket_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_str_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_time_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_mem_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_open_ota_mcu_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_drbg.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_mpi.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_softap_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sys_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_tls_client.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_network_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_aes.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_kdf.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_sal_rsa.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_stdio_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_thread_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_ble_adapter.c - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/entry/hilink_entry.c -) - -if (DEFINES MATCHES "SUPPORT_MINIMALIST_NETCFG" OR DEFINES MATCHES "SUPPORT_BLE_ANCILLAY_NETCFG") - list(APPEND SOURCES ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/entry/hilink_ble_main.c) -endif() -if (DEFINES MATCHES "SUPPORT_SOFTAP_NETCFG") - list(APPEND SOURCES ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/entry/hilink_wifi_main.c) -endif() -if (DEFINES MATCHES "SUPPORT_QUICK_NETCFG") - list(APPEND SOURCES ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/hilink_quick_netcfg_demo.c) -endif() - -if (DEFINES MATCHES "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE") - list(APPEND SOURCES ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/entry/hilink_indie_upgrade_main.c) -endif() -set(PUBLIC_HEADER - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/include/ - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/product/ - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/include/ -) - -set(PRIVATE_HEADER - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/product/ - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/include/ - ${CMAKE_HILINK_SOURCE_DIR}/hilink_adapt/adapter/include/ - ${ROOT_DIR}/protocol/wifi/source/host/inc/liteOS - ${ROOT_DIR}/open_source/mbedtls/mbedtls_v3.1.0/harden/src/internal_include - ${ROOT_DIR}/include -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS -) - -set(COMPONENT_CCFLAGS - -Wno-error=logical-op - -Wno-error=sign-compare - -Wno-error=jump-misses-init - -Wno-sign-compare - -Wno-jump-misses-init - -Wno-error=unused-parameter - -Wno-unused-parameter - -Wno-unused-but-set-variable - -Wno-error=unused-variable -) - -set(PRIVATE_DEFINES - MBEDTLS_SHA256_ALT -) - -set(PUBLIC_DEFINES -) -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - false -) - -set(LIB_OUT_PATH ${BIN_DIR}/${CHIP}/libs/wifi/${TARGET_COMMAND}) - -build_component() \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_ble_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_ble_adapter.c index 9be827a..b7b5828 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_ble_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_ble_adapter.c @@ -48,9 +48,10 @@ static uint8_t g_gatt_write_flag = 0; /* 0:write 1:read */ static uint8_t g_service_flag = 0; /* 0:enable 1:disable start service */ static uint8_t g_server_id = INVALID_SERVER_ID; /* gatt server ID */ + typedef struct { int conn_id; - int attr_handle; /* The handle of the attribute to be read */ + int attr_handle; /* The handle of the attribute to be read */ BleGattServiceRead read; BleGattServiceWrite write; BleGattServiceIndicate indicate; @@ -187,8 +188,10 @@ int SetBleAndSleAddrToStackFromNv(void) } HILINK_SAL_NOTICE("set ble stack addr success %02x:%02x:%02x:%02x:**:**\n", + /* 5:mac addr byte5,4:mac addr byte4,3:mac addr byte3,2:mac addr byte2 */ set_ble_addr.addr[5], set_ble_addr.addr[4], set_ble_addr.addr[3], set_ble_addr.addr[2]); HILINK_SAL_NOTICE("set sle stack addr success %02x:%02x:%02x:%02x:**:**\n", + /* 5:mac addr byte5,4:mac addr byte4,3:mac addr byte3,2:mac addr byte2 */ set_sle_addr.addr[5], set_sle_addr.addr[4], set_sle_addr.addr[3], set_sle_addr.addr[2]); return 0; } @@ -302,8 +305,9 @@ int ReadBtMacAddr(unsigned char *mac, unsigned int len) HILINK_SAL_ERROR("ret=%d\n", ret); return -1; } - HILINK_SAL_DEBUG("%s get ble mac %02x:%02x:%02x:%02x:**:**", BLE_HILINK_SERVER_LOG, - get_addr.addr[5], get_addr.addr[4], get_addr.addr[3], get_addr.addr[2]); + //HILINK_SAL_DEBUG("%s get ble mac %02x:%02x:%02x:%02x:**:**", BLE_HILINK_SERVER_LOG, + /* 5:mac addr byte5,4:mac addr byte4,3:mac addr byte3,2:mac addr byte2 */ + // get_addr.addr[5], get_addr.addr[4], get_addr.addr[3], get_addr.addr[2]); ret = memcpy_s(mac, len, get_addr.addr, sizeof(get_addr.addr)); if (ret != EOK) { HILINK_SAL_ERROR("ret=%d\n", ret); @@ -892,7 +896,8 @@ int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number ret = gatts_add_service_sync(g_server_id, &service_uuid, 1, &service_handle); g_service_flag = 1; if (ret != ERRCODE_BT_SUCCESS) { - HILINK_SAL_DEBUG("%s BleGattsStartServiceEx Add Service Fail, ret:%x !!!\n", BLE_HILINK_SERVER_LOG, ret); + HILINK_SAL_DEBUG("%s BleGattsStartServiceEx Add Service Fail, ret:%x !!!\n", + BLE_HILINK_SERVER_LOG, ret); } break; } @@ -1292,15 +1297,16 @@ int BleGattsRegisterCallbacks(BtGattServerCallbacks *func) static errcode_t ble_uuid_server_init(void) { + errcode_t ret = ERRCODE_BT_SUCCESS; bt_uuid_t app_uuid = {0}; - char uuid[] = { 0x12, 0x34 }; + char uuid[] = {0x12, 0x34}; app_uuid.uuid_len = sizeof(uuid); - int ret = memcpy_s(app_uuid.uuid, app_uuid.uuid_len, uuid, sizeof(uuid)); - if (ret != EOK) { + ret |= memcpy_s(app_uuid.uuid, app_uuid.uuid_len, uuid, sizeof(uuid)); + if (ret != 0) { HILINK_SAL_ERROR("ret=%d\n", ret); return -1; } - ret = gatts_register_server(&app_uuid, &g_server_id); + ret |= gatts_register_server(&app_uuid, &g_server_id); if (ret != ERRCODE_BT_SUCCESS) { HILINK_SAL_ERROR("%s gatts_register_server fail ret=%d.\n", BLE_HILINK_SERVER_LOG, ret); return -1; @@ -1383,7 +1389,7 @@ int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo) errcode_t ret = ERRCODE_BT_SUCCESS; uint8_t is_indicate = 0; BtUuid ble_uuid = {0}; - uint8_t temp_uuid[16] = {0}; + uint8_t temp_uuid[OHOS_BLE_UUID_MAX_LEN] = {0}; uint16_t service_handle = 0; if (g_server_id == INVALID_SERVER_ID) { @@ -1395,7 +1401,7 @@ int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo) for (unsigned int i = 0; i < srvcInfo->attrNum; i++) { BleGattAttr *attr = &(srvcInfo->attrList[i]); - (void)memcpy_s(temp_uuid, 16, attr->uuid, 16); + (void)memcpy_s(temp_uuid, sizeof(temp_uuid), attr->uuid, sizeof(attr->uuid)); convert_uuid(temp_uuid, attr->uuidType, &ble_uuid); switch (attr->attrType) { diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_kv_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_kv_adapter.c index 50bb7a9..69885fb 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_kv_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_kv_adapter.c @@ -398,7 +398,7 @@ int HILINK_GetValue(const char *key, unsigned int offset, unsigned char *value, void HILINK_DeleteValue(const char * key) { if ((key == NULL) || (key[0] == '\0')) { - HILINK_SAL_WARN("invalid parm\r\n"); + HILINK_SAL_NOTICE("invalid parm\r\n"); return; } diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_network_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_network_adapter.c index b825259..661ae36 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_network_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_network_adapter.c @@ -136,7 +136,6 @@ static int GetDeviceConfigs(wifi_sta_config_stru *config) (void)memset_s(&connect_info, sizeof(connect_info), 0, sizeof(connect_info)); return HILINK_SAL_OK; } - static int RemoveDevice(void) { hilink_connect_info_t connect_info; @@ -150,7 +149,6 @@ static int RemoveDevice(void) return HILINK_SAL_OK; } - static int get_softap_local_ip(char *localIp, unsigned char len) { struct netif *lwip_netif = netifapi_netif_find("ap0"); @@ -168,7 +166,6 @@ static int get_softap_local_ip(char *localIp, unsigned char len) return HILINK_SAL_OK; } - int HILINK_GetLocalIp(char *localIp, unsigned char len) { if ((localIp == NULL) || (len == 0)) { @@ -524,7 +521,18 @@ static void SetSecurityTypeByScanInfo(wifi_sta_config_stru *config, const wifi_s (void)memset_s(&tempConfig, sizeof(wifi_sta_config_stru), 0, sizeof(wifi_sta_config_stru)); return; } - +/* 等待wifi连接断开 */ +static void WaitWifiDisconnect(void) +{ + for (int i = 0; i < 30; i++) { /* 30:最多等3秒 */ + int result = 0; + if (HILINK_GetLastConnectResult(&result) == HILINK_SAL_OK) { + HILINK_SAL_INFO("result: %d\r\n", result); + break; + } + HILINK_MilliSleep(100); /* 100ms */ + } +} int HILINK_RestartWiFi(void) { int ret; @@ -541,7 +549,7 @@ int HILINK_RestartWiFi(void) HILINK_SAL_ERROR("enable wifi error, ret = %d\r\n", ret); return HILINK_SAL_NOK; } - HILINK_Printf("hilink restarted wifi station\r\n"); + HILINK_Printf("hilink restarted wifi station\r\n"); return HILINK_SAL_OK; } @@ -565,7 +573,6 @@ int HILINK_ConnectWiFiByBssid(int securityType, const unsigned char *bssid, unsi } g_isReasonRefresh = false; - int netConnect = WIFI_DISCONNECTED; if (HILINK_GetNetworkState(&netConnect) != HILINK_SAL_OK) { /* 网络状态获取失败,不退出继续连接 */ @@ -577,6 +584,7 @@ int HILINK_ConnectWiFiByBssid(int securityType, const unsigned char *bssid, unsi HILINK_SAL_ERROR("disconnect wifi error\r\n"); return HILINK_SAL_CONENCT_WIFI_ERR; } + WaitWifiDisconnect(); } wifi_sta_config_stru config; diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_open_ota_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_open_ota_adapter.c index b730da9..07ed018 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_open_ota_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_open_ota_adapter.c @@ -50,7 +50,7 @@ static errcode_t upg_get_upgrade_part_size(uint32_t *size) return ret_val; } if (info.part_info.addr_info.size < UPG_UPGRADE_FLAG_LENGTH) { - HILINK_SAL_WARN("size=%u,%u\r\n", info.part_info.addr_info.size , UPG_UPGRADE_FLAG_LENGTH); + HILINK_SAL_WARN("size=%u,%u\r\n", info.part_info.addr_info.size, UPG_UPGRADE_FLAG_LENGTH); return -1; } *size = info.part_info.addr_info.size - UPG_UPGRADE_FLAG_LENGTH; diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_quick_netcfg_demo.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_quick_netcfg_demo.c index b4e8ad5..764a151 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_quick_netcfg_demo.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_quick_netcfg_demo.c @@ -1,6 +1,5 @@ - /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024-2025. All rights reserved. + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2024. All rights reserved. * Description: 设备通过80211 wifi管理帧实现文件demo */ @@ -25,7 +24,7 @@ #include "nv_common_cfg.h" #include "nv.h" #include "hilink_sal_defines.h" - +#include "hilink_stdio_adapter.h" #define QUICK_NETCFG_TASK_SIZE 4096 #define CMD_MAX_LEN 2048 @@ -37,9 +36,9 @@ static osal_char g_ifName[WIFI_IFNAME_MAX_SIZE + 1] = "ap0"; static void *g_quickCfgTask = NULL; static bool g_isRecvReginfo = false; -extern int HILINK_Printf(const char *format, ...); #define BATCH_CFG "batchCfg" -#define BATCH_CFG_PRINTF(fmt, args...) HILINK_Printf("[%s][%s:%d] " fmt "\n", BATCH_CFG, __FUNCTION__, __LINE__, ##args); +#define BATCH_CFG_PRINTF(fmt, args...) HILINK_Printf("[%s][%s:%d] " fmt "\n", \ + BATCH_CFG, __FUNCTION__, __LINE__, ##args) static bool IsWifiExsit(void) { @@ -95,7 +94,7 @@ static int QuickCfgReceiveFrame(void* frame, int len, signed char rssi) */ static int QuickCfgStartPromisMode(void) { - if (check_wifi_is_station()) { + if (wifi_is_sta_enabled() == 1) { BATCH_CFG_PRINTF("SetRoutName STA_MODE"); SetRoutName(STA_MODE); } else { diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_sal_aes.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_sal_aes.c index 52d8981..1675706 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_sal_aes.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_sal_aes.c @@ -49,22 +49,7 @@ static bool IsAesGcmParamValid(const HiLinkAesGcmParam *param) return true; } -//static void hilink_dump_gcm(mbedtls_gcm_context *ctx, mbedtls_cipher_id_t id, const unsigned char *key, -// unsigned int keybits) -//{ -// int i; -// osal_printk("\r\nhilink mbedtls_gcm_context:\r\n"); -// char *tmp = (char *)ctx; -// for (i = 0; i < sizeof(mbedtls_gcm_context); i++) { -// osal_printk("%02x ", tmp[i]); -// } -// osal_printk("\r\nid: %d\r\n", id); -// osal_printk("\r\nkey:\r\n"); -// for (i = 0; i < keybits / BITS_PER_BYTES; i++) { -// osal_printk("%02x ", key[i]); -// } -// osal_printk("\r\nkeylen: %d\r\n", keybits / BITS_PER_BYTES); -//} + int HILINK_SAL_AesGcmEncrypt(const HiLinkAesGcmParam *param, unsigned char *tag, unsigned int tagLen, unsigned char *buf) { @@ -76,8 +61,6 @@ int HILINK_SAL_AesGcmEncrypt(const HiLinkAesGcmParam *param, unsigned char *tag, mbedtls_gcm_init(&context); int ret; do { -// hilink_dump_gcm(&context, MBEDTLS_CIPHER_ID_AES, -// param->key, param->keyLen * BITS_PER_BYTES); ret = mbedtls_gcm_setkey(&context, MBEDTLS_CIPHER_ID_AES, param->key, param->keyLen * BITS_PER_BYTES); if (ret != 0) { @@ -109,8 +92,6 @@ int HILINK_SAL_AesGcmDecrypt(const HiLinkAesGcmParam *param, const unsigned char mbedtls_gcm_init(&context); int ret; do { -// hilink_dump_gcm(&context, MBEDTLS_CIPHER_ID_AES, -// param->key, param->keyLen * BITS_PER_BYTES); ret = mbedtls_gcm_setkey(&context, MBEDTLS_CIPHER_ID_AES, param->key, param->keyLen * BITS_PER_BYTES); if (ret != 0) { diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_softap_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_softap_adapter.c index 8721473..1dc3b8f 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_softap_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_softap_adapter.c @@ -80,10 +80,12 @@ static int softap_config_static_ip(void) (void)memset_s(&ifconfig_param, sizeof(ifconfig_param), 0, sizeof(ifconfig_param)); ifconfig_param.ifname = "ap0"; + /* 192.168.3.1:softap default ip addr */ ifconfig_param.ip_str = GetGateWayIp(192, 168, 3, 1); ifconfig_param.netmask = "netmask"; ifconfig_param.netmask_value = "255.255.255.0"; ifconfig_param.gateway = "gateway"; + /* 192.168.3.1:softap default gateway ip addr */ ifconfig_param.gateway_value = GetGateWayIp(192, 168, 3, 1); lwip_ifconfig(6, &ifconfig_param.ifname); // 6: ifconfig param number @@ -125,6 +127,7 @@ int HILINK_StartSoftAp(const char *ssid, unsigned int ssidLen) } osal_msleep(4000); /* 4000:配置静态ip之后要睡眠4秒之后再开启dhcps */ + // dhcps if (softap_start_dhcps() != 0) { HILINK_SAL_ERROR("set softap dhcps failed\r\n"); (void)memset_s(&config, sizeof(softap_config_stru), 0, sizeof(softap_config_stru)); diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_thread_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_thread_adapter.c index 34beaad..3601859 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_thread_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_thread_adapter.c @@ -10,7 +10,7 @@ #include "cmsis_os2.h" #include "securec.h" #include "hilink_sal_defines.h" -#include "hilink_thread_adapter.h" + #ifdef SUPPORT_MUTEX_DEBUG #undef HILINK_MutexLock #undef HILINK_MutexUnlock @@ -210,7 +210,6 @@ int HILINK_MilliSleep(unsigned int ms) { osStatus_t status = osDelay(MsToTick(ms)); if (status != osOK) { -// HILINK_SAL_WARN("delay %u ms error %d\r\n", ms, status);//chenxq commended out return -1; } return HILINK_SAL_SLEEP_ERR; diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_time_adapter.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_time_adapter.c index 3195e29..8673f7d 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_time_adapter.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_time_adapter.c @@ -37,10 +37,4 @@ int HILINK_GetUtcTime(HiLinkTimeval *time) { (void)time; return HILINK_SAL_NOT_SUPPORT; -} -uint32_t hf_get_os_time(void) -{ - HiLinkTimeval hf_time={0}; - HILINK_GetOsTime(&hf_time); - return hf_time.sec*MS_PER_SECOND+hf_time.usec/US_PER_MS; } \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_tls_client.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_tls_client.c index 25c1a46..d4f1620 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_tls_client.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/hilink_tls_client.c @@ -218,7 +218,7 @@ static void TlsDebug(void *context, int level, const char *file, int line, const (void)level; (void)file; (void)line; - if (ctx == NULL) { + if ((context == NULL) || (str == NULL)) { return; } HiLinkTlsClient *ctx = (HiLinkTlsClient *)(context); diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_kv_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_kv_adapter.h new file mode 100755 index 0000000..8d7b692 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_kv_adapter.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLinkKV 头文件(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_KV_ADAPTER_H +#define HILINK_KV_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 初始化KV存储模块 + * + * @param path [IN] 存储数据的路径,仅文件系统使用 + * @param key [IN] 存储数据的标识列表,数组可读长度至少为num + * @param num [IN] 存储数据标识数量 + * @return 0成功,其他失败 + */ +int HILINK_KVStoreInit(const char *path, const char *key[], unsigned int num); + +/** + * @brief 根据标识持久化存储数据 + * + * @param key [IN] 存储数据的标识 + * @param offset [IN] 存储数据的偏移 + * @param value [IN] 存储的数据,可读长度至少为len + * @param len [IN] 存储数据的长度 + * @return 0成功,其他失败 + * @attention 对于支持文件系统的产品HiLink SDK会直接使用该接口对预置配置文件进行写入,key为文件名 + */ +int HILINK_SetValue(const char *key, unsigned int offset, const unsigned char *value, unsigned int len); + +/** + * @brief 根据标识读取数据 + * + * @param key [IN] 存储数据的标识 + * @param offset [IN] 读取数据的偏移 + * @param value [OUT] 读取数据的缓冲区,可写长度至少为len + * @param len [IN] 读取数据的缓冲区大小 + * @return 0成功,其他失败 + * @attention 对于未存储过的key读取不应返回错误,对于支持文件系统的产品 + * HiLink SDK会直接使用该接口对预置配置文件进行读出,key为文件名 + */ +int HILINK_GetValue(const char *key, unsigned int offset, unsigned char *value, unsigned int len); + +/** + * @brief 根据指定标识删除数据 + * + * @param key [IN] 存储数据的标识 + * @attention 删除不应影响该标识数据的再次读写 + */ +void HILINK_DeleteValue(const char *key); + +/** + * @brief 根据key查询文件名 + * + * @param key [IN] 存储数据的标识 + * @param out [IN][OUT] 保存key对应的文件名 + * @param len [IN] 文件名最大长度 + * @return 0成功,其他失败 + */ +int HILINK_GetFileName(const char *key, char *out, unsigned int len); +#define FILE_PATH_LEN_MAX 100 +#define FILE_IS_CREATED 1 +#define FILE_NOT_CREATE 0 +#define FILE_SIZE_MAX 0x1000 +typedef struct hilink_file { + char file_path[FILE_PATH_LEN_MAX]; + char *file_handle; + unsigned short file_size; + unsigned short pos; + char isCreat; +} hilink_file_t; +#ifdef __cplusplus +} +#endif +#endif /* HILINK_KV_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mbedtls_utils.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mbedtls_utils.h new file mode 100755 index 0000000..a5d5a00 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mbedtls_utils.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLink SDK软件适配层TLS基于mbedTLS实现内部接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_TLS_MBED_INNER_H +#define HILINK_SAL_TLS_MBED_INNER_H + +#include +#include "mbedtls/md.h" +#include "mbedtls/bignum.h" +#include "hilink_sal_md.h" +#include "hilink_sal_mpi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 将HiLink SDK摘要类型转换为mbedTLS摘要类型 + * + * @param type HiLink摘要类型 + * @return mbedTLS摘要类型 + */ +mbedtls_md_type_t GetMbedtlsMdType(HiLinkMdType type); + +/** + * @brief 校验消息摘要长度是否合法 + * + * @param type HiLink摘要类型 + * @param len 消息摘要缓冲区长度 + * @return true成功,false失败 + */ +bool IsMdLenInvalid(HiLinkMdType type, unsigned int len); + +/** + * @brief 将HiLink SDK大数转换为mbedTLS大数指针 + * + * @param mpi HiLink SDK大数 + * @return mbedTLS大数指针 + */ +mbedtls_mpi *GetMbedtlsMpi(HiLinkMpi mpi); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_TLS_MBED_INNER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mem_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mem_adapter.h new file mode 100755 index 0000000..c745e47 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_mem_adapter.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 系统适配层内存接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_MEM_ADAPTER_H +#define HILINK_MEM_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 描述: 申请内存空间 + * 参数: size,表示申请内存空间大小 + * 返回: 申请内存空间指针 + */ +void *HILINK_Malloc(unsigned int size); + +/* + * 描述: 释放内存空间 + * 参数: pt,表示释放内存空间指针 + */ +void HILINK_Free(void *pt); + +/* + * 描述: 内存比较 + * 参数: buf1,指向内存块的指针 + * buf2,指向内存块的指针 + * len,要比较的字节数 + * 返回: 0表示buf1和buf2指向的内存中内容相同, 大于0表示buf1大于buf2,小于0表示buf1小于buf2 + */ +int HILINK_Memcmp(const void *buf1, const void *buf2, unsigned int len); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_MEM_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_network_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_network_adapter.h new file mode 100755 index 0000000..7375747 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_network_adapter.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 网络适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_NETWORK_ADAPTER_H +#define HILINK_NETWORK_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAC_ADDRESS_LEN +#define MAC_ADDRESS_LEN 6 +#endif + +#define HILINK_MAX_AP_SSID_LEN 33 +#define HILINK_BSSID_HEX_LEN 6 + +/** @brief 扫描目标AP字段 */ +typedef enum { + /* 根据AP的SSID名称扫描 */ + WIFI_SCAN_TPYE_SSID, + /* 根据AP的BSSID扫描 */ + WIFI_SCAN_TPYE_BSSID, + /* 根据AP频率扫描 */ + WIFI_SCAN_TPYE_FREQ, + /* 普通扫描 */ + WIFI_SCAN_TPYE_BASIC, +} HILINK_WifiScanType; + +typedef struct { + /* 目标AP的SSID, 扫描类型为ssid时必填 */ + char ssid[HILINK_MAX_AP_SSID_LEN]; + /* 目标AP的SSID的长度 */ + unsigned int ssidLen; + /* 目标AP的bssid */ + char bssid[HILINK_BSSID_HEX_LEN]; + /* 目标AP的频率 */ + int freqs; + /* 扫描目标AP的字段 */ + HILINK_WifiScanType scanType; +} HILINK_APScanParam; + +typedef struct { + char ssid[HILINK_MAX_AP_SSID_LEN]; + unsigned char bssid[HILINK_BSSID_HEX_LEN]; + int securityType; + int rssi; + int band; + int frequency; +} HILINK_APInfo; + +typedef struct { + HILINK_APInfo *apList; + unsigned int num; +} HILINK_APList; + +typedef struct { + /** + * @brief 获取网络优化功能类型 + * + * 返回的type使用bit位表示功能是否开启,1表示开启,0表示关闭 + * 当前只支持以下几种功能类型 + * + * @return 0x00:关闭网络优化所有功能 + * 0x01: 表示开启路由引导设备连接至较优AP功能 + * 0x02: 表示开启SDK连接WiFi逻辑,此时需要设备配合关闭本身WiFi重连功能 + * 0x01|0x02:功能全开时 + */ + unsigned int (*getWifiRecoveryType)(void); + + /** + * @brief 根据参数扫描周围AP信息 + * + * 此接口指定了BSSID、SSID以及频率相关的类型扫描, 目前只用了SSID方式 + * + * @param param [IN] 扫描AP信息时指定的目标参数 + * @return 0表示成功, 其他表示失败 + */ + int (*scanAP)(const HILINK_APScanParam *param); + + /** + * @brief SDK调用scanAP后, 调用此函数获取扫描周围AP信息的结果 + * + * scanList中apList字段内存由外部申请, SDK进行释放 + * + * @param scanList [OUT] 扫描得到的目标AP列表以及个数 + * @return 0表示成功, 1表示扫描未完成, 其他表示失败 + */ + int (*getAPScanResult)(HILINK_APList *scanList); + + /** + * @brief 重新启动WiFi模块 + * + * 当设备WiFi断开后, 此函数会被调用重启WiFi模块; + * + * @return 0表示成功, 其他表示失败 + */ + int (*restartWiFi)(void); + + /** + * @brief 连接指定bssid的与配网ssid同名的Wi-Fi + * + * securityType来源于getAPScanResult扫描结果 + * 目标bssid来源于指定ssid扫描得到的列表 + * 接口通常在扫描指定ssid后调用, 用于设备切换到更好的Wi-Fi + * + * @param securityType [IN] 目标Wi-Fi的加密类型 + * @param bssid [IN] 目标Wi-Fi的bssid + * @param bssidLen [IN] bssid的长度 + * @return 返回值必须为0 + */ + int (*connectWiFiByBssid)(int securityType, const unsigned char *bssid, unsigned int bssidLen); + + /** + * @brief 获取上一次连接WiFi失败原因 + * + * 1、此接口由厂家实现, 当前在调用HILINK_ConnectWiFiByBssid接口后, 调用此接口获取连接失败原因 + * 2、指定BSSID连接后将轮询调用此接口, 若连接动作未有结果, 函数返回-1, 直到连接动作有结果 + * 3、如果WiFi连接成功, 出参result返回0 + * + * @param result [OUT] 存放连接WiFi失败原因的内存指针 + * @return 0表示成功, 其他表示失败 + */ + int (*lastConnResult)(int *result); +} WiFiRecoveryApi; + +/** + * @brief 获取本地IP + * + * @param localIp [IN] 缓冲区, 为点分十进制格式 eg. 192.168.1.2 + * @param len [OUT] 存放IP的缓冲长度 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetLocalIp(char *localIp, unsigned char len); + +/** + * @brief 获取本地广播地址,用于app广播发现 + * + * @param broadcastIp [IN] 缓冲区, 为点分十进制格式 eg. 192.168.1.255 + * @param len [OUT] 存放IP的缓冲长度 + * @return 0成功, 非0不支持app广播发现 + */ +int HILINK_GetLocalBroadcastIp(char *broadcastIp, unsigned char len); + +/** + * @brief 获取网络MAC地址 mac格式为{0xa1,0xb2,0xc3,0xd4,0xe5,0xf6} + * + * @param mac [IN] 存放MAC的缓冲区 + * @param len [OUT] 缓冲区长度, 为MAC_ADDRESS_LEN + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetMacAddr(unsigned char *mac, unsigned char len); + +/** + * @brief 获取当前连接Wi-Fi的ssid + * + * @param ssid [IN] 存放ssid的缓冲区 + * @param ssidLen [OUT] 缓冲区长度 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetWiFiSsid(char *ssid, unsigned int *ssidLen); + +/** + * @brief 设置Wi-Fi的连接信息 + * + * ssid和pwd为空表示清除WiFi信息, 设置的Wi-Fi信息需要持久化, 以确保设备重启后依然可以连接Wi-Fi + * + * @param ssid [OUT] 待连接Wi-Fi的ssid + * @param ssidLen [OUT] ssid的长度 + * @param pwd [OUT] 待连接Wi-Fi的密码 + * @param pwdLen [OUT] Wi-Fi密码长度 + * @return 0表示成功, 其他表示失败 + * 注意: (1)ssid和pwd为空表示清除wifi信息 + * (2)设置的wifi信息需要持久化,确保设备重启后依然可以连接wifi + */ +int HILINK_SetWiFiInfo(const char *ssid, unsigned int ssidLen, const char *pwd, unsigned int pwdLen); + +/** + * @brief 重新启动WiFi模块 + * + * 当设备WiFi断开后, 此函数会被调用重启WiFi模块; + * + * @return 0表示成功, 其他表示失败 + */ +int HILINK_RestartWiFi(void); + +/** + * @brief 连接指定bssid的与配网ssid同名的Wi-Fi + * + * securityType来源于HILINK_GetAPScanResult扫描结果 + * 目标bssid来源于指定ssid扫描得到的列表 + * 接口通常在扫描指定ssid后调用, 用于设备切换到更好的Wi-Fi + * + * @param securityType [IN] 目标Wi-Fi的加密类型 + * @param bssid [IN] 目标Wi-Fi的bssid + * @param bssidLen [IN] bssid的长度 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_ConnectWiFiByBssid(int securityType, const unsigned char *bssid, unsigned int bssidLen); + +/** + * @brief 获取上一次连接WiFi失败原因 + * + * 1、此接口由厂家实现, 当前在调用HILINK_ConnectWiFiByBssid接口后, 调用此接口获取连接失败原因; + * 2、指定BSSID连接后将轮询调用此接口, 若连接动作未有结果, 函数返回-1, 直到连接动作有结果; + * 3、如果WiFi连接成功, 出参result返回0; + * + * @param result [OUT] 存放连接WiFi失败原因的内存指针 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetLastConnectResult(int *result); + +/** + * @brief 根据参数扫描周围AP信息 + * + * 此接口指定了BSSID、SSID以及频率相关的类型扫描, 目前只用了SSID方式 + * + * @param param [IN] 扫描AP信息时指定的目标参数 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_ScanAP(const HILINK_APScanParam *param); + +/** + * @brief SDK调用HILINK_ScanAP后, 调用此函数获取扫描周围AP信息的结果 + * + * scanList中apList字段内存由外部申请, SDK进行释放 + * + * @param scanList [OUT] 扫描得到的目标AP列表以及个数 + * @return 0表示成功, 1表示扫描未完成, 其他表示失败 + */ +int HILINK_GetAPScanResult(HILINK_APList *scanList); + + /** + * @brief 厂家实现网络优化相关功能函数,通过此接口注册给SDK使用 + * + * @param cb [IN] 当前SDK仅在鸿蒙系统实现以下接口,鸿蒙系统可直接注册使用,其它形态需自行实现: + * HILINK_ConnectWiFiByBssid、HILINK_ScanAP、HILINK_GetAPScanResult、 + * HILINK_RestartWiFi、HILINK_GetLastConnectResult + * 以上接口只在部分芯片上验证通过,如果直接使用请自行验证,以保证功能正常。 + * getWifiRecoveryType需要厂商实现 + * @param cbSize [IN] 回调函数结构体的大小,即sizeof(WiFiRecoveryApi) + * @warning 使用此接口需配备特定SDK版本,否则启动后功能不生效 + */ +int HILINK_RegWiFiRecoveryCallback(const WiFiRecoveryApi *cb, unsigned int cbSize); + +/** + * @brief 设置WiFi自恢复时的相关参数 + * + * @param scanTimes [IN] WiFi自恢复时扫描AP的最大次数 + * @param connectTimes [IN] WiFi自恢复时每个AP最大连接次数 + * @return 正常返回0,异常返回其他错误码 + */ +int HILINK_SetWiFiRecoveryTimesParam(unsigned int scanTimes, unsigned int connectTimes); + +/** + * @brief 设置差WiFi环境下心跳超时离线导致重连WiFi的阈值 + * + * @param hbLimit [IN] 心跳超时离线导致重连WiFi的阈值 + * @return 正常返回0,异常返回其他错误码 + */ +int HILINK_SetHeartbeatLimit(unsigned int hbLimit); + +/** + * @brief 断开并重连WiFi + * + */ +void HILINK_ReconnectWiFi(void); + +/** + * @brief 触发连接WiFi + * + * @return 0表示成功, 其他表示失败 + */ +int HILINK_ConnectWiFi(void); + +/** + * @brief 获取网络状态 + * + * @param state [OUT] 返回0表示网络断开或已连接但网卡未分配得ip, 返回1表示已连接且分配得ip + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetNetworkState(int *state); + +/** + * @brief 获取当前连接的WiFi的 bssid + * + * @param bssid [IN] 存放bssid的缓冲区 + * @param bssidLen [OUT IN] 出参表示缓冲区长度, 入参表示WiFi bssid长度 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetWiFiBssid(unsigned char *bssid, unsigned char *bssidLen); + +/** + * @brief 获取当前连接的WiFi信号强度, 单位db + * + * @param rssi [OUT] 信号强度 + * @return 0表示成功, 其他表示失败 + */ +int HILINK_GetWiFiRssi(signed char *rssi); + +unsigned int get_wifi_recovery_type(void); + +#ifdef __cplusplus +} +#endif +#endif /* HILINK_NETWORK_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_adapter.h new file mode 100755 index 0000000..7b34bb2 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_adapter.h @@ -0,0 +1,196 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: OTA适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_OPEN_OTA_ADAPTER_H +#define HILINK_OPEN_OTA_ADAPTER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OTA升级分区1 */ +#ifndef UPGRADE_FW_BIN1 +#define UPGRADE_FW_BIN1 0x00 +#endif + +/* OTA升级分区2 */ +#ifndef UPGRADE_FW_BIN2 +#define UPGRADE_FW_BIN2 0x01 +#endif + +/* 只有MCU升级时立即重启 */ +#ifndef RESTART_FLAG_NOW +#define RESTART_FLAG_NOW 0x01 +#endif + +/* 有模组时切换分区后再重启 */ +#ifndef RESTART_FLAG_LATER +#define RESTART_FLAG_LATER 0x02 +#endif + +/* 模组可以重启 */ +#ifndef MODULE_CAN_REBOOT +#define MODULE_CAN_REBOOT 0x01 +#endif + +/* 模组不能重启 */ +#ifndef MODULE_CANNOT_REBOOT +#define MODULE_CANNOT_REBOOT 0x00 +#endif + +/* 手动升级 */ +#ifndef UPDATE_TYPE_MANUAL +#define UPDATE_TYPE_MANUAL 0x00 +#endif + +/* 自动升级 */ +#ifndef UPDATE_TYPE_AUTO +#define UPDATE_TYPE_AUTO 0x01 +#endif + +/* 返回正常 */ +#ifndef RETURN_OK +#define RETURN_OK 0 +#endif +/* 没有MCU */ +#ifndef RETURN_ERROR_NO_MCU +#define RETURN_ERROR_NO_MCU (-1) +#endif +/* 返回其他错误 */ +#ifndef RETURN_ERROR +#define RETURN_ERROR (-2) +#endif +/* MCU不需要升级 */ +#ifndef RETURN_MCU_NO_NEED_OTA +#define RETURN_MCU_NO_NEED_OTA (-3) +#endif + +typedef void (*GetOtaVerCb)(const char *version); +typedef void (*TrigSelfUpdateCb)(const char *url, const unsigned int size); + +/* + * Flash初始化 + * 返回值是true时,表示初始化正常 + * 返回值是false时,表示初始化异常 + */ +bool HILINK_OtaAdapterFlashInit(void); + +/* + * 判断需要升级的分区 + * 返回值是UPGRADE_FW_BIN1时,表示升级固件到分区1 + * 返回值是UPGRADE_FW_BIN2时,表示升级固件到分区2 + */ +unsigned int HILINK_OtaAdapterGetUpdateIndex(void); + +/* + * 擦除需要升级的分区 + * size表示需要擦除的分区大小 + * 返回值是0时,表示擦除成功 + * 返回值是-1时,表示擦除失败 + */ +int HILINK_OtaAdapterFlashErase(unsigned int size); + +/* + * 升级数据写入升级的分区 + * buf表示待写入数据 + * bufLen表示待写入数据的长度 + * 返回值是0时,表示写入成功 + * 返回值是-1时,表示写入失败 + */ +int HILINK_OtaAdapterFlashWrite(const unsigned char *buf, unsigned int bufLen); + +/* + * 读取升级分区数据 + * offset表示读写偏移 + * buf表示输出数据的内存地址 + * bufLen表示输出数据的内存长度 + * 返回值是0时,表示读取成功 + * 返回值是-1时,表示读取失败 + */ +int HILINK_OtaAdapterFlashRead(unsigned int offset, unsigned char *buf, unsigned int bufLen); + +/* + * 分区升级结束 + * 返回值是true时,表示结束正常 + * 返回值是false时,表示结束异常 + */ +bool HILINK_OtaAdapterFlashFinish(void); + +/* 获取升级区间最大长度 */ +unsigned int HILINK_OtaAdapterFlashMaxSize(void); + +/* + * 根据标志重启模组 + * flag表示重启标志 + * 当flag是RESTART_FLAG_NOW时,表示只有MCU升级时立即重启 + * 当flag是RESTART_FLAG_LATER时,表示有模组时切换分区后再重启 + */ +void HILINK_OtaAdapterRestart(int flag); + +/* + * 开始模组升级 + * type表示升级类型 + * 当type是UPDATE_TYPE_MANUAL时,表示本次升级流程是由用户主动发起的手动升级 + * 当type是UPDATE_TYPE_AUTO时,表示本次升级流程是经过用户同意的自动升级 + * 返回值是RETURN_OK时,表示处理成功,HiLink SDK将开始启动升级流程 + * 返回值是RETURN_ERROR时,表示处理不成功,HiLink SDK将终止本次升级流程 + * 注意:在手动场景场景下,HiLink SDK在接收到用户发出的升级指令后,将直接调用此接口; + * 在自动升级场景下,当HiLink SDK在调用HilinkGetRebootFlag接口返回值是MODULE_CAN_REBOOT时,HiLink SDK将调用此接口。 + * 厂商可在此接口中完成和升级流程相关的处理。 + * 开机后10分钟到1小时内随机时间检测一次是否有新版本,之后以当前时间为起点,23小时加1小时内随机值周期性检测新版本。 + * 如果用户打开了自动升级开关,检测到有新版本并且是可以重启的情况下,就进行新版本的下载,下载完成后自动重启。 + * 自动升级流程可能在凌晨进行,因此厂商在实现升级流程相关功能时,确保在升级的下载安装固件和重启设备时避免对用户产生 + * 影响,比如发出声音,光亮等。 + */ +int HILINK_OtaStartProcess(int type); + +/* + * 模组升级结束 + * status表示升级结果 + * 当status是100时,表示升级成功 + * 当status不是100时,表示升级失败 + * 返回值是RETURN_OK时,表示处理成功,HiLink SDK将置升级标志或切换运行区标志 + * 返回值不是RETURN_OK时,表示处理不成功,HiLink SDK将终止本次升级流程 + * 注意:HiLink SDK在将固件写入到OTA升级区后,且完整性校验通过后,将调用厂商适配的此接口; + * 厂商可在此接口中完成和升级流程相关的处理。 + * 开机后10分钟到1小时内随机时间检测一次是否有新版本,之后以当前时间为起点,23小时加1小时内随机值周期性检测新版本。 + * 如果用户打开了自动升级开关,检测到有新版本并且是可以重启的情况下,就进行新版本的下载,下载完成后自动重启。 + * 自动升级流程可能在凌晨进行,因此厂商在实现升级流程相关功能时,确保在升级的下载安装固件和重启设备时避免对用户产生 + * 影响,比如发出声音,光亮等;升级类型是否为自动升级可参考接口HilinkOtaStartProcess的参数type的描述。 + */ +int HILINK_OtaEndProcess(int status); + +/* + * 判断模组是否能立即升级并重启 + * 返回值是MODULE_CAN_REBOOT时,表示模组可以立即升级并重启,HiLink SDK将开始自动升级流程。 + * 返回值是MODULE_CANNOT_REBOOT时,表示模组不能立即升级并重启,HiLink SDK将不进行本次自动升级流程。 + * 注意:在用户同意设备可以自动升级的情况下,HiLink SDK调用此接口获取设备当前业务状态下,模组是否可以立即升级并重启的标志。 + * 只有当设备处于业务空闲状态时,接口才可以返回MODULE_CAN_REBOOT。 + * 当设备处于业务非空闲状态时,接口返回MODULE_CANNOT_REBOOT。 + */ +int HILINK_GetRebootFlag(void); + +/* + * 触发设备的ota新版本检测 + * 检测到的版本,sdk将通过cb回调函数上报。如果不需要获取版本号,则可将cb置空。 + * 上报的version如果为空,则未成功获取到新版本。 + * 注意:1、建议调用频次最多一天一次 + * 2、首次通过手机配网成功后不能调用,建议连云成功后至少5s后调用 + */ +void HILINK_TrigOtaVersionCheck(GetOtaVerCb cb); + +/* + * 触发设备的ota新版本升级 + * 检测到的版本,sdk将通过cb回调函数触发升级 + */ +void HILINK_TrigOtaSelfUpdate(TrigSelfUpdateCb cb); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_mcu_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_mcu_adapter.h new file mode 100755 index 0000000..3cc198c --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_open_ota_mcu_adapter.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: MCU OTA适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_OPEN_OTA_MCU_ADAPTER_H +#define HILINK_OPEN_OTA_MCU_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* 返回正常 */ +#ifndef RETURN_OK +#define RETURN_OK 0 +#endif + +/* 没有MCU */ +#ifndef RETURN_ERROR_NO_MCU +#define RETURN_ERROR_NO_MCU (-1) +#endif + +/* MCU返回其他错误 */ +#ifndef RETURN_ERROR +#define RETURN_ERROR (-2) +#endif + +/* MCU不需要升级 */ +#ifndef RETURN_MCU_NO_NEED_OTA +#define RETURN_MCU_NO_NEED_OTA (-3) +#endif + +/* 手动升级 */ +#ifndef UPDATE_TYPE_MANUAL +#define UPDATE_TYPE_MANUAL 0x00 +#endif + +/* 自动升级 */ +#ifndef UPDATE_TYPE_AUTO +#define UPDATE_TYPE_AUTO 0x01 +#endif + +/* 开始发送MCU数据 */ +#ifndef START_SEND_DATA +#define START_SEND_DATA 0 +#endif + +/* 发送MCU数据结束 */ +#ifndef STOP_SEND_DATA +#define STOP_SEND_DATA 1 +#endif + +/* 异常终止 */ +#ifndef SEND_DATA_ERROR +#define SEND_DATA_ERROR 2 +#endif + +typedef int (*RptUpgProgressFlagCb)(void); + +/* + * 获取MCU当前版本 + * version表示版本字符串 + * inLen表示输入字符串长度 + * outLen表示输出字符串长度 + * 返回值是RETURN_OK时,表示获取成功 + * 返回值是RETURN_ERROR_NO_MCU时,表示没有MCU + * 返回值是RETURN_ERROR时,表示获取失败 + * 注意:如果获取不到MCU的版本,则不对MCU进行升级。 + * 建议厂商在MCU正常启动后,或升级启动后,就将MCU的版本号传递给模组,确保模组可以获取到MCU的版本。 + */ +int HILINK_GetMcuVersion(char *version, unsigned int inLen, unsigned int *outLen); + +/* + * HiLink SDK调用厂商适配的此接口通知MCU固件传输的状态 + * flag表示升级流程标志 + * 当flag是START_SEND_DATA时,表示通知模组即将开始发送MCU固件数据包 + * 当flag是STOP_SEND_DATA时,表示通知模组完整的MCU固件包已发送完成 + * 当flag是SEND_DATA_ERROR时,表示通知模组本次MCU固件升级异常终止 + * len表示MCU固件包的大小 + * type表示升级类型 + * 当type是UPDATE_TYPE_MANUAL时,表示本次升级流程是由用户主动发起的手动升级 + * 当type是UPDATE_TYPE_AUTO时,表示本次升级流程是经过用户同意的自动升级 + * 返回值是RETURN_OK时,表示处理成功,HiLink SDK继续正常处理后续流程 + * 返回值是RETURN_ERROR时,表示处理失败,HiLink SDK将终止本次MCU升级流程 + * 注意:当flag是STOP_SEND_DATA时,此接口需返回MCU侧固件升级的结果;当flag是其它值时,需返回接口接收到此消息后的处理结果。 + * 开机后10分钟到1小时内随机时间检测一次是否有新版本,之后以当前时间为起点,23小时加1小时内随机值周期性检测新版本。 + * 如果用户打开了自动升级开关,检测到有新版本并且是可以重启的情况下,就进行新版本的下载,下载完成后自动重启。 + * 自动升级流程可能在凌晨进行,因此厂商在实现升级流程相关功能时,确保在升级的下载安装固件和重启设备时避免对用户产生 + * 影响,比如发出声音,光亮等。 + */ +int HILINK_NotifyOtaStatus(int flag, unsigned int len, unsigned int type); + +/* + * HiLink SDK调用厂商适配的此接口通知厂商发送MCU固件文件数据 + * data表示发送的数据 + * len表示发送的数据的长度 + * offset表示发送的数据起始位置相对于完整固件包的偏移量 + * 此接口需要返回MCU接收这部分数据的处理结果 + * 返回值是RETURN_OK时,模组将通知的数据正确发送给MCU,且MCU正确处理发送的数据,HiLink SDK将继续正常处理后续流程 + * 返回值是RETURN_ERROR时,模组或MCU未能正常处理通知的MCU的固件文件数据,HiLink SDK将终止本次MCU固件升级流程 + */ +int HILINK_NotifyOtaData(const unsigned char *data, unsigned int len, unsigned int offset); + +/* + * 产品OTA升级时下载升级包进度为100%后会重启, APP上显示设备重启中 + * 然后等设备起来后上报进度0, APP上才会显示升级成功 + * 通过回调函数cb来设置Hilink Sdk被拉起后是否立即向APP上报进度0 + * cb返回1时hilink sdk被拉起后不会立即上报进度0, + * 上报时机由产品自己决定,调用hilink_ota_rpt_prg进行上报 + * cb返回0时hilink sdk被拉起后会立即上报进度0 + * 产品根据自身升级情况判断是否需要注册cb,如不注册则默认hilink sdk被拉起后会立即上报进度0 + */ +void HILINK_PowerOnRptUpgProgress(RptUpgProgressFlagCb cb); + +#ifdef __cplusplus +} +#endif +#endif /* HILINK_OPEN_OTA_BRIDGE_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_aes.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_aes.h new file mode 100755 index 0000000..5638a40 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_aes.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: AES加解密适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_AES_H +#define HILINK_SAL_AES_H + +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** AES-CBC加解密过程中的IV长度 */ +#define HILINK_AES_CBC_IV_LEN 16 +/** AES-GCM加解密过程中tag最长长度 */ +#define HILINK_AES_GCM_TAG_MAX_LEN 16 +/** AES-GCM加解密过程中tag最短长度 */ +#define HILINK_AES_GCM_TAG_MIN_LEN 4 + +/** @brief AES加解密密钥长度 */ +enum HiLinkAesKeyByteLen { + HILINK_AES_128_KEY_BYTE_LEN = 16, /**< AES-128 密钥字节数 */ + HILINK_AES_192_KEY_BYTE_LEN = 24, /**< AES-192 密钥字节数 */ + HILINK_AES_256_KEY_BYTE_LEN = 32, /**< AES-256 密钥字节数 */ +}; + +/** @brief AES-GCM加解密所需的数据 */ +typedef struct HiLinkAesGcmParam { + const unsigned char *key; /**< 加解密密钥,有效可读长度至少为keyLen */ + unsigned int keyLen; /**< 密钥长度,应该是HiLinkAesCryptKeyByteLen中的数值 */ + const unsigned char *iv; /**< 初始向量,有效可读长度至少为ivLen */ + unsigned int ivLen; /**< 初始向量长度 */ + const unsigned char *add; /**< 附加值,有效可读长度至少为addLen */ + unsigned int addLen; /**< 附加值长度,可以为0 */ + const unsigned char *data; /**< 待加解密的数据,有效可读长度至少为dataLen */ + unsigned int dataLen; /**< 数据长度 */ +} HiLinkAesGcmParam; + +/** @brief 填充模式 */ +typedef enum HiLinkPaddingMode { + HILINK_PADDING_PKCS7 = 0, /**< PKCS7填充模式,使用填充长度进行填充 */ + HILINK_PADDING_ONE_AND_ZEROS, /**< 使用0x80 0x00 ... 0x00进行填充 */ + HILINK_PADDING_ZEROS_AND_LEN, /**< 使用0x00 ... 0x00 0xll进行填充,其中0xll为填充长度 */ + HILINK_PADDING_ZEROS, /**< 使用0x00进行填充 */ + HILINK_PADDING_RESERVED = ENUM_INT_REVERSED /**< 避免编译器优化 */ +} HiLinkPaddingMode; + +/** @brief AES-CBC加解密所需数据 */ +typedef struct HiLinkAesCbcParam { + const unsigned char *key; /**< 加解密密钥,有效可读长度至少为keyLen */ + unsigned int keyLen; /**< 密钥长度,应该是HiLinkAesCryptKeyByteLen中的数值 */ + const unsigned char *iv; /**< 初始向量,有效可读长度至少为16 */ + const unsigned char *data; /**< 待加解密的数据,有效可读长度至少为dataLen */ + unsigned int dataLen; /**< 数据长度,应为16的倍数 */ +} HiLinkAesCbcParam; + +/** @brief AES-CCM加解密所需的数据 */ +typedef struct HiLinkAesCcmParam { + const unsigned char *key; /**< 加解密密钥,长度为keyLen */ + unsigned int keyLen; /**< 密钥长度 */ + const unsigned char *iv; /**< 加解密向量,长度为ivLen */ + unsigned int ivLen; /**< 加解密向量长度 */ + const unsigned char *add; /**< 附加值,长度为addLen */ + unsigned int addLen; /**< 附加值长度,为0 */ + const unsigned char *data; /**< 待解密的数据,长度为dataLen */ + unsigned int dataLen; /**< 待解密数据长度 */ +} HiLinkAesCcmParam; + +/** + * @brief AES-GCM加密 + * + * @param param [IN] AES-GCM加密必要的参数 + * @param tag [OUT] 消息验证码输出缓冲区,可写长度至少为tagLen + * @param tagLen [IN] 消息验证码缓冲区长度,范围为[4,16] + * @param buf [OUT] 加密数据输出缓冲区,可写长度至少为param->dataLen + * @return 0成功,非0失败 + */ +int HILINK_SAL_AesGcmEncrypt(const HiLinkAesGcmParam *param, unsigned char *tag, unsigned int tagLen, + unsigned char *buf); + +/** + * @brief AES-GCM解密并校验消息验证码 + * + * @param param [IN] AES-GCM解密必要的参数 + * @param tag [OUT] 消息验证码,可读长度至少为tagLen + * @param tagLen [IN] 消息验证码长度,范围应为[4,16] + * @param buf [OUT] 解密密数据输出缓冲区,可写长度至少为param->dataLen + * @return 0成功,非0失败 + */ +int HILINK_SAL_AesGcmDecrypt(const HiLinkAesGcmParam *param, const unsigned char *tag, unsigned int tagLen, + unsigned char *buf); + +/** + * @brief AES-CBC加密 + * + * @param param [IN] AES-CBC加密必要的参数 + * @param buf [OUT] 加密数据输出缓冲区,可写长度至少为param->dataLen + * @return 0成功,非0失败 + */ +int HILINK_SAL_AesCbcEncrypt(const HiLinkAesCbcParam *param, unsigned char *buf); + +/** + * @brief AES-CBC解密 + * + * @param param [IN] AES-CBC解密必要的参数 + * @param buf [OUT] 解密数据输出缓冲区,可写长度至少为param->dataLen + * @return 0成功,非0失败 + */ +int HILINK_SAL_AesCbcDecrypt(const HiLinkAesCbcParam *param, unsigned char *buf); + +/** + * @brief 填充数据 + * + * @param mode [IN] 填充模式 + * @param out [IN,OUT] 待填充的数据缓冲区,可读可写长度至少为outLen + * @param outLen [IN] 填充后的长度 + * @param dataLen [IN] 缓冲区中有效数据的长度 + * @return 0成功,其他失败 + */ +int HILINK_SAL_AddPadding(HiLinkPaddingMode mode, unsigned char *out, unsigned int outLen, unsigned int dataLen); + +/** + * @brief 从填充数据获取有效数据长度 + * + * @param mode [IN] 填充模式 + * @param input [IN] 填充的数据,可读长度至少为inputLen + * @param inputLen [IN] 填充的数据的长度 + * @param dataLen [OUT] 填充的数据中有效数据的长度 + * @return 0成功,其他失败 + */ +int HILINK_SAL_GetPadding(HiLinkPaddingMode mode, const unsigned char *input, unsigned int inputLen, + unsigned int *dataLen); + +int HILINK_SAL_AesCcmDecrypt(const HiLinkAesCcmParam *param, const unsigned char *tag, + unsigned int tagLen, unsigned char *buf); + +/** + * @brief AES-CCM加密 + * + * @param param [IN] AES-CCM加密必要的参数 + * @param tag [OUT] 消息验证码输入缓冲区,可写长度至少为tagLen + * @param tagLen [IN] 消息验证码缓冲区长度 + * @param buf [OUT] 加密数据输出缓冲区,可写长度至少为param->dataLen + * @return 0成功,非0失败 + */ +int HILINK_SAL_AesCcmEncrypt(const HiLinkAesCcmParam *param, unsigned char *tag, + unsigned int tagLen, unsigned char *buf); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_AES_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_base64.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_base64.h new file mode 100755 index 0000000..2ae9f94 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_base64.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: base64编码解码适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_BASE64_H +#define HILINK_SAL_BASE64_H + +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief base64编码 + * + * @param inData [IN] 待编码的数据,有效可读长度至少为inLen + * @param inLen [IN] 待编码的数据长度 + * @param outData [OUT] 编码后输出数据缓冲区,有效可写长度至少为*outLen + * @param outLen [IN,OUT] 输入为缓冲区长度,输出为编码后的数据长度 + * @return 0成功,非0失败 + * @attention outData为NULL或者outLen为0时,不会实际输出编码数据,只输出编码数据后的长度 + */ +int HILINK_SAL_Base64Encode(const unsigned char *inData, unsigned int inLen, + unsigned char *outData, unsigned int *outLen); + +/** + * @brief base64解码 + * + * @param inData [IN] 待解码的数据,有效可读长度至少为inLen + * @param inLen [IN] 待解码的数据长度 + * @param outData [OUT] 解码后输出数据缓冲区,有效可写长度至少为*outLen + * @param outLen [IN,OUT] 输入为缓冲区长度,输出为解码后的数据长度 + * @return 0成功,非0失败 + * @attention outData为NULL或者outLen为0时,不会实际输出解码数据,只输出解码数据后的长度 + */ +int HILINK_SAL_Base64Decode(const unsigned char *inData, unsigned int inLen, + unsigned char *outData, unsigned int *outLen); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_BASE64_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_defines.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_defines.h new file mode 100755 index 0000000..6487e07 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_defines.h @@ -0,0 +1,163 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLink SDK 软件适配层defines(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_DEFINES_H +#define HILINK_SAL_DEFINES_H + +#ifdef HILINK_SDK_BUILD_IN +#include "hilink_log.h" + +#define HILINK_SAL_DEBUG(...) hilink_debug(__VA_ARGS__) +#define HILINK_SAL_INFO(...) hilink_info(__VA_ARGS__) +#define HILINK_SAL_NOTICE(...) hilink_notice(__VA_ARGS__) +#define HILINK_SAL_WARN(...) hilink_warning(__VA_ARGS__) +#define HILINK_SAL_ERROR(...) hilink_error(__VA_ARGS__) +#define HILINK_SAL_CRIT(...) hilink_critical(__VA_ARGS__) +#define HILINK_SAL_DEBUG_LIMITED(...) HILINK_DEBUG_LIMITED(__VA_ARGS__) +#define HILINK_SAL_ERROR_LIMITED(...) HILINK_ERROR_LIMITED(__VA_ARGS__) + +#else + +/* hilink TLS适配层使用的mbedtls版本,可设为2或3 */ +#define MBEDTLS_MAJOR_VERSION 3 +#define HILINK_MBEDTLS_CCM_SUPPORT 0 + +#if (MBEDTLS_MAJOR_VERSION == 3) +#define MBEDTLS_VERSION_3 +#endif + +#define HILINK_SAL_LOG_LVL_MIN 0 +#define HILINK_SAL_LOG_LVL_DEBUG 1 +#define HILINK_SAL_LOG_LVL_INFO 2 +#define HILINK_SAL_LOG_LVL_NOTICE 3 +#define HILINK_SAL_LOG_LVL_WARN 4 +#define HILINK_SAL_LOG_LVL_ERROR 5 +#define HILINK_SAL_LOG_LVL_CRIT 6 + +#ifndef HILINK_SAL_LOG_BUILD_LVL +#define HILINK_SAL_LOG_BUILD_LVL HILINK_SAL_LOG_LVL_MIN +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern int HILINK_Printf(const char *format, ...); + +#ifdef __cplusplus +} +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_DEBUG +#define HILINK_SAL_DEBUG(...) \ + do { \ + HILINK_Printf("[HSD]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#else +#define HILINK_SAL_DEBUG(...) +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_INFO +#define HILINK_SAL_INFO(...) \ + do { \ + HILINK_Printf("[HSI]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#else +#define HILINK_SAL_INFO(...) +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_NOTICE +#define HILINK_SAL_NOTICE(...) \ + do { \ + HILINK_Printf("[HSN]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#else +#define HILINK_SAL_NOTICE(...) +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_WARN +#define HILINK_SAL_WARN(...) \ + do { \ + HILINK_Printf("[HSW]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#else +#define HILINK_SAL_WARN(...) +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_ERROR +#define HILINK_SAL_ERROR(...) \ + do { \ + HILINK_Printf("[HSE]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#else +#define HILINK_SAL_ERROR(...) +#endif + +#if HILINK_SAL_LOG_BUILD_LVL <= HILINK_SAL_LOG_LVL_CRIT +#define HILINK_SAL_CRIT(...) \ + do { \ + HILINK_Printf("[HSC]%s():%u, ", __FUNCTION__, __LINE__); \ + HILINK_Printf(__VA_ARGS__); \ + } while (0) +#endif + +#define HILINK_SAL_DEBUG_LIMITED(...) +#define HILINK_SAL_ERROR_LIMITED(...) +#endif /* HILINK_SDK_BUILD_IN */ + +#ifndef ENUM_INT_REVERSED +#define ENUM_INT_REVERSED (0x7FFFFFFFU) +#endif + +enum HiLinkSalErrorCode { + HILINK_SAL_KV_INTI_ERR = -600, + HILINK_SAL_KV_SET_ITEM_ERR, + HILINK_SAL_KV_GET_ITEM_ERR, + HILINK_SAL_KV_DELETE_ITEM_ERR, + + HILINK_SAL_GET_IP_ERR = -500, + HILINK_SAL_GET_MAC_ERR, + HILINK_SAL_GET_SSID_ERR, + HILINK_SAL_SET_WIFI_ERR, + HILINK_SAL_GET_WIFI_INFO_ERR, + HILINK_SAL_SCAN_WIFI_ERR, + HILINK_SAL_ADD_WIFI_ERR, + HILINK_SAL_REMOVE_WIFI_ERR, + HILINK_SAL_CONENCT_WIFI_ERR, + HILINK_SAL_SET_SOFTAP_ERR, + + HILINK_SAL_THREAD_ERR = -400, + HILINK_SAL_MUTEX_ERR, + HILINK_SAL_SEM_ERR, + HILINK_SAL_SLEEP_ERR, + HILINK_SAL_TIME_ERR, + HILINK_SAL_MALLOC_ERR, + + HILINK_SAL_DNS_ERR = -300, + HILINK_SAL_FCNTL_ERR, + HILINK_SAL_SET_SOCK_OPT_ERR, + HILINK_SAL_GET_SOCK_OPT_ERR, + + HILINK_SAL_MEMCPY_ERR = -200, + HILINK_SAL_STRCPY_ERR, + HILINK_SAL_STRNCPY_ERR, + HILINK_SAL_SPRINTF_ERR, + HILINK_SAL_MEMSET_ERR, + + HILINK_SAL_PARAM_INVALID = -100, + HILINK_SAL_TIMEOUT, + HILINK_SAL_NOT_SUPPORT, + HILINK_SAL_NOT_INIT, + HILINK_SAL_FD_INVALID, + + HILINK_SAL_NOK = -1, + HILINK_SAL_OK = 0, +}; + +#endif /* HILINK_SAL_DEFINES_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_drbg.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_drbg.h new file mode 100755 index 0000000..d27a557 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_drbg.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 安全用途伪随机数适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_DRBG_H +#define HILINK_SAL_DRBG_H + +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* HiLinkDrbgContext; + +/** + * @brief 安全用途伪随机数发生器初始化 + * + * @param custom [IN] 自定义业务字符串 + * @return 随机数发生器上下文 + */ +HiLinkDrbgContext HILINK_SAL_DrbgInit(const char *custom); + +/** + * @brief 安全用途伪随机数获取 + * + * @param ctx [IN] 随机数发生器上下文 + * @param out [OUT] 随机数缓冲区,可写长度至少为outLen + * @param outLen [IN] 随机数缓冲区长度 + * @return 0成功,其他失败 + */ +int HILINK_SAL_DrbgRandom(HiLinkDrbgContext ctx, unsigned char *out, unsigned int outLen); + +/** + * @brief 安全用途伪随机数去初始化 + * + * @param ctx [IN] 随机数发生器上下文 + */ +void HILINK_SAL_DrbgDeinit(HiLinkDrbgContext ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_RANDOM_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_kdf.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_kdf.h new file mode 100755 index 0000000..233cb95 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_kdf.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 密钥派生算法适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_KDF_H +#define HILINK_SAL_KDF_H + +#include "hilink_sal_defines.h" +#include "hilink_sal_md.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief 基于HMAC的PKCS#5 PBKDF2密钥派生参数 */ +typedef struct HiLinkPbkdf2HmacParam { + HiLinkMdType md; /**< 摘要算法类型 */ + const unsigned char *password; /**< 密码,可读长度至少为passwordLen */ + unsigned int passwordLen; /**< 密码长度 */ + const unsigned char *salt; /**< 盐值,可读长度至少为saltLen */ + unsigned int saltLen; /**< 盐值长度 */ + unsigned int iterCount; /**< 迭代次数 */ +} HiLinkPbkdf2HmacParam; + +/** @brief HKDF密钥派生参数 */ +typedef struct HiLinkHkdfParam { + HiLinkMdType md; /**< 摘要算法类型 */ + const unsigned char *salt; /**< 盐值,可读长度至少为saltLen */ + unsigned int saltLen; /**< 盐值长度,可以为0 */ + const unsigned char *info; /**< 可选字符串,可读长度至少为infoLen */ + unsigned int infoLen; /**< 可选字符串长度,可以为0 */ + const unsigned char *material; /**< 密钥派生材料,可读长度至少为material */ + unsigned int materialLen; /**< 密钥派生材料长度 */ +} HiLinkHkdfParam; + +/** + * @brief 基于HMAC的PKCS#5 PBKDF2密钥派生 + * + * @param param [IN] 密钥派生参数 + * @param key [OUT] 生成密钥缓冲区,可写长度至少为keyLen + * @param keyLen [IN] 生成密钥的长度,取决于param->md摘要算法 + * @return 0成功,其他失败 + */ +int HILINK_SAL_Pkcs5Pbkdf2Hmac(const HiLinkPbkdf2HmacParam *param, unsigned char *key, unsigned int keyLen); + +/** + * @brief HKDF密钥派生 + * + * @param param [IN] 密钥派生参数 + * @param key [OUT] 生成密钥缓冲区,可写长度至少为keyLen + * @param keyLen [IN] 生成密钥的长度,不超过摘要算法类型字节数的255倍 + * @return 0成功,其他失败 + */ +int HILINK_SAL_Hkdf(const HiLinkHkdfParam *param, unsigned char *key, unsigned int keyLen); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_MD_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_md.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_md.h new file mode 100755 index 0000000..5d98579 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_md.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 消息摘要算法适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_MD_H +#define HILINK_SAL_MD_H + +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief 消息摘要计算上下文 */ +typedef void* HiLinkMdContext; + +/** @brief 消息摘要算法类型 */ +typedef enum HiLinkMdType { + HILINK_MD_NONE = 0, + HILINK_MD_SHA256, /**< SHA-256消息摘要算法 */ + HILINK_MD_SHA384, /**< SHA-384消息摘要算法 */ + HILINK_MD_SHA512, /**< SHA-512消息摘要算法 */ + HILINK_MD_RESERVED = ENUM_INT_REVERSED /**< 避免编译器优化 */ +} HiLinkMdType; + +/** @brief 不同消息摘要算法摘要字节数 */ +enum HiLinkMdByteLen { + HILINK_MD_SHA256_BYTE_LEN = 32, /**< SHA-256消息摘要字节数 */ + HILINK_MD_SHA384_BYTE_LEN = 48, /**< SHA-384消息摘要字节数 */ + HILINK_MD_SHA512_BYTE_LEN = 64, /**< SHA-512消息摘要字节数 */ +}; + +/** @brief HMAC计算参数 */ +typedef struct HiLinkHmacParam { + HiLinkMdType md; /**< 消息摘要算法 */ + const unsigned char *key; /**< 密钥,可读长度至少为keyLen */ + unsigned int keyLen; /**< 密钥长度 */ + const unsigned char *data; /**< 待计算HMAC数据,可读长度至少为dataLen */ + unsigned int dataLen; /**< 数据长度 */ +} HiLinkHmacParam; + +/** + * @brief 计算消息摘要 + * + * @param type [IN] 消息摘要算法 + * @param inData [IN] 待计算摘要的数据,可读长度至少为inLen + * @param inLen [IN] 待计算摘要的数据长度 + * @param md [OUT] 生成的消息摘要缓冲区,可写长度至少为mdLen + * @param mdLen [IN] 消息摘要缓冲区长度,长度根据type参考HiLinkMdByteLen + * @return 0成功,其他失败 + */ +int HILINK_SAL_MdCalc(HiLinkMdType type, const unsigned char *inData, unsigned int inLen, + unsigned char *md, unsigned int mdLen); + +/** + * @brief 哈希运算消息认证码计算 + * + * @param param [IN] 计算参数 + * @param hmac [OUT] hmac缓冲区,可写长度至少为hmacLen + * @param hmacLen [IN] hmac缓冲区长度,长度根据param->md参考HiLinkMdByteLen + * @return 0成功,其他失败 + */ +int HILINK_SAL_HmacCalc(const HiLinkHmacParam *param, unsigned char *hmac, unsigned int hmacLen); + +/** + * @brief 初始化摘要计算上下文,用于持续的哈希计算 + * + * @param type [IN] 消息摘要算法类型 + * @return NULL表示失败,其他表示成功 + * @attention 返回的上下文计算结束后需要使用HILINK_SAL_MdFree释放 + */ +HiLinkMdContext HILINK_SAL_MdInit(HiLinkMdType type); + +/** + * @brief 为持续的摘要计算导入数据 + * + * @param ctx [IN] 摘要计算上下文 + * @param inData [IN] 输入数据,可读长度至少为inLen + * @param inLen [IN] 输入数据长度 + * @return 0成功,其他失败 + */ +int HILINK_SAL_MdUpdate(HiLinkMdContext ctx, const unsigned char *inData, unsigned int inLen); + +/** + * @brief 结束持续的摘要计算,并输出结果 + * + * @param ctx [IN] 摘要计算上下文 + * @param outData [OUT] 输出数据缓冲区,有效长度至少为outLen + * @param outLen [IN] 输出数据缓冲区长度,根据摘要算法类型有最小长度要求,参考HiLinkMdByteLen + * @return 0成功,其他失败 + */ +int HILINK_SAL_MdFinish(HiLinkMdContext ctx, unsigned char *outData, unsigned int outLen); + +/** + * @brief 释放摘要计算上下文 + * + * @param ctx [IN] 摘要计算上下文 + */ +void HILINK_SAL_MdFree(HiLinkMdContext ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_MD_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_mpi.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_mpi.h new file mode 100755 index 0000000..a640411 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_mpi.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 多精度整数(Multi-precision integer)配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_MPI_H +#define HILINK_SAL_MPI_H + +#include +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief 标识多精度整数MPI */ +typedef void* HiLinkMpi; + +/** + * @brief 大数初始化 + * + * @return 非NULL大数指针,NULL失败 + * @attention 返回的大数使用完毕调用HILINK_SAL_MpiFree释放 + */ +HiLinkMpi HILINK_SAL_MpiInit(void); + +/** + * @brief 释放大数资源 + * + * @param mpi [IN] 已初始化的MPI + */ +void HILINK_SAL_MpiFree(HiLinkMpi mpi); + +/** + * @brief 模指数运算 x = a^e mod n + * + * @param x [OUT] 运算结果,应为已初始化的MPI + * @param a [IN] 待求幂的数,应为已初始化的MPI + * @param e [IN] 指数,应为已初始化的MPI + * @param n [IN] 模数,应为已初始化的MPI + * @return 0表示成功,非0失败 + */ +int HILINK_SAL_MpiExpMod(HiLinkMpi x, HiLinkMpi a, HiLinkMpi e, HiLinkMpi n); + +/** + * @brief MPI与整数比较 + * + * @param x [IN] 待比较的MPI,应为已初始化的MPI + * @param z [IN] 待比较的整数 + * @retval 0 x与z相等 + * @retval 1 x大于z + * @retval -1 x小于z + * @retval 其他 失败 + */ +int HILINK_SAL_MpiCmpInt(HiLinkMpi x, int64_t z); + +/** + * @brief MPI与整数相减 x = a - b + * + * @param x [OUT] 运算结果,应为已初始化的MPI + * @param a [IN] 被减数 + * @param b [IN] 减数 + * @return 0成功,非0失败 + */ +int HILINK_SAL_MpiSubInt(HiLinkMpi x, HiLinkMpi a, int64_t b); + +/** + * @brief 两个MPI比较大小 + * + * @param x [IN] 待比较的MPI,应为已初始化的MPI + * @param y [IN] 待比较的MPI,应为已初始化的MPI + * @retval 0 x与Y相等 + * @retval 1 x大于Y + * @retval -1 x小于Y + * @retval 其他 失败 + */ +int HILINK_SAL_MpiCmpMpi(HiLinkMpi x, HiLinkMpi y); + +/** + * @brief 从字符串读导入MPI + * + * @param mpi [OUT] 导入结果,应为已初始化的MPI + * @param radix [IN] 进制,范围应为[2,16] + * @param s [IN] 待读取的字符串 + * @return 0成功,非0失败 + */ +int HILINK_SAL_MpiReadString(HiLinkMpi mpi, unsigned char radix, const char *s); + +/** + * @brief 从MPI导出字符串 + * + * @param mpi [IN] 待导出字符串的MPI + * @param radix [IN] 进制,范围应为[2,16] + * @param buf [OUT] 输出缓冲区,有效可写长度至少为*bufLen + * @param bufLen [IN,OUT] 输入为输出缓冲区长度,输出为包括\0的字符串长度 + * @return 0成功,非0失败 + */ +int HILINK_SAL_MpiWriteString(HiLinkMpi mpi, unsigned int radix, char *buf, unsigned int *bufLen); + +/** + * @brief 从无符号大端二进制数据导入MPI + * + * @param mpi [OUT] 导入结果,应为已初始化的MPI + * @param buf [IN] 二进制数据缓冲区,有效可读长度至少为bufLen + * @param bufLen [IN] 二进制数据长度 + * @return 0成功,非0失败 + */ +int HILINK_SAL_MpiReadBinary(HiLinkMpi mpi, const unsigned char *buf, unsigned int bufLen); + +/** + * @brief 从MPI导出无符号大端二进制数据 + * + * @param mpi [IN] 待导出二进制数据的MPI + * @param buf [OUT] 二进制数据缓冲区,有效可写长度至少为bufLen + * @param bufLen [IN] 缓冲区长度 + * @return 0成功,非0失败 + */ +int HILINK_SAL_MpiWriteBinary(HiLinkMpi mpi, unsigned char *buf, unsigned int bufLen); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_MPI_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_rsa.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_rsa.h new file mode 100755 index 0000000..19db9d3 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sal_rsa.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: RSA加解密适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SAL_RSA_H +#define HILINK_SAL_RSA_H + +#include "hilink_sal_defines.h" +#include "hilink_sal_md.h" +#include "hilink_sal_mpi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief RSA PKCS填充模式 */ +typedef enum HiLinkRsaPkcs1Mode { + HILINK_RSA_PKCS1_V15 = 0, /**< PKCS#1 v1.5 */ + HILINK_RSA_PKCS1_V21, /**< PKCS#1 v2.1 */ + HILINK_RSA_PKCS1_RESERVED = ENUM_INT_REVERSED /**< 防止编译器优化 */ +} HiLinkRsaPkcs1Mode; + +/** @brief RSA 操作模式 */ +typedef enum HiLinkRsaOpMode { + HILINK_RSA_OP_PUBLIC = 0, /**< 公钥操作 */ + HILINK_RSA_OP_PRIVATE, /**< 私钥操作 */ + HILINK_RSA_OP_RESERVED = ENUM_INT_REVERSED /**< 防止编译器优化 */ +} HiLinkRsaOpMode; + +/** @brief RAS上下文 */ +typedef void* HiLinkRsaContext; + +/** @brief RSA核心参数 */ +typedef struct HiLinkRsaParam { + HiLinkMpi n; /**< 模数 */ + HiLinkMpi p; /**< 第一个素数因子 */ + HiLinkMpi q; /**< 第二个素数因子 */ + HiLinkMpi d; /**< 私有指数 */ + HiLinkMpi e; /**< 公有指数 */ +} HiLinkRsaParam; + +/** @brief RSA解密参数 */ +typedef struct HiLinkRsaCryptParam { + HiLinkRsaContext ctx; /**< RSA上下文 */ + HiLinkRsaOpMode mode; /**< 操作模式 */ + int (*rng)(unsigned char *out, unsigned int len); /**< 随机数发生器,私钥解密、公钥加密、HILINK_RSA_PKCS1_V21加密时应该提供 */ + const unsigned char *input; /**< 密文,可写长度至少为inLen */ + unsigned int inLen; /**< 密文长度,解密时应该与模数长度一致 */ +} HiLinkRsaCryptParam; + +/** + * @brief RSA上下文初始化 + * + * @param padding [IN] 填充模式 + * @param md [IN] 摘要算法类型,padding为HILINK_RSA_PKCS_V21时使用 + * @return NULL失败,非NULL为RSA上下文指针 + * @attention 返回的上下文使用完毕后应该使用HILINK_SAL_RsaFree释放 + */ +HiLinkRsaContext HILINK_SAL_RsaInit(HiLinkRsaPkcs1Mode padding, HiLinkMdType md); + +/** + * @brief RSA上下文释放 + * + * @param ctx [IN] RSA上下文 + */ +void HILINK_SAL_RsaFree(HiLinkRsaContext ctx); + +/** + * @brief RSA导入核心参数 + * + * @param ctx [IN] RSA上下文 + * @param param [IN] RSA参数 + * @return 0成功,非0失败 + */ +int HILINK_SAL_RsaParamImport(HiLinkRsaContext ctx, const HiLinkRsaParam *param); + +/** + * @brief 使用RSA公钥校验签名 + * + * @param ctx [IN] RSA上下文 + * @param md [IN] 签名摘要算法 + * @param hash [IN] 消息摘要,可读长度至少为hashLen + * @param hashLen [IN] 消息摘要长度 + * @param sig [IN] 签名,可读长度至少为sigLen + * @param sigLen [IN] 签名长度,应为RSA模数长度 + * @return 0成功,非0失败 + */ +int HILINK_RsaPkcs1Verify(HiLinkRsaContext ctx, HiLinkMdType md, const unsigned char *hash, + unsigned int hashLen, const unsigned char *sig, unsigned int sigLen); + +/** + * @brief RSA解密 + * + * @param param [IN] 解密参数 + * @param buf [OUT] 解密缓冲区,可写长度至少为*len + * @param len [IN,OUT] 输入为缓冲区长度,输出为解密数据长度 + * @return 0成功,非0失败 + */ +int HILINK_RsaPkcs1Decrypt(const HiLinkRsaCryptParam *param, unsigned char *buf, unsigned int *len); + +/** + * @brief RSA加密 + * + * @param param [IN] 加密参数 + * @param buf [OUT] 加密数据输出缓冲区,可写长度至少为*len + * @param len [IN] 输出缓冲区长度,应该大于等于模数长度 + * @return int + */ +int HILINK_RsaPkcs1Encrypt(const HiLinkRsaCryptParam *param, unsigned char *buf, unsigned int len); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SAL_RSA_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_socket_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_socket_adapter.h new file mode 100755 index 0000000..455d52e --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_socket_adapter.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 系统适配层网络Socket接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SOCKET_ADAPTER_H +#define HILINK_SOCKET_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum HiLinkSocketDomain { + HILINK_SOCKET_DOMAIN_AF_INET = 0, + HILINK_SOCKET_DOMAIN_AF_INET6, + HILINK_SOCKET_DOMAIN_UNSPEC, + /* 避免编译器优化,限制该枚举值为32-bit */ + HILINK_SOCKET_DOMAIN_RESERVED = 0x7FFFFFFF +} HiLinkSocketDomain; + +typedef enum HiLinkSocketType { + HILINK_SOCKET_TYPE_STREAM = 0, + HILINK_SOCKET_TYPE_DGRAM, + HILINK_SOCKET_TYPE_RAW, + /* 避免编译器优化,限制该枚举值为32-bit */ + HILINK_SOCKET_TYPE_RESERVED = 0x7FFFFFFF +} HiLinkSocketType; + +typedef enum HiLinkSocketProto { + HILINK_SOCKET_PROTO_IP = 0, + HILINK_SOCKET_PROTO_TCP, + HILINK_SOCKET_PROTO_UDP, + /* 避免编译器优化,限制该枚举值为32-bit */ + HILINK_SOCKET_PROTO_RESERVED = 0x7FFFFFFF +} HiLinkSocketProto; + +typedef enum HiLinkSocketOption { + /* 将套接字设置为阻塞模式 */ + HILINK_SOCKET_OPTION_SETFL_BLOCK = 0, + /* 将套接字设置为非阻塞模式 */ + HILINK_SOCKET_OPTION_SETFL_NONBLOCK, + /* 设置套接字读取超时时间,附带参数类型为unsigned int *,单位为ms */ + HILINK_SOCKET_OPTION_READ_TIMEOUT, + /* 设置套接字发送超时时间,附带参数类型为unsigned int *,单位为ms */ + HILINK_SOCKET_OPTION_SEND_TIMEOUT, + /* 允许套接字重复绑定地址 */ + HILINK_SOCKET_OPTION_ENABLE_REUSEADDR, + /* 禁用套接字重复绑定地址 */ + HILINK_SOCKET_OPTION_DISABLE_REUSEADDR, + /* 设置套接字加入组播组,附带参数类型为const char *,为组播点分ip地址字符串 */ + HILINK_SOCKET_OPTION_ADD_MULTI_GROUP, + /* 设置套接字退出组播组,附带参数类型为const char *,为组播点分ip地址字符串 */ + HILINK_SOCKET_OPTION_DROP_MULTI_GROUP, + /* 允许套接字发送广播 */ + HILINK_SOCKET_OPTION_ENABLE_BROADCAST, + /* 禁用套接字发送广播 */ + HILINK_SOCKET_OPTION_DISABLE_BROADCAST, + /* 允许套接字接收组播数据回环 */ + HILINK_SOCKET_OPTION_ENABLE_MULTI_LOOP, + /* 禁用套接字接收组播数据回环 */ + HILINK_SOCKET_OPTION_DISABLE_MULTI_LOOP, + /* 设置套接字发送缓冲区大小,附带参数类型为(unsigned int *) */ + HILINK_SOCKET_OPTION_SEND_BUFFER, + /* 设置套接字读取缓冲区大小,附带参数类型为(unsigned int *) */ + HILINK_SOCKET_OPTION_READ_BUFFER, + /* 避免编译器优化,限制该枚举值为32-bit */ + HILINK_SOCKET_OPTION_RESERVED = 0x7FFFFFFF +} HiLinkSocketOption; + +typedef struct HiLinkSockaddr { + unsigned short saFamily; +#define HILINK_SA_DATA_LEN 14 + char saData[HILINK_SA_DATA_LEN]; +} HiLinkSockaddr; + +typedef struct HiLinkSockaddrIn { + unsigned short sinFamily; + unsigned short sinPort; + unsigned int sinAddr; +#define HILINK_SIN_ZERO_LEN 8 + char sinZero[HILINK_SIN_ZERO_LEN]; +} HiLinkSockaddrIn; + +typedef struct HiLinkAddrInfo HiLinkAddrInfo; + +struct HiLinkAddrInfo { + int aiFlags; + int aiFamily; + int aiSocktype; + int aiProtocol; + int aiAddrlen; + HiLinkSockaddr *aiAddr; + char *aiCanonname; + HiLinkAddrInfo *aiNext; +}; + +typedef struct HiLinkFdSet { + unsigned int num; + int *fdSet; +} HiLinkFdSet; + +enum HiLinkSocketErrno { + HILINK_SOCKET_ERRNO_NO_ERROR = 0, + HILINK_SOCKET_ERRNO_EINTR = 4, + HILINK_SOCKET_ERRNO_EAGAIN = 11, + HILINK_SOCKET_ERRNO_EWOULDBLOCK = HILINK_SOCKET_ERRNO_EAGAIN, + HILINK_SOCKET_ERRNO_EINPROGRESS = 115, +}; + +/* + * 功能: 将主机名转换为地址信息 + * 参数: nodename,主机名 + * servname,服务名 + * hints,指定参数 + * result,出参,地址信息链表 + * 返回: 0,获取成功 + * 其他,获取失败 + */ +int HILINK_GetAddrInfo(const char *nodename, const char *servname, + const HiLinkAddrInfo *hints, HiLinkAddrInfo **result); + +/* + * 功能: 释放HILINK_GetAddrInfo获取的地址信息链表 + * 参数: addrInfo,地址信息链表 + */ +void HILINK_FreeAddrInfo(HiLinkAddrInfo *addrInfo); + +/* + * 功能: 获取获取INET网络套接字文件描述符 + * 参数: type,指定协议类型 + * 返回: 大于等于0,返回套接字描述符 + * 小于0,获取失败 + */ +int HILINK_Socket(HiLinkSocketDomain domain, HiLinkSocketType type, HiLinkSocketProto proto); + +/* + * 功能: 关闭套接字 + * 参数: fd,指定套接字 + */ +void HILINK_Close(int fd); + +/* + * 功能: 设置套接字可选字段 + * 参数: fd,指定套接字 + * option,设定的选项 + * value,选项参数 + * len,选项参数长度 + * 返回: 0,设置成功 + * -1,设置失败 + */ +int HILINK_SetSocketOpt(int fd, HiLinkSocketOption option, const void *value, unsigned int len); + +/* + * 功能: 绑定套接字 + * 参数: fd,指定的套接字 + * addr,指向包含要绑定到套接字的地址 + * addrLen,套接字地址大小,当前不使用,为ipv6预留 + * 返回: 0,绑定成功 + * -1,绑定失败 + */ +int HILINK_Bind(int fd, const HiLinkSockaddr *addr, unsigned int addrLen); + +/* + * 功能: 连接对端IP地址 + * 参数: fd,指定的套接字文件描述符 + * addr,指向套接字连接的地址 + * 返回: 0,设置成功 + * 其他,设置失败 + */ +int HILINK_Connect(int fd, const HiLinkSockaddr *addr, unsigned int addrLen); + +/* + * 功能: 从已经连接的套接字接收消息 + * 参数: fd,指定的套接字 + * buf,接收数据缓冲区 + * len,缓冲区长度 + * 返回: 大于等于0,实际接收的字节数 + * 小于0,读取出错,返回错误码 + */ +int HILINK_Recv(int fd, unsigned char *buf, unsigned int len); + +/* + * 功能: 传输指定长度消息到对端 + * 参数: fd,指定的套接字 + * buf,要发送的数据 + * len,数据长度 + * 返回: 大于等于0,实际发送的字节数 + * 小于0,发送失败,返回错误码 + */ +int HILINK_Send(int fd, const unsigned char *buf, unsigned int len); + +/* + * 功能: 从套接字接收消息,并返回源地址 + * 参数: fd,指定的套接字 + * buf,接收数据缓冲区 + * len,缓冲区长度 + * from,出参,数据源地址 + * 返回: 大于等于0,实际接收的字节数 + * 小于0,接收出错,返回错误码 + */ +int HILINK_RecvFrom(int fd, unsigned char *buf, unsigned int len, HiLinkSockaddr *from, unsigned int *fromLen); + +/* + * 功能: 发送数据到指定地址 + * 参数: fd,指定的套接字 + * buf,要发送的数据 + * len,数据长度 + * to,目标地址信息 + * 返回: 大于0,实际发送的字节数 + * 小于等于0,发送失败,返回错误码 + */ +int HILINK_SendTo(int fd, const unsigned char *buf, unsigned int len, const HiLinkSockaddr *to, unsigned int toLen); + +/* + * 功能: 检视多个文件描述符 + * 参数: rs,待检查是否准备好读取的描述符集合 + * ws,待检查是否准备好写入的描述符集合 + * es,待检查挂起错误条件的描述符集合 + * ms,超时时间,为HILINK_WAIT_FOREVER时不会超时 + * 返回: 大于0,与条件相符的描述符数量 + * 等于0,超时 + * 小于0,套接字出错,返回错误码 + * 注意: 返回时需将不符合要求的描述符置为-1 + */ +int HILINK_Select(HiLinkFdSet *readSet, HiLinkFdSet *writeSet, HiLinkFdSet *exceptSet, unsigned int ms); + +/* + * 功能: 获取描述符错误码 + * 参数: fd,指定的套接字,小于0时返回系统errno + * 返回: 错误码,参考HiLinkSocketErrno + * 注意:在HiLinkSocketErrno定义范围内的错误码需严格按照定义返回 + */ +int HILINK_GetSocketErrno(int fd); + +int get_os_errno(void); + +/* + * 功能: 获取全局错误码 + * 返回: 全局错误码错误码 + */ +typedef int (*GetErrno)(void); + +/* + * 功能: 注册获取全局错误码回调函数,不注册默认使用errno + * 参数: cb,获取全局错误码回调函数 + * 返回: 0表示成功,其他表示失败 + */ +int HILINK_RegisterErrnoCallback(GetErrno cb); + +/* + * 功能: 将32位的主机序转为网络序 + * 参数: hl,32位主机序 + * 返回: 32位网络序 + */ +unsigned int HILINK_Htonl(unsigned int hl); + +/* + * 功能: 将32位的网络序转为主机序 + * 参数: netlong,32位网络序 + * 返回: 32位主机序 + */ +unsigned int HILINK_Ntohl(unsigned int nl); + +/* + * 功能: 将16位的主机序转为网络序 + * 参数: hostlong,16位主机序 + * 返回: 16位网络序 + */ +unsigned short HILINK_Htons(unsigned short hs); + +/* + * 功能: 将16位的网络序转为主机序 + * 参数: netlong,16位网络序 + * 返回: 16位主机序 + */ +unsigned short HILINK_Ntohs(unsigned short ns); + +/* + * 功能: 将点分ip地址字符串转为32位网络序地址 + * 参数: ip,点分ip地址字符串 + * addr,出参,32位网络序地址 + * 返回: 0,转换失败 + * 非0,转换成功 + */ +unsigned int HILINK_InetAton(const char *ip, unsigned int *addr); + +/* + * 功能: 将点分ip地址字符串转为32位网络序地址 + * 参数: ip,点分ip地址字符串 + * 返回: 0xFFFFFFFF,转换失败 + * 其他,转换成功 + * 注意: 需要正确转换255.255.255.255请使用HILINK_InetAton + */ +unsigned int HILINK_InetAddr(const char *ip); + +/* + * 功能: 将32位网络序地址转为点分ip地址字符串 + * 参数: addr,32位网络序地址 + * 返回: NULL,转换失败 + * 非NULL,转换成功 + */ +const char *HILINK_InetNtoa(unsigned int addr, char *buf, unsigned int buflen); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SOCKET_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_softap_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_softap_adapter.h new file mode 100755 index 0000000..c824151 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_softap_adapter.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: SoftAP适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SOFTAP_ADAPTER_H +#define HILINK_SOFTAP_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 描述: 将网卡切为AP模式并开启SoftAP热点 + * 参数: ssid,用于创建SoftAP的ssid + * ssidLen,ssid长度,最大为64 + * 返回: 0表示成功,其他表示失败 + */ +int HILINK_StartSoftAp(const char *ssid, unsigned int ssidLen); + +/* + * 描述: 关闭SoftAP热点并将网卡切回station模式 + * 返回: 0表示成功,其他表示失败 + */ +int HILINK_StopSoftAp(void); + +#ifdef __cplusplus +} +#endif +#endif /* HILINK_SOFTAP_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_stdio_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_stdio_adapter.h new file mode 100755 index 0000000..5059a95 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_stdio_adapter.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 系统适配层标准输出接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_STDIO_ADAPTER_H +#define HILINK_STDIO_ADAPTER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 描述: 将数据格式化打印到流 + * 参数: format,可包含格式化符号的待打印字符串 + * ap, 可变参数,根据格式化符号插入字符串中 + * 返回: 0成功,其他失败 + */ +int HILINK_Vprintf(const char *format, va_list ap); + +/* + * 描述: 将数据格式化打印到流 + * 参数: format,可包含格式化符号的待打印字符串 + * ..., 可变参数列表,根据格式化符号插入字符串中 + * 返回: 0成功,其他失败 + */ +int HILINK_Printf(const char *format, ...); + +/* + * 功能: 随机数生成 + * 参数: 1) input,出入参,随机数缓冲区 + * 2) len,随机数字节长度 + * 返回: 0获取成功 -1获取失败 + * 注意: 该接口不可用于安全用途 + */ +int HILINK_Rand(unsigned char *input, unsigned int len); + +/* + * 功能: 真随机数生成 + * 参数: 1) input,出入参,随机数缓冲区 + * 2) len,随机数字节长度 + * 返回: 0获取成功 -1获取失败 + * 注意: 对于无安全随机数能力的平台,该接口直接返回-1 + * 该接口仅用作生成安全随机数熵源,HiLink SDK不直接使用 + */ +int HILINK_Trng(unsigned char *input, unsigned int len); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_STDIO_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_str_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_str_adapter.h new file mode 100755 index 0000000..41e7e2c --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_str_adapter.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 系统适配层字符串接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_STR_ADAPTER_H +#define HILINK_STR_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 描述: 用于计算字符串的长度 + * 参数: src,待计算长度的字符串 + * 返回: 字符串长度 + */ +unsigned int HILINK_Strlen(const char *src); + +/* + * 描述: 用于在字符串str中查找字符ch + * 参数: str,待查找字符串 + * ch,待查找字符 + * 返回: NULL没有查找到字符,非NULL指向ch的指针 + */ +char *HILINK_Strchr(const char *str, int ch); + +/* + * 描述: 在字符串str中逆向查找字符ch + * 参数: str,字符串 + * c,待查找字符 + * 返回: NULL没有查找到字符,非NULL指向ch的指针 + */ +char *HILINK_Strrchr(const char *str, int ch); + +/* + * 描述: 把字符串转换成int整形数字 + * 参数: str,传入需要转换成 int 类型字符串 + * 返回: 字符串转换成的int整形数字 + */ +int HILINK_Atoi(const char *str); + +/* + * 描述: 在str1中查找是否存在str2 + * 参数: str1,被查找目标 + * str2,要查找对象 + * 返回: NULL不存在,非NULLstr2在str1中首次出现位置的指针 + */ +char *HILINK_Strstr(const char *str1, const char *str2); + +/* + * 描述: 比较两个字符串str1和str2 + * 参数: str1,目标字符串1 + * str2,目标字符串2 + * 返回: 0成功,小于0表示str1小于str2, 大于0表示str1大于str2 + */ +int HILINK_Strcmp(const char *str1, const char *str2); + +/* + * 描述: 比较两个字符串str1和str2 + * 参数: str1,目标字符串1 + * str2,目标字符串2 + * len,比较的长度 + * 返回: 0成功,小于0表示str1小于str2, 大于0表示str1大于str2 + */ +int HILINK_Strncmp(const char *str1, const char *str2, unsigned int len); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_STR_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sys_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sys_adapter.h new file mode 100755 index 0000000..2f55823 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_sys_adapter.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 系统适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_SYS_ADAPTER_H +#define HILINK_SYS_ADAPTER_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum HiLinkBootReason { + HILINK_NORMAL_BOOT = 0, /* 正常上电 */ + HILINK_WIFIDOG_REBOOT = 100, /* WIFI挂死重启 */ + HILINK_SOFTDOG_REBOOT = 101, /* HiLink任务挂死重启 */ + HILINK_HARDDOG_REBOOT = 102, /* 整机挂死导致的硬件狗复位重启 */ + HILINK_HOTA_REBOOT = 103, /* Hota升级成功后重启 */ + HILINK_SCHEDULED_REBOOT = 104, /* 定时重启 */ + HILINK_HOTADOG_REBOOT = 105, /* HOTA挂死重启 */ + HILINK_BOOT_REASON_BUTT /* 获取失败 */ +} HiLinkBootReason; + +/* + * 描述: 重启HiLink SDK + * 返回: 0表示成功,其他表示失败 + * 注意: 若系统不可重启,建议重启HiLink进程 + */ +int HILINK_Restart(void); + +/* + * 描述: 获取系统启动原因 + * 返回: 见HiLinkBootReason + */ +unsigned char HILINK_GetSystemBootReason(void); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_SYS_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_thread_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_thread_adapter.h new file mode 100755 index 0000000..d68dc71 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_thread_adapter.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 线程适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_THREAD_ADAPTER_H +#define HILINK_THREAD_ADAPTER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define HILINK_WAIT_FOREVER 0xFFFFFFFFU + +typedef void* HiLinkTaskId; + +typedef void* HiLinkMutexId; + +typedef void* HiLinkSemId; + +typedef void (*HiLinkTaskEntryFunc)(void *arg); + +typedef enum HiLinkTaskPrio { + HILINK_TASK_PRIORITY_MIN = 0, + HILINK_TASK_PRIORITY_LOW, + HILINK_TASK_PRIORITY_MID, + HILINK_TASK_PRIORITY_HIGH, + HILINK_TASK_PRIORITY_MAX, + /* 避免编译器优化,限制该枚举值为32-bit */ + HILINK_TASK_PRIORITY_REVERSED = 0x7FFFFFFF +} HiLinkTaskPrio; + +typedef struct HiLinkTaskParam { + HiLinkTaskEntryFunc func; + HiLinkTaskPrio prio; + unsigned int stackSize; + void *arg; + const char *name; +} HiLinkTaskParam; + +/* + * 描述:创建线程接口 + * 参数:param,线程参数 + * 返回: NULL创建线程失败,其他线程句柄 + */ +HiLinkTaskId HILINK_CreateTask(HiLinkTaskParam *param); + +/* + * 描述:挂起线程接口 + * 参数:handle,挂起线程句柄 + * 返回:0成功, 其他失败 + */ +int HILINK_ThreadSuspend(HiLinkTaskId handle); + +/* + * 描述:恢复线程接口 + * 参数:handle,恢复线程句柄 + * 返回:0成功,其他失败 + */ +int HILINK_ThreadResume(HiLinkTaskId handle); + +/* + * 描述:删除线程接口 + * 参数:handle,删除线程句柄 + */ +void HILINK_DeleteTask(HiLinkTaskId handle); + +/* + * 描述:获取当前运行线程的句柄 + * 返回:当前运行线程的句柄 + */ +HiLinkTaskId HILINK_GetCurrentTaskId(void); + +/* + * 描述:创建互斥锁 + * 返回:NULL失败, 其他互斥锁句柄 + */ +HiLinkMutexId HILINK_MutexCreate(void); + +/* + * 描述:互斥锁加锁 + * 参数:mutex,互斥锁 + * ms,超时时间,为HILINK_WAIT_FOREVER不会超时 + * 返回:0成功, 其他失败 + */ +int HILINK_MutexLock(HiLinkMutexId mutex, unsigned int ms); + +/* + * 描述:互斥锁解锁 + * 参数:mutex,互斥锁句柄 + * 返回:0成功,其他失败 + */ +int HILINK_MutexUnlock(HiLinkMutexId mutex); + +/* + * 描述:互斥锁释放 + * 参数:mutex,互斥锁句柄 + */ +void HILINK_MutexDestroy(HiLinkMutexId mutex); + +/* + * 描述:创建信号量 + * 参数:count,指定信号量值的初始值大小 + * 返回:NULL失败, 其他信号量句柄 + */ +HiLinkSemId HILINK_SemCreate(unsigned int count); + +/* + * 描述:信号量的值减1 + * 参数:handle,信号量句柄 + * ms,阻塞超时时间,为HILINK_WAIT_FOREVER不会超时 + * 返回:0表示成功, 其他值表示失败 + */ +int HILINK_SemWait(HiLinkSemId handle, unsigned int ms); + +/* + * 描述:信号量的值加1 + * 参数:handle,信号量句柄 + * 返回:0表示成功, 其他值表示失败 + */ +int HILINK_SemPost(HiLinkSemId handle); + +/* + * 描述:销毁信号量 + * 参数:handle,信号量句柄 + */ +void HILINK_SemDestroy(HiLinkSemId handle); + +/* + * 描述:将进程休眠指定的时间 + * 参数:ms,休眠的毫秒数 + * 返回:0成功,其他失败 + */ +int HILINK_MilliSleep(unsigned int ms); + +/** + * @brief 让出系统调度以使其他等待线程可以执行 + */ +void HILINK_SchedYield(void); + +#ifdef __cplusplus +} +#endif + +/* 打开互斥锁检测调试功能 */ +#ifdef SUPPORT_MUTEX_DEBUG +#include "mutex_debug_utils.h" +#endif + +#endif /* HILINK_THREAD_ADAPTER_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_time_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_time_adapter.h new file mode 100755 index 0000000..e310a67 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_time_adapter.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 时间适配层接口(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_TIME_ADAPTER_H +#define HILINK_TIME_ADAPTER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct HiLinkTimeval { + uint32_t sec; + uint32_t usec; +} HiLinkTimeval; + +/* + * 描述:获取当前设备启动后运行时间 + * 参数:time,出参,表示当前设备启动后运行时间 + * 返回:0成功,其他失败 + */ +int HILINK_GetOsTime(HiLinkTimeval *time); + +/* + * 描述:获取当前UTC时间 + * 参数:time,出参 + * 返回:0成功,其他失败 + * 注意: 对于不支持时间同步的设备,该接口不使用 + */ +int HILINK_GetUtcTime(HiLinkTimeval *time); + +#ifdef __cplusplus +} +#endif + +#endif /* HILINK_TIME_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_tls_client.h b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_tls_client.h new file mode 100755 index 0000000..844c5e0 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/include/hilink_tls_client.h @@ -0,0 +1,178 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: TLS 客户端常用操作,包括会话的创建、销毁等(此文件为DEMO,需集成方适配修改) + */ + +#ifndef HILINK_TLS_CLIENT_H +#define HILINK_TLS_CLIENT_H + +#include +#include +#include "hilink_sal_defines.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* hilink tls需要的算法套件重定义,与mbedtls中的头文件保持一致 */ +#define HILINK_MBEDTLS_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA8 +#define HILINK_MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030 +#define HILINK_MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F +#define HILINK_MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 0xA8 +#define HILINK_MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 0xA9 + +/* hilink tls最大分片大小重定义,与mbedtls中的头文件保持一致 */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_NONE 0 /* !< don't use this extension */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_512 1 /* !< MaxFragmentLength 2^9 */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_1024 2 /* !< MaxFragmentLength 2^10 */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_2048 3 /* !< MaxFragmentLength 2^11 */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_4096 4 /* !< MaxFragmentLength 2^12 */ +#define HILINK_MBEDTLS_SSL_MAX_FRAG_LEN_DEFAULT 255 /* 使用默认值,不配置 */ + +/** @brief TLS客户端句柄 */ +typedef struct HiLinkTlsClient HiLinkTlsClient; + +/** + * @brief 获取当前实时时间 + * + * @param timeMs [OUT] 输出时间 + * @return 0 成功; -1 失败 + */ +typedef int (*HiLinkMbedtlsGetTimeCb)(unsigned long long *timeMs); + +/** @brief TLS客户端host信息 */ +typedef struct HiLinkTlsHost { + /** 对端hostname */ + const char *hostname; + /** 对端端口号,由TLS客户端创建fd时需传入 */ + unsigned short port; +} HiLinkTlsHost; + +/** @brief TLS客户端使用的加密套件 */ +typedef struct HiLinkTlsCiphersuites { + /** 加密套件标识符数组 */ + const int *ciphersuites; + /** 加密套件数量 */ + unsigned int num; +} HiLinkTlsCiphersuites; + +/** @brief TLS客户端使用的证书 */ +typedef struct HiLlinkTlsCerts { + /** 证书数组,在客户端有效期内数组指针应有效 */ + const char **certs; + /** 证书数量 */ + unsigned int num; + /** 延迟校验证书标志位 */ + bool isDelayVerifyCert; +} HiLlinkTlsCerts; + +/** @brief TLS客户端psk参数 */ +typedef struct HiLlinkTlsPsk { + /** psk */ + const unsigned char *psk; + /** psk长度 */ + unsigned int pskLen; + /** psk标识符 */ + const unsigned char *pskIdentity; + /** psk标识符长度 */ + unsigned int pskIdentityLen; +} HiLlinkTlsPsk; + +typedef enum { + /* 为TLS客户端设置套接字,参数类型为int* */ + HILINK_TLS_OPTION_FD = 0, + /* 为TLS客户端设置获取时间回调函数,参数类型为HiLinkMbedtlsGetTimeCb,对所有客户端生效 */ + HILINK_TLS_OPTION_REG_TIME_CB, + /* 为TLS客户端设置对端地址,参数类型为HiLinkTlsHost* */ + HILINK_TLS_OPTION_HOST, + /* 为TLS客户端设置套件白名单,参数类型为HiLinkTlsCiphersuites* */ + HILINK_TLS_OPTION_CIPHERSUITE, + /* 为TLS客户端设置证书,参数类型为HiLlinkTlsCerts* */ + HILINK_TLS_OPTION_CERT, + /* 为TLS客户端设置psk,参数类型为HiLlinkTlsPsk* */ + HILINK_TLS_OPTION_PSK, + /* 为TLS客户端设置最大分片大小,参数类型为unsiged char *,值参考HILINK_MBEDTLS_SSL_MAX_FRAG_LEN */ + HILINK_TLS_OPTION_MAX_FRAG_LEN, + HILINK_TLS_OPTION_RESERVED = 0x7FFFFFFF, +} HiLinkTlsOption; + +/** + * @brief 创建 Tls 客户端 + * + * @param custom [IN] tls客户端标识名称 + * @return 非NULL客户端句柄,NULL失败 + */ +HiLinkTlsClient *HILINK_TlsClientCreate(const char *custom); + +/** + * @brief 配置TLS客户端 + * + * @param ctx [IN] tls客户端句柄 + * @param option [IN] 设定的选项 + * @param value [IN] 选项参数 + * @param len [IN] 选项参数长度 + * @return 0成功,非0失败 + */ +int HILINK_SetTlsClientOption(HiLinkTlsClient *ctx, HiLinkTlsOption option, const void *value, unsigned int len); + +/** + * @brief TLS客户端连接对端 + * + * @param ctx [IN] tls客户端句柄 + * @return 0成功,非0失败 + */ +int HILINK_TlsClientConnect(HiLinkTlsClient *ctx); + +/** + * @brief 获取ContextFd + * + * @param ctx [IN] tls客户端句柄 + * @return ContextFd + */ +int HILINK_TlsClientGetContextFd(HiLinkTlsClient *ctx); + +/** + * @brief Tls 读取数据 非阻塞 + * + * @param ctx [IN] tls客户端句柄 + * @param buf [OUT] 数据输出buf + * @param len [IN] buf可写长度 + * @return 0 正常在读取中暂未接到包; 小于0 失败; 其他为接收成功数据长度 + */ +int HILINK_TlsClientRead(HiLinkTlsClient *ctx, unsigned char *buf, size_t len); + +/** + * @brief Tls 发送数据 非阻塞 + * + * @param ctx [IN] tls客户端句柄 + * @param buf [IN] 发送数据 + * @param len [IN] buf 大小 + * @return 0 正常在发送; 小于0失败; 其他为发送成功数据长度 + */ +int HILINK_TlsClientWrite(HiLinkTlsClient *ctx, const unsigned char *buf, size_t len); + +/** + * @brief Tls 验证证书 + * + * @param ctx [IN] tls客户端句柄 + * @return true 有效 false 失效 + */ +bool HILINK_TlsClientIsValidCert(HiLinkTlsClient *ctx); + +/** + * @brief Tls 资源释放 + * + * @param ctx [IN] tls客户端句柄 + * @return 0 成功; 其他失败 + */ +int HILINK_TlsClientFreeResource(HiLinkTlsClient *ctx); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* HILINK_TLS_CLIENT_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_cm.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_cm.c new file mode 100755 index 0000000..a6b0df2 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_cm.c @@ -0,0 +1,81 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + * + * Description: SLE Connection manager module. + */ + +/** + * @defgroup oh_sle_connection_manager Connection manager API + * @ingroup SLE + * @{ + */ +#include "oh_sle_common.h" +#include "sle_connection_manager.h" +#include "oh_sle_connection_manager.h" + +#undef THIS_FILE_ID +#define THIS_FILE_ID OH_GLE_SRV_CONNECTION_MANAGER + +ErrCodeType SleConnectRemoteDevice(const SleAddr *addr) +{ + return sle_connect_remote_device((sle_addr_t *)addr); +} + +ErrCodeType SleDisconnectRemoteDevice(const SleAddr *addr) +{ + return sle_disconnect_remote_device((sle_addr_t *)addr); +} + +ErrCodeType SleUpdateConnectParam(SleConnectionParamUpdate *params) +{ + return sle_update_connect_param((sle_connection_param_update_t *)params); +} + +ErrCodeType SlePairRemoteDevice(const SleAddr *addr) +{ + return sle_pair_remote_device((sle_addr_t *)addr); +} + +ErrCodeType SleRemovePairedRemoteDevice(const SleAddr *addr) +{ + return sle_remove_paired_remote_device((sle_addr_t *)addr); +} + +ErrCodeType SleRemoveAllPairs(void) +{ + return sle_remove_all_pairs(); +} + +ErrCodeType SleGetPairedDevicesNum(uint16_t *number) +{ + return sle_get_paired_devices_num(number); +} + +ErrCodeType SleGetPairedDevices(SleAddr *addr, uint16_t *number) +{ + return sle_get_paired_devices((sle_addr_t *)addr, number); +} + +ErrCodeType SleGetPairState(const SleAddr *addr, uint8_t *State) +{ + return sle_get_pair_state((sle_addr_t *)addr, State); +} + +ErrCodeType SleReadRemoteDeviceRssi(uint16_t connId) +{ + return sle_read_remote_device_rssi(connId); +} + +ErrCodeType SleConnectionRegisterCallbacks(SleConnectionCallbacks *func) +{ + sle_connection_callbacks_t cbk = {0}; + cbk.connect_state_changed_cb = (sle_connect_state_changed_callback)func->connectStateChangedCb; + cbk.connect_param_update_req_cb = (sle_connect_param_update_req_callback)func->connectParamUpdateReqCb; + cbk.connect_param_update_cb = (sle_connect_param_update_callback)func->connectParamUpdateCb; + cbk.auth_complete_cb = (sle_auth_complete_callback)func->authCompleteCb; + cbk.pair_complete_cb = (sle_pair_complete_callback)func->pairCompleteCb; + cbk.read_rssi_cb = (sle_read_rssi_callback)func->readRssiCb; + cbk.low_latency_cb = (sle_low_latency_callback)func->lowLatencCb; + cbk.set_phy_cb = (sle_set_phy_callback)func->setPhyCb; + return sle_connection_register_callbacks(&cbk); +} \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_dd.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_dd.c new file mode 100755 index 0000000..a07130e --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_dd.c @@ -0,0 +1,99 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE Device Discovery, Scan Manager, module. + */ + +/** + * @defgroup sle_device_discovery Device Discovery, Scan Manager API + * @ingroup SLE + * @{ + */ + +#include "sle_device_discovery.h" +#include "oh_sle_device_discovery.h" + +ErrCodeType EnableSle(void) +{ + return enable_sle(); +} + +ErrCodeType DisableSle(void) +{ + return disable_sle(); +} + +ErrCodeType SleSetLocalAddr(SleAddr *addr) +{ + return sle_set_local_addr((sle_addr_t*)addr); +} + +ErrCodeType SleGetLocalAddr(SleAddr *addr) +{ + return sle_get_local_addr((sle_addr_t*)addr); +} + +ErrCodeType SleSetLocalName(const uint8_t *name, uint8_t len) +{ + return sle_set_local_name(name, len); +} + +ErrCodeType SleGetLocalName(uint8_t *name, uint8_t *len) +{ + return sle_get_local_name(name, len); +} + +ErrCodeType SleSetAnnounceData(uint8_t announceId, const SleAnnounceData *data) +{ + return sle_set_announce_data(announceId, (sle_announce_data_t *)data); +} + +ErrCodeType SleSetAnnounceParam(uint8_t announceId, const SleAnnounceParam *param) +{ + return sle_set_announce_param(announceId, (sle_announce_param_t *)param); +} + + +ErrCodeType SleStartAnnounce(uint8_t announceId) +{ + return sle_start_announce(announceId); +} + +ErrCodeType SleStopAnnounce(uint8_t announceId) +{ + return sle_stop_announce(announceId); +} + + +ErrCodeType SleSetSeekParam(SleSeekParam *param) +{ + return sle_set_seek_param((sle_seek_param_t *)param); +} + +ErrCodeType SleStartSeek(void) +{ + return sle_start_seek(); +} + +ErrCodeType SleStopSeek(void) +{ + return sle_stop_seek(); +} + +ErrCodeType SleAnnounceSeekRegisterCallbacks(SleAnnounceSeekCallbacks *func) +{ + uint8_t ret = OH_ERRCODE_SLE_SUCCESS; + sle_announce_seek_callbacks_t announce_cbk = {0}; + announce_cbk.sle_enable_cb = (sle_enable_callback)(func->sleEnableCb); + announce_cbk.sle_disable_cb = (sle_disable_callback)(func->sleDisableCb); + announce_cbk.announce_enable_cb = (sle_announce_enable_callback)(func->announceEnableCb); + announce_cbk.announce_disable_cb = (sle_announce_disable_callback)(func->announceDisableCb); + announce_cbk.announce_remove_cb = (sle_announce_remove_callback)(func->announceRemoveCb); + announce_cbk.announce_terminal_cb = (sle_announce_terminal_callback)(func->announceTerminalCb); + announce_cbk.seek_enable_cb = (sle_start_seek_callback)(func->seekEnableCb); + announce_cbk.seek_disable_cb = (sle_seek_disable_callback)(func->seekDisableCb); + announce_cbk.seek_result_cb = (sle_seek_result_callback)(func->seekResultCb); + announce_cbk.sle_dfr_cb = (sle_dfr_callback)(func->seekDfrCb); + ret |= sle_announce_seek_register_callbacks(&announce_cbk); + return ret; +} \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_client.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_client.c new file mode 100755 index 0000000..1674e3f --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_client.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + */ +#undef THIS_FILE_ID +#define THIS_FILE_ID BTH_GLE_SRV_SERVICE_ACCESS_PROTOTOL_CLIENT + +#include "osal_list.h" +#include "oh_sle_errcode.h" +#include "oh_sle_common.h" +#include "sle_ssap_client.h" +#include "oh_sle_ssap_client.h" + +errcode_t SsapcRegisterClient(SleUuid *appUuid, uint8_t *clientId) +{ + return ssapc_register_client((sle_uuid_t *)appUuid, clientId); +} + +errcode_t SsapcUnregisterClient(uint8_t clientId) +{ + return ssapc_unregister_client(clientId); +} + +errcode_t SsapcFindStructure(uint8_t clientId, uint16_t connId, SsapcFindStructureParam *param) +{ + return ssapc_find_structure(clientId, connId, (ssapc_find_structure_param_t*)param); +} + +errcode_t SsapcReadReqByUuid(uint8_t clientId, uint16_t connId, SsapcReadReqByUuidParam *param) +{ + return ssapc_read_req_by_uuid(clientId, connId, (ssapc_read_req_by_uuid_param_t *)param); +} + +errcode_t SsapcReadReq(uint8_t clientId, uint16_t connId, uint16_t handle, uint8_t type) +{ + return ssapc_read_req(clientId, connId, handle, type); +} + + +errcode_t SsapWriteReq(uint8_t clientId, uint16_t connId, SsapcWriteParam *param) +{ + return ssapc_write_req(clientId, connId, (ssapc_write_param_t *)param); +} + +errcode_t SsapcWriteCmd(uint8_t clientId, uint16_t connId, SsapcWriteParam *param) +{ + return ssapc_write_cmd(clientId, connId, (ssapc_write_param_t *)param); +} + +errcode_t SsapcExchangeInfoReq(uint8_t clientId, uint16_t connId, SsapcExchangeInfo* param) +{ + return ssapc_exchange_info_req(clientId, connId, (ssap_exchange_info_t*)param); +} + +errcode_t SsapcRegisterCallbacks(SsapcCallbacks *func) +{ + ssapc_callbacks_t cbk = {0}; + cbk.find_structure_cb = (ssapc_find_structure_callback)(func->findStructureCb); + cbk.ssapc_find_property_cbk = (ssapc_find_property_callback)(func->ssapcFindPropertyCbk); + cbk.find_structure_cmp_cb = (ssapc_find_structure_complete_callback)(func->findStructureCmpCb); + cbk.read_cfm_cb = (ssapc_read_cfm_callback)(func->readCfmCb); + cbk.read_by_uuid_cmp_cb = (ssapc_read_by_uuid_complete_callback)(func->readByUuidCmpCb); + cbk.write_cfm_cb = (ssapc_write_cfm_callback)(func->writeCfmCb); + cbk.exchange_info_cb = (ssapc_exchange_info_callback)(func->exchangeInfoCb); + cbk.notification_cb = (ssapc_notification_callback)(func->notificationCb); + cbk.indication_cb = (ssapc_indication_callback)(func->indicationCb); + return ssapc_register_callbacks(&cbk); +} \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_server.c b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_server.c new file mode 100755 index 0000000..041ecea --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/adapter/oh_sle_srv_ssap_server.c @@ -0,0 +1,100 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + * + * Description: SLE ssap server manager module. + */ + +/** + * @defgroup sle_srv_ssap_server ssap server manager API + * @ingroup SLE + * @{ + */ + +#include "sle_ssap_server.h" +#include "oh_sle_ssap_stru.h" +#include "oh_sle_ssap_server.h" + +#undef THIS_FILE_ID +#define THIS_FILE_ID BTH_GLE_SRV_SERVICE_ACCESS_PROTOTOL_SERVER + +#define OCTET_BIT_LEN 8 + +#define INVALID_ITEM_HANDLE 0xFFFF +#define INVALID_CONN_ID 0xFFFF +#define INVALID_SERVER_ID 0xFF + +#define SSAPS_MAX_SERVICE_NUM 64 +#define SSAPS_MAX_SERVER_NUM 1 +#define SSAPS_MAX_HANLDE_NUM 0xFFFF + +errcode_t ssapsRegisterServer(SleUuid *appUuid, uint8_t *serverId) +{ + return ssaps_register_server((sle_uuid_t *)appUuid, serverId); +} + +errcode_t SsapsUnregisterServer(uint8_t serverId) +{ + return ssaps_unregister_server(serverId); +} + +errcode_t SsapsAddServiceSync(uint8_t serverId, SleUuid *serviceUuid, bool isPrimary, uint16_t *handle) +{ + return ssaps_add_service_sync(serverId, (sle_uuid_t *)serviceUuid, isPrimary, handle); +} + +errcode_t SsapsAddPropertySync(uint8_t serverId, uint16_t serviceHandle, SsapsPropertyInfo *property, + uint16_t *handle) +{ + return ssaps_add_property_sync(serverId, serviceHandle, (ssaps_property_info_t *)property, handle); +} + +errcode_t SsapsAddDescriptorSync(uint8_t serverId, uint16_t serviceHandle, uint16_t propertyHandle, + SsapsDescInfo *descriptor) +{ + return ssaps_add_descriptor_sync(serverId, serviceHandle, propertyHandle, (ssaps_desc_info_t *)descriptor); +} + +errcode_t SsapsStartService(uint8_t serverId, uint16_t serviceHandle) +{ + return ssaps_start_service(serverId, serviceHandle); +} + +errcode_t SsapsDeleteAllServices(uint8_t serverId) +{ + return ssaps_delete_all_services(serverId); +} + +errcode_t SsapsSendResponse(uint8_t serverId, uint16_t connId, SsapsSendRsp *param) +{ + return ssaps_send_response(serverId, connId, (ssaps_send_rsp_t *)param); +} + +errcode_t SsapsNotifyIndicate(uint8_t serverId, uint16_t connId, SsapsNtfInd *param) +{ + return ssaps_notify_indicate(serverId, connId, (ssaps_ntf_ind_t *)param); +} + +errcode_t SsapsNotifyIndicateByUuid(uint8_t serverId, uint16_t connId, SsapsNtfIndByUuid *param) +{ + return ssaps_notify_indicate_by_uuid(serverId, connId, (ssaps_ntf_ind_by_uuid_t *)param); +} + +errcode_t SsapsSetInfo(uint8_t serverId, SsapcExchangeInfo *info) +{ + return ssaps_set_info(serverId, (ssap_exchange_info_t *)info); +} + +errcode_t SsapsRegisterCallbacks(SsapsCallbacks *func) +{ + ssaps_callbacks_t cbk = {0}; + cbk.add_service_cb = (ssaps_add_service_callback)(func->addServiceCb); + cbk.add_property_cb = (ssaps_add_property_callback)(func->addPropertyCb); + cbk.add_descriptor_cb = (ssaps_add_descriptor_callback)(func->addDescriptorCb); + cbk.start_service_cb = (ssaps_start_service_callback)(func->startServiceCb); + cbk.delete_all_service_cb = (ssaps_delete_all_service_callback)(func->deleteAllServiceCb); + cbk.read_request_cb = (ssaps_read_request_callback)(func->readRequestCb); + cbk.write_request_cb = (ssaps_write_request_callback)(func->writeRequestCb); + cbk.indicate_cfm_cb = (ssaps_indicate_cfm_callback)(func->indicateCfmCb); + cbk.mtu_changed_cb = (ssaps_mtu_changed_callback)(func->mtuChangedCb); + return ssaps_register_callbacks(&cbk); +} \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/entry/hilink_ble_main.c b/application/samples/wifi/ohos_connect/hilink_adapt/entry/hilink_ble_main.c index 8290689..a5d7b15 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/entry/hilink_ble_main.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/entry/hilink_ble_main.c @@ -223,9 +223,10 @@ int getDeviceVersion(char* *firmwareVer, char* *softwareVer, char* *hardwareVer) } #ifdef CONFIG_SUPPORT_HILINK_INDIE_UPGRADE static char fwvWithSwv[64] = ""; - if (sprintf_s(fwvWithSwv, sizeof(fwvWithSwv), "%s_%s", FIRMWARE_VER, SOFTWARE_VER) <= 0) { - return -1; - } + if (sprintf_s(fwvWithSwv, sizeof(fwvWithSwv), "%s_%s_%s", "103","1.312", FIRMWARE_VER) <= 0) + { + return -1; + } *firmwareVer = fwvWithSwv; #else *firmwareVer = FIRMWARE_VER; @@ -293,7 +294,7 @@ static void HILINK_BT_StateChangeHandler(HILINK_BT_SdkStatus event, const void * HILINK_SAL_ERROR("set addr err\n"); } /* 设置蓝牙广播格式,包括靠近发现、碰一碰等,下一次发送广播生效 */ - BLE_SetAdvType(BLE_ADV_LOCAL_NAME); + BLE_SetAdvType(BLE_ADV_NEARBY_V0); /* BLE配网广播控制:参数代表广播时间,0:停止;0xFFFFFFFF:一直广播,其他:广播指定时间后停止,单位秒 */ (void)BLE_CfgNetAdvCtrl(ble_adv_time); @@ -499,20 +500,17 @@ static int BleHandleCustomData(const char *buff, unsigned int len) } break; } else if (strcmp(sidItem->valuestring, "update") == 0) { + // 参考格式 {"sid":"update", "data":{"autoUpdateOn":1}} cJSON *item = cJSON_GetObjectItem(dataItem, "autoUpdateOn"); - if (item == NULL) { - HILINK_SAL_NOTICE("autoUpdateOn json null\r\n"); - ret = -1; - break; - } + if (item != NULL) { g_autoUpdate = item->valueint != 0 ? true : false; - - HILINK_SAL_NOTICE("DEMO: Hilink receive a update cmd, on = %d\r\n", g_autoUpdate); - ReporAutoUpdateStatus(); // 连上手机蓝牙时,发的第一个cjson数据。同步一次设备状态 + HILINK_SAL_NOTICE("DEMO: Hilink receive a update cmd, on = %d\r\n", g_autoUpdate); + } + ReporAutoUpdateStatus(); ret = 0; break; } - } while(0); + } while (0); cJSON_Delete(json); return ret; @@ -525,11 +523,11 @@ static int BleRcvCustomData(unsigned char *buff, unsigned int len) HILINK_SAL_NOTICE("buff is NULL\r\n"); return -1; } - HILINK_SAL_NOTICE("custom data, len: %u, data: %s\n", len, buff); + HILINK_SAL_NOTICE("custom data, len: %u, data: %s", len, buff); /* 处理自定义数据 */ if (BleHandleCustomData((const char *)buff, len) != 0) { - HILINK_SAL_NOTICE("BleHandleCustomData fail\n"); + HILINK_SAL_NOTICE("BleHandleCustomData fail"); return -1; } @@ -582,13 +580,15 @@ int hilink_ble_main(void) { if(hfget_hilink_mode() == SMTLK_BLE_NARMAL) { + HILINK_EnablePrescan(); HILINK_SetProtType(1); } else if(hfget_hilink_mode() == SMTLK_BLE_ADD_LOCAL_CONTROL) - { + { + HILINK_EnablePrescan(); HILINK_SetProtType(12); } - else if(hfget_hilink_mode() == SMTLK_BLE_FAST_CONNECT) + else if(hfget_hilink_mode() == SMTLK_BLE_FAST_CONNECT && (g_module_id == HFM_TYPE_LPT262)) { /* 打开星闪总开关 */ HILINK_EnableSle(); @@ -600,31 +600,29 @@ int hilink_ble_main(void) ret = HILINK_SetNetConfigMode(HILINK_NETCONFIG_OTHER); /* 设备按需设置,例如接入蓝牙网关时,设置广播类型标志及心跳间隔 */ - unsigned char mpp[] = {0x02, 0x3c, 0x00}; + unsigned char mpp[] = {0x02, 0x01, 0x01}; ret = BLE_SetAdvNameMpp(mpp, sizeof(mpp)); if (ret != 0) { HILINK_SAL_NOTICE("set adv name mpp failed\r\n"); - return -1; - } + return -1; + } - /* 注册SDK状态接收函数,可在初始化完成后发送广播 */ - ret = HILINK_BT_SetSdkEventCallback(HILINK_BT_StateChangeHandler); - if (ret != 0) { + /* 注册SDK状态接收函数,可在初始化完成后发送广播 */ + ret = HILINK_BT_SetSdkEventCallback(HILINK_BT_StateChangeHandler); + if (ret != 0) { HILINK_SAL_NOTICE("set event callback failed\r\n"); - return -1; - } + return -1; + } - /* 设置广播方式为靠近发现 */ - BLE_SetAdvType(BLE_ADV_LOCAL_NAME); + /* 设置广播方式为靠近发现 */ + BLE_SetAdvType(BLE_ADV_NEARBY_V0); - /* 初始化ble sdk */ - ret = BLE_CfgNetInit(&g_bleInitParam, &g_bleCfgNetCb); - if (ret != 0) { + /* 初始化ble sdk */ + ret = BLE_CfgNetInit(&g_bleInitParam, &g_bleCfgNetCb); + if (ret != 0) { HILINK_SAL_NOTICE("ble sdk init fail\r\n"); return -1; } - e_printf("ble sdk init success\r\n"); - //set_get_ble_mac(); } else if(hilink_entry_mode == SMTLK_SOFTAP) { @@ -632,7 +630,6 @@ int hilink_ble_main(void) ret = HILINK_SetNetConfigMode(HILINK_NETCONFIG_WIFI); } - /* 修改任务属性 */ HILINK_SdkAttr *sdkAttr = HILINK_GetSdkAttr(); if (sdkAttr == NULL) { diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/ble_cfg_net_api.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/ble_cfg_net_api.h new file mode 100755 index 0000000..677a4fa --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/ble_cfg_net_api.h @@ -0,0 +1,322 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2023. All rights reserved. + * Description: BLE辅助配网SDK API头文件(此文件为DEMO,需集成方适配修改) + */ + +#ifndef BLE_CFG_NET_API_H +#define BLE_CFG_NET_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* WIFI信息长度宏定义 */ +#define WIFI_SSID_MAX_LEN 32 +#define WIFI_PWD_MAX_LEN 64 +#define WIFI_PSK_LEN 32 +#define WIFI_BSSID_LEN 6 + +#define BLE_UUID_LEN 16 + +/* 用户发送的数据类型 */ +typedef enum { + NETCFG_DATA, + CUSTOM_DATA, + CUSTOM_SEC_DATA, + DATA_TYPE_BUTT +} BLE_DataType; + +/* 属性类型定义 */ +typedef enum { + ATTR_TYPE_SERVICE = 0, + ATTR_TYPE_CHAR, + ATTR_TYPE_CHAR_VALUE, + ATTR_TYPE_CHAR_CLIENT_CONFIG, + ATTR_TYPE_CHAR_USER_DESC, +} BLE_AttrType; + +/* UUID长度定义 */ +typedef enum { + UUID_TYPE_NULL = 0, + UUID_TYPE_16_BIT, + UUID_TYPE_32_BIT, + UUID_TYPE_128_BIT, +} BLE_UuidType; + +/* BLE辅助配网状态定义 */ +typedef enum { + CFG_NET_PROCESS_SUCCESS = 0x00, + CFG_NET_BLE_CONNECT, + CFG_NET_BLE_DIS_CONNECT, + CFG_NET_SPEKE_SUCCESS, + CFG_NET_PROCESS_START, + CFG_NET_RECEIVE_PARA, + CFG_NET_WIFI_CONNECT, + CFG_NET_SESSIONKEY_SUCCESS, + CFG_NET_FAIL_UNKUNOWN = 0x100, + CFG_NET_FAIL_WIFI_SSID, + CFG_NET_FAIL_WIFI_PWD, + CFG_NET_FAIL_SESSIONKEY, + OTA_WRITE_TASK_START, + OTA_WRITE_TASK_FINISH, + CFG_CLEAR_DEV_REG_INFO, +} BLE_CfgNetStatus; + +/* BLE广播类型定义 */ +typedef enum { + BLE_ADV_DEFAULT, // 新蓝牙靠近发现 + BLE_ADV_NEARBY_V0, // 拉取半模态卡片的靠近发现 + BLE_ADV_ONEHOP, // 蓝牙碰一碰 + BLE_ADV_LOCAL_NAME, // 常态广播 + BLE_ADV_CUSTOM +} BLE_AdvType; + +/* + * 获取设备PIN码函数类型 + * pincode: 存放pin码的缓冲区 + * size: 缓冲区的长度 + * len: 返回的pin码实际长度 + */ +typedef int (*BLE_GetDevPinCode)(unsigned char *pinCode, unsigned int size, unsigned int *len); + +/* + * 获取设备信息函数类型,len即是入参也是出参,入参代表buff缓冲区长度,出参代表获取的设备信息实际长度 + * 格式要求:{"productId":"%s", "sn":"%s", "vendor":"%s"} + */ +typedef int (*BLE_GetDeviceInfo)(unsigned char *devInfo, unsigned int *len); + +/* + * 设置配网信息函数类型 +.* 数据格式:{"ssid":"%s","password":"%s","devId":"%s","psk":"%s","code":"%s","random":"%s","vendorData":"%s"} + */ +typedef int (*BLE_SetCfgNetInfo)(const unsigned char *netInfo, unsigned int len); + +/* 接收用户数据函数类型 */ +typedef int (*BLE_RcvCustomData)(unsigned char *buff, unsigned int len); + +/* 配网过程状态处理函数类型 */ +typedef int (*BLE_CfgNetProcess)(BLE_CfgNetStatus status); + +/* BLE GATT服务读函数类型 */ +typedef int (*BLE_GattRead)(unsigned char *buff, unsigned int *len); + +/* BLE GATT服务写函数类型 */ +typedef int (*BLE_GattWrite)(const unsigned char *buff, unsigned int len); + +/* BLE GATT服务指示函数类型 */ +typedef int (*BLE_GattIndicate)(unsigned char *buff, unsigned int len); + +/* BLE 短距发现开启 */ +typedef int (*BLE_NearDiscoveryStart)(void); + +/* BLE 短距发现关闭 */ +typedef int (*BLE_NearDiscoveryClose)(void); + +/* BLE 短距发现回调函数指针 */ +typedef struct { + BLE_NearDiscoveryStart startCb; + BLE_NearDiscoveryClose closeCb; +} BLE_NearDiscoveryCb; + +/* BLE GATT回调函数指针 */ +typedef struct { + BLE_GattRead readCb; + BLE_GattWrite writeCb; + BLE_GattIndicate indicateCb; +} BLE_GattOperateFunc; + +/* BLE配置参数 */ +typedef struct { + int isBlePair; + int isDeinitBleStack; + int data1; /* 为后期配置参数预留,暂不使用 */ + int data2; /* 为后期配置参数预留,暂不使用 */ + int data3; /* 为后期配置参数预留,暂不使用 */ +} BLE_ConfPara; + +/* BLE GATT服务 */ +typedef struct { + BLE_AttrType attrType; + unsigned int permission; + BLE_UuidType uuidType; + unsigned char uuid[BLE_UUID_LEN]; + unsigned char *value; + unsigned char valLen; + unsigned char properties; + BLE_GattOperateFunc func; +} BLE_GattAttr; + +/* GATT服务(单个service及其下挂的全部characteristics和descriptions) */ +typedef struct { + unsigned int attrNum; + BLE_GattAttr *attrList; +} BLE_GattService; + +/* GATT列表(包含多个services和返回的handle) */ +typedef struct { + unsigned int num; + BLE_GattService *service; + int *handle; +} BLE_GattList; + +/* GATT句柄列表 */ +typedef struct { + unsigned int num; + int *handle; +} BLE_GattHandleList; + +/* BLE的广播数据和扫描应答数据 */ +typedef struct { + unsigned char *advData; + unsigned int advDataLen; + unsigned char *rspData; + unsigned int rspDataLen; +} BLE_AdvData; + +/* BLE的广播参数 */ +typedef struct { + unsigned char advType; + unsigned char discMode; + unsigned char connMode; + unsigned int minInterval; + unsigned int maxInterval; + unsigned int channelMap; + unsigned int timeout; + int txPower; +} BLE_AdvPara; + +/* 广播参数和数据 */ +typedef struct { + BLE_AdvPara *advPara; + BLE_AdvData *advData; +} BLE_AdvInfo; + +/* BLE初始化参数 */ +typedef struct { + BLE_ConfPara *confPara; + BLE_AdvInfo *advInfo; + BLE_GattList *gattList; +} BLE_InitPara; + +/* BLE配网回调函数 */ +typedef struct { + BLE_GetDevPinCode getDevPinCodeCb; + BLE_GetDeviceInfo getDeviceInfoCb; + BLE_SetCfgNetInfo setCfgNetInfoCb; + BLE_RcvCustomData rcvCustomDataCb; + BLE_CfgNetProcess cfgNetProcessCb; +} BLE_CfgNetCb; + +/* + * BLE配网资源申请:BLE协议栈启动、配网回调函数挂接 + * 如为厂家实现协议栈para传NULL,如需华为实现协议栈则需赋值para结构体内容 + */ +int BLE_CfgNetInit(const BLE_InitPara *para, const BLE_CfgNetCb *cb); + +/* + * BLE配网资源注销:配网回调函数清理、BLE协议栈销毁 + * flag为0:只销毁控制和调度线程,flag为1销毁蓝牙协议栈 + */ +int BLE_CfgNetDeInit(const BLE_GattHandleList *handleList, unsigned int flag); + +/* BLE配网广播控制:参数代表广播时间,0:停止;0xFFFFFFFF:一直广播,其他:广播指定时间后停止,单位秒 */ +int BLE_CfgNetAdvCtrl(unsigned int advSecond); + +/* + * 更新广播参数,更新完成后需调用BLE_CfgNetAdvCtrl启动广播 + * 传入空值时可启动hilink构造的广播 + */ +int BLE_CfgNetAdvUpdate(const BLE_AdvInfo *advInfo); + +/* BLE配网断开连接:防止其他任务长时间占用BLE连接 */ +int BLE_CfgNetDisConnect(void); + +/* BLE发送用户数据:用户数据发送,与接收回调函数配套使用 */ +int BLE_SendCustomData(BLE_DataType dataType, const unsigned char *buff, unsigned int len); + +/* BLE获取蓝牙广播类型 */ +int BLE_GetAdvType(void); + +/* + * BLE设置蓝牙广播类型: + * type:BLE_ADV_DEFAULT表示新蓝牙靠近发现类型; + * type:BLE_ADV_ONEHOP表示蓝牙碰一碰类型; + * type:BLE_ADV_LOCAL_NAME表示常态广播类型 + */ +void BLE_SetAdvType(int type); + +/* + * 设置蓝牙广播名称中的MPP字段,参考“BLE设备接入规范”文档中蓝牙设备名称描述,按需设置 + * 入参含义:mpp + * m: 1个字节:0x00—0xFF,可选,如果发送该参数,则pp为必传,如果设备侧不携带mpp字段,则网关默认不回连该BLE设备。 + * bit0: 0心跳广播报文; 1设备主动回连请求广播报文(比如设备有数据上报需要连接网关) + * bit1: 心跳时长间隔单位,0单位毫秒, 1 单位为秒。 + * pp: 采用小端格式传输,2个字节 unsigned int 类型参数,16进制。标识设备心跳间隔时长,例如5000ms。 + * len: 长度固定为3个字节 。 + */ +int BLE_SetAdvNameMpp(const unsigned char *mpp, unsigned int len); + +/* + * BLE 短距发现注册函数 + * 入参含义: + * cb:BLE 短距发现回调函数指针 + * "BLE_NearDiscoveryStart": 短距功能开启 + * "BLE_NearDiscoveryClose": 短距功能关闭 + * 返回: + * 0成功,非0失败 + */ +int BLE_NearDiscoveryInit(const BLE_NearDiscoveryCb *cb); + +/* + * BLE 短距发现功能使能 + * 入参含义: + * waitTime: 进入短距发现等待时间,单位为秒,设置范围[1, 0XFFFFFFFF)。建议设置600s。 + * 返回: + * 0成功,非0失败 + * 说明: + * 蓝牙短距发现功能默认关闭,调用此接口设置等待时间并使能蓝牙短距发现功能; + * 调用此接口前,先调用“BLE_NearDiscoveryInit”注册“BLE_NearDiscoveryCb”; + * 使能此功能后,“waitTime”时间内用户没有发起配网,SDK调用“BLE_NearDiscoveryStart”开启短距发现模式,蓝牙 + * 辅助WiFi配网有效发现距离1~2m; + * 开启短距发现模式后,用户发起配网,SDK调用“BLE_NearDiscoveryClose”关闭短距发现模式,确保配网流程可靠进行; + * 此功能只影响待配网状态下的蓝牙广播,其它广播形态不受影响; + */ +int BLE_NearDiscoveryEnable(unsigned long waitTime); + +/** + * @brief 根据蓝牙sdk里的任务名获取任务栈大小 + * + * @param name [IN] 任务名 + * name | Description + * "BtScheduleTask" | 蓝牙sdk调度任务 + * "BtCtrlTask" | 蓝牙sdk控制任务 + * "BtOtaWriteTask" | 蓝牙sdk升级写数据任务 + * "BtOtaTimeTask" | 蓝牙sdk升级时间判断任务 + * "BtAdvCtrlTask" | 蓝牙sdk广播定时控制任务 + * @param stackSize [OUT] 任务栈大小 + * @return 0成功,非0失败 + */ +int HILINK_BT_GetTaskStackSize(const char *name, unsigned long *stackSize); + +/** + * @brief 根据蓝牙sdk的任务名设置任务栈大小 + * + * @param name [IN] 任务名 + * name | Description + * "BtScheduleTask" | 蓝牙sdk调度任务 + * "BtCtrlTask" | 蓝牙sdk控制任务 + * "BtOtaWriteTask" | 蓝牙sdk升级写数据任务 + * "BtOtaTimeTask" | 蓝牙sdk升级时间判断任务 + * "BtAdvCtrlTask" | 蓝牙sdk广播定时控制任务 + * @param stackSize [IN] 任务栈大小 + * @return 0成功,非0失败 + * @note 当任务栈不够时,厂商可以先调用HILINK_BT_GetTaskStackSize接口查看hilink + * 内部的默认值,再根据情况增加栈空间。此函数需要在蓝牙sdk初始化接口 + * BLE_CfgNetInit之前调用才生效。 + */ +int HILINK_BT_SetTaskStackSize(const char *name, unsigned long stackSize); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink.h new file mode 100755 index 0000000..044cf62 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink.h @@ -0,0 +1,280 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLink主流程框架集成头文件(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_H +#define HILINK_H + +#include +#include + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* + * 功能: HiLink SDK属性结构体,开发者可以通过HILINK_GetSdkAttr查看当前系统的属性值,通过HILINK_SetSdkAttr设置新的属性值; + * 注意: (1) 普通设备形态和网桥设备形态的主线程任务栈大小,开发者根据产品形态,仅需设置对应产品形态的属性值即可; + * (2) 使用HiLink SDK升级架构时,需要设置升级检查任务的栈大小和升级任务的栈大小 + * (3) 如果开发者未注册软重启接口rebootSoftware和硬重启接口rebootHardware,使用HiLink SDK默认实现接口(硬重启); + */ +typedef struct { + unsigned long monitorTaskStackSize; /* 监控任务栈大小,开发者根据具体情况调整,默认为1024字节 */ + unsigned long deviceMainTaskStackSize; /* 普通设备形态,HiLink SDK运行主任务栈大小,开发者根据具体情况调整 */ + unsigned long bridgeMainTaskStackSize; /* 网桥设备形态,HiLink SDK运行主任务栈大小,开发者根据具体情况调整 */ + unsigned long otaCheckTaskStackSize; /* HiLink OTA检查升级版本任务栈大小,开发者根据具体情况调整 */ + unsigned long otaUpdateTaskStackSize; /* HiLink OTA升级任务栈大小,开发者根据具体情况调整 */ + int (*rebootSoftware)(void); /* 异常场景软重启接口,不影响硬件状态,如果用户注册,首先使用此接口 */ + int (*rebootHardware)(void); /* 异常场景硬重启接口,影响硬件状态,如果用户没有注册软重启,使用此接口重启 */ +} HILINK_SdkAttr; + +/* HiLink SDK支持的配网模式 */ +enum HILINK_NetConfigMode { + HILINK_NETCONFIG_NONE, /* 不用配网, 通过网线等手段连接到网络 */ + HILINK_NETCONFIG_WIFI, /* HiLink SDK提供的WiFi自动配网 */ + HILINK_NETCONFIG_OTHER, /* 其他配网模式, APP发送WiFi的信息, 集成方收到WiFi信息数据后, 设置到HiLink SDK */ + HILINK_NETCONFIG_BOTH, /* 其他配网模式和WiFi配网组合 */ + HILINK_NETCONFIG_REGISTER_ONLY, /* HiLink SDK SoftAp配网仅接收注册信息 */ + HILINK_NETCONFIG_NO_SOFTAP_REGISTER_ONLY, /* 不启动SoftAp, PIN码配网仅接收注册信息(通过网线/4G/5G等接入网络) */ + HILINK_NETCONFIG_NAN_SOFTAP, /* WiFi感知超短距配网和SoftAp组合 */ + HILINK_NETCONFIG_BUTT /* 非法配网模式 */ +}; + +typedef enum { + SETUP_TYPE_NORMAL = 0, /* 后装安装方式 */ + SETUP_TYPE_CENTRAL = 1, /* 前装安装方式 */ + SETUP_TYPE_AILIFE = SETUP_TYPE_NORMAL, /* 智慧生活APP安装方式 */ + SETUP_TYPE_AIINSTALL = SETUP_TYPE_CENTRAL, /* 装维易APP安装方式 */ + SETUP_TYPE_UNKNOW = 2, /* 无效安装方式 */ + SETUP_TYPE_UNREGISTER = 3, /* 未注册回调 */ +} SetupType; + +typedef struct { + int (*MlogProcFunc)(const char* format, va_list args); + + /* + * 功能:日志重定向 + * 参数:logLevel,日志等级,详细信息参考hilink_log_manage.h + * func,函数名 + * line,函数行号 + * format,格式化字符串 + * args,格式化字符串可变参数列表 + * 注意:进行日志重定向要保留函数名和行号信息,推荐以{[{tag}]{level}:{func}() {line}, {msg}}进行输出 + * 例如"[HiLink]INFO:HILINK_RegisterBaseCallback() 45, something" + * 日志重定向依然受当前HiLink日志等级的约束,详细参考hilink_log_manage.h + * 重定向后原有的串口打印不再生效 + */ + void (*LogVprint)(int logLevel, const char *func, unsigned int line, const char* format, va_list args); + + /** + * @brief 记录tracelog日志,适配按模块统计计数并流控的能力, 按字符串打印 + * + * @param srcModule [IN] 记录跟踪日志的源模块 + * @param dstModule [IN] 记录跟踪日志的目的模块 + * @param msgType [IN] 记录跟踪消息类型 + * @param format [IN] 格式化字符串 + * @param args [IN] 格式化字符串可变参数列表 + * @attention 消息打印字符串长度超过单条最大长度时截断处理 + */ + void (*traceMsgPrint)(const char *srcModule, const char *dstModule, + const char *msgType, const char *format, va_list args); + + /** + * @brief 记录tracelog日志,适配按模块统计计数并流控的能力, 按字符串打印 + * + * @param moduleId [IN] 打印日志模块id + * @param srcModule [IN] 记录跟踪日志的源模块 + * @param dstModule [IN] 记录跟踪日志的目的模块 + * @param msgType [IN] 记录跟踪消息类型 + * @param content [IN] 记录跟踪日志数据内容 + */ + void (*traceMsgPrintEx)(int moduleId, const char *srcModule, const char *dstModule, + const char *msgType, const char *content); +} HiLinkBaseCallback; + +/* + * 功能:注册基础功能回调函数 + * 参数:cb,回调函数结构体指针 + * cbSize,回调函数结构体大小sizeof(HiLinkBaseCallback) + * 返回:0,成功 + * 小于0,失败 + */ +int HILINK_RegisterBaseCallback(const HiLinkBaseCallback *cb, unsigned int cbSize); + +/* + * 功能: HiLink SDK入口函数 + * 返回: 0表示成功,返回-1表示失败 + */ +int HILINK_Main(void); + +/* HiLink SDK 复位接口 */ +void HILINK_Reset(void); + +/* + * 功能: 设置HiLink SDK属性 + * 返回: 0表示设置成功,其他设置失败 + */ +int HILINK_SetSdkAttr(HILINK_SdkAttr sdkAttr); + +/* 查询HiLink SDK属性 */ +HILINK_SdkAttr *HILINK_GetSdkAttr(void); + +/* + * 功能: HiLink SDK恢复出厂设置接口 + * 返回: 0表示恢复出厂成功,返回-1表示恢复出厂失败 + * 注意: (1) 设置成功后会清理掉ssid账号信息,并重启模组进入待配网状态 + * (2) 在设备未注册场景调用此接口恢复出厂, HiLink SDK会调用HILINK_NotifyDevStatus接口通知设备解绑状态 + * (3) 禁止在HILINK_NotifyDevStatus接口内回调 HiLink SDK对外接口 + */ +int HILINK_RestoreFactorySettings(void); + +/* 获取当前设备状态,如配网状态、连接云端、在线、离线等,具体见HiLinkStateMachine */ +int HILINK_GetDevStatus(void); + +/* 获取当前设备集成的HiLink SDK的版本号 */ +const char *HILINK_GetSdkVersion(void); + +/* + * 功能:主动上报服务属性状态 + * 参数:(1) svcId 入参,服务ID + * (2) payload 入参,json格式服务属性数据 + * (3) len 入参,payload长度 + * 返回:返回0表示服务状态上报成功,返回-1表示服务状态上报失败 + * 注意:(1) 该接口有同步与异步两种使用方式,对于事件类上报推荐使用同步上报 + * (2) 同步上报:payload不为NULL且len不为0时,调用该接口时,HiLink SDK会立即上报该payload + * (3) 异步上报:payload为NULL或len为0时,调用该接口后,HiLink SDK会记录下该svcId, + * 并稍后(约200ms)调用HILINK_GetCharState接口获取服务属性并上报 + */ +int HILINK_ReportCharState(const char *svcId, const char *payload, unsigned int len); + +/* + * 功能:查询设备是否已被注册 + * 返回:返回非0,已注册;返回0,未注册; + */ +int HILINK_IsRegister(void); + +/* + * 获取当前设备组网状态 + * 返回1表示中枢组网状态,返回2表示云组网状态,返回0表示异常状态 + */ +int HILINK_GetNetworkingMode(void); + +/* + * 获取当前设备注册状态 + * 返回1表示中枢注册状态,返回2表示云注册状态,返回0表示未注册状态 + */ +int HILINK_GetRegisterStatus(void); + +/* + * 功能:设置HiLink SDK主任务调度时间间隔,默认为50ms + * 参数: interval HiLink SDK主任务调度时间间隔,单位为毫秒,取值范围[5,100] + * 返回:设置失败返回-1,成功返回0 + * 注意:Hi3681L模组(支持低功耗)interval无取值范围限制 + */ +int HILINK_SetScheduleInterval(unsigned long interval); + +/* + * 功能:设置HiLink SDK守护任务调度时间间隔,默认1000ms + * 参数: interval HiLink SDK守护任务调度时间间隔,单位为毫秒 + * 返回:设置失败返回-1,成功返回0 + */ +int HILINK_SetMonitorScheduleInterval(unsigned long interval); + +/* 设置产品配网模式, 注意: 需要在启动HILINK_Main之前调用本接口设置配网模式 */ +int HILINK_SetNetConfigMode(enum HILINK_NetConfigMode netConfigMode); + +/* 查询当前产品的配网模式, 返回值为当前产品的配网模式 */ +enum HILINK_NetConfigMode HILINK_GetNetConfigMode(void); + +/* + * 功能: 设置HiLink SDK配网超时时间,单位为秒 + * 注意: 户外设备默认超时时间为2分钟,其余设备默认10分钟 + */ +void HILINK_SetNetConfigTimeout(unsigned long netConfigTimeout); + +/** + * @brief 设置设备在OTA升级完成重启到重新上线的时间,默认为120s + * + * @param bootTime [IN] 设置的时间 + * @return 0表示成功,其他表示失败 + * @attention 允许设置的最大时间bootTime最大为600 + */ +int HILINK_SetOtaBootTime(unsigned int bootTime); + +/* + * 功能: 设置HiLink SDK打开Kitframework认证,默认为关闭状态 + * 注意: 该函数由设备开发者或厂商在HILINK_Main函数之前调用一次,不可动态调用 + */ +void HILINK_EnableKitframework(void); + +/* + * 功能: 设置HiLink SDK打开组播控制功能,默认为关闭状态 + * 注意: 该函数由设备开发者或厂商在HILINK_Main函数之前调用;当前仅支持灯类WiFi产品使用,安全敏感设备请勿使用 + * 组播控制将通过HILINK_ControlCharState接口传递至产品侧 + */ +void HILINK_EnableGroupCtrl(void); + +/* + * @brief 设置单设备多服务批控(type = 4),默认关闭 + * @attention 批控使能打开后最终调用HILINK_ControlCharState,0表示关闭,1表示开启 + */ +void HILINK_EnableBatchControl(bool flag); + +/* + * 设备离线时,如果在App上删除了设备,设备再次上线时云端会给设备下发Errcode=5或Errcode=6错误码。 + * 该接口用于使能SDK处理云端下发的Errcode=5或Errcode=6错误码。 + * enable为0表示SDK不处理云端下发的Errcode=5或Errcode=6错误码,此时SDK不会清除设备端注册信息, + * 需要用户手动硬件恢复出厂设置,设备才能重新进行配网状态。 + * enable为非0表示SDK处理云端下发的Errcode=5或Errcode=6错误码,此时SDK会清除设备端注册信息,重新进行配网状态 + * 默认enable为1 + */ +void HILINK_EnableProcessDelErrCode(int enable); + +/* + * 开发者直接调用该接口完成设备解绑后装信息并恢复交房设置 + * type 0:普通解绑 1:其它场景 + */ +void HILINK_UnbindDevice(int type); + +/* +* 设置设备安装方式 +* type:0表示后装安装方式,1表示前装安装方式 +* 正常返回0,异常返回其他错误码 +*/ +int HILINK_SetDeviceInstallType(int type); + +/* + * 获取设备是否带前装标识 + * 返回0:不带前装标识,1:带前装标识 +*/ +SetupType HILINK_GetDevSetupType(void); + +/** + * @brief 使能devId继承功能 + * WiFi单品如需支持故障更换,需要使能,默认不使能。 + * @param[in] 是否使能 + */ +void HILINK_EnableDevIdInherit(bool isEnbale); + +/** + * @brief 网络状态发生变化时系统调用此接口 + * + * @param status [IN] + * true - 网络可用 + * false - 网络不可用 + * @return void + */ +void HILINK_NotifyNetworkAvailable(bool status); + +/* hilink wifi配网模式入口函数 */ +int hilink_entry(void *param); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* HILINK_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_api.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_api.h new file mode 100755 index 0000000..f2ef859 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_api.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 蓝牙SDK API头文件(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_BT_API_H +#define HILINK_BT_API_H + +#include "ble_cfg_net_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* 销毁蓝牙协议栈标志 */ +#define BLE_DEINIT_FALG 0x1234ABCD + +/* 产品信息定义结构体 */ +typedef struct { + char *manuName; /* 设备制造商,长度范围(0,4] */ + char *devName; /* 设备名称 */ + char *productId; /* 设备HiLink认证号,长度范围(0,5] */ + char *sn; /* 设备唯一标识,比如sn号,长度范围(0,40] */ + char *mac; /* 设备MAC地址,固定32字节 */ + char *subProductId; /* 设备子productId */ + char *model; /* 设备型号,长度范围(0,32] */ + char *devType; /* 设备类型,长度范围(0,4] */ + char *hiv; /* 设备Hilink协议版本,长度范围(0,32] */ + int protType; /* 设备协议类型,取值范围[1,3] */ +} HILINK_BT_DevInfo; + +/* 发送蓝牙数据回调函数类型 */ +typedef int (*HILINK_BT_SendBtDataCallback)(const unsigned char *buf, unsigned int len); + +/* 厂家实现协议栈使用,注册蓝牙数据发送接口 */ +int HILINK_BT_RegisterBtDataSendCallback(HILINK_BT_SendBtDataCallback callback); + +/* 厂家实现协议栈使用,注册蓝牙OTA数据发送接口 */ +int HILINK_BT_RegisterOtaDataSendCallback(HILINK_BT_SendBtDataCallback callback); + +/* 厂家实现协议栈使用,处理蓝牙数据 */ +int HILINK_BT_ProcessBtData(const unsigned char *buf, unsigned int len); + +/* 厂家实现协议栈使用,处理蓝牙OTA的控制数据 */ +int HILINK_BT_ProcessOtaCtrl(const unsigned char *buf, unsigned int len); + +/* 厂家实现协议栈使用,处理蓝牙OTA的传输数据 */ +int HILINK_BT_ProcessOtaData(const unsigned char *buf, unsigned int len); + +/* 厂家实现协议栈使用,断开蓝牙连接时,释放通道占用资源 */ +void HILINK_BT_DisconnectFreeResource(void); + +/* 返回值0代表支持本地控和二次配网,其他值代表不支持 */ +int HILINK_BT_SupportLocalControl(void); + +/* 设备硬重置时厂商调用的接口 */ +int HILINK_BT_HardRevoke(void); + +/* + * 获取设备表面的最强点信号发射功率强度,最强点位置的确定以及功率测试方 + * 法,参照hilink认证蓝牙靠近发现功率设置及测试方法指导文档,power为出参 + * ,单位dbm,返回设备表面的最强信号强度值,如果厂商不想使用蓝牙靠近发现功 + * 能,接口直接返-1,如果需要使用蓝牙靠近发现,则接口返回0,如需及时生效,需 + * 调用HILINK_BT_StartAdvertise()方法启动广播 + */ +int HILINK_BT_GetDevSurfacePower(char *power); + +/** + * @brief 注册服务白名单,注册在白名单中的服务支持不加密处理 + * + * @param services [IN] 字符串列表,成员可读数量至少为size,应为静态或全局变量指针 + * @param size [IN] 字符串列表大小 + * @return 0成功,其他失败 + * @attention 在ble sdk初始化之前调用 + */ +int HILINK_BT_RegisterReqSvcTrustList(const char *services[], unsigned int size); + +/* + * 获取设备的子型号,长度固定两个字节 + * subProdId为保存子型号的缓冲区,len为缓冲区的长度 + * 如果产品定义有子型号,则填入两字节子型号,并以'\0'结束, 返回0 + * 没有定义子型号,则返回-1 + * 该接口需设备开发者实现 + * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 + */ +int HILINK_GetSubProdId(char *subProdId, int len); + +/* + * 获取设备SN + * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 + */ +void HILINK_GetDeviceSn(unsigned int len, char *sn); + +/* + * 获取设备相关版本号 + * 返回0表示版本号获取成功,返回其他表示版本号获取失败 + * 注意,此接口为HiLink内部调用函数 + * 与hilink sdk相同定义,双模组模式只需一份,已提供给第三方厂家,暂不按编程规范整改 + */ +int getDeviceVersion(char **firmwareVer, char **softwareVer, char **hardwareVer); + +/* + * 蓝牙处理任务休眠,当前仅harmony版本支持 + */ +void HILINK_BT_SuspendScheduleTask(void); + +/* + * 蓝牙处理任务唤醒,当前仅harmony版本支持 + */ +void HILINK_BT_ResumeScheduleTask(void); + +/* + * 获取蓝牙mac地址 + * 返回0表示获取成功,返回其他表示获取失败 + */ +int HILINK_BT_GetMacAddr(unsigned char *mac, unsigned int len); + +/* + * 获取厂商定制信息 + * 返回0表示获取成功,返回其他表示获取失败 + */ +int HILINK_GetCustomInfo(char *customInfo, unsigned int len); + +/* + * 获取厂家ID + * 返回0表示获取成功,返回其他表示获取失败 + */ +int HILINK_GetManuId(char *manuId, unsigned int len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_function.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_function.h new file mode 100755 index 0000000..3e3c6b6 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_function.h @@ -0,0 +1,256 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 蓝牙SDK 功能函数头文件(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_BT_FUNCTION_H +#define HILINK_BT_FUNCTION_H + +#include "hilink_bt_api.h" +#include "ble_cfg_net_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* 广播最大长度 */ +#define ADV_VALUE_MAX_LEN 31 +#define HIBEACON_IV_NONCE_LEN 8 +#define HIBEACON_PSK_LEN 16 + +typedef enum { + HILINK_BT_SDK_STATUS_SVC_RUNNING = 0, /* 正常运行 */ + HILINK_BT_SDK_STATUS_DEINIT, /* 注销 */ + HILINK_BT_SDK_STATUS_NAME_SET_ABNORM, /* 蓝牙名称设置异常 */ + HILINK_BT_SDK_STATUS_DISCOVER_MODE_SET_ABNORM, /* 蓝牙可发现模式设置异常 */ + HILINK_BT_SDK_STATUS_REG_APP_ABNORM, /* 注册BLE应用异常 */ + HILINK_BT_SDK_STATUS_SVC_CREATE_ABNORM, /* 服务创建异常 */ + HILINK_BT_SDK_STATUS_CHAR_ADD_ABNORM, /* 属性添加异常 */ + HILINK_BT_SDK_STATUS_DESC_ADD_ABNORM, /* 描述添加异常 */ + HILINK_BT_SDK_STATUS_SVC_START_ABNORM, /* 服务启动异常 */ + HILINK_BT_SDK_STATUS_ADV_PARA_SET_ABNORM, /* 广播参数设置异常 */ + HILINK_BT_SDK_STATUS_ADV_DATA_SET_ABNORM, /* 广播数据设置异常 */ + HILINK_BT_SDK_STATUS_ADV_START_ABNORM, /* 广播启动异常 */ +} HILINK_BT_SdkStatus; + +/* GATTS char属性取值 */ +typedef enum { + HILINK_BT_CHAR_PROP_WRITE_WITHOUT_RESP = 0x04, + HILINK_BT_CHAR_PROP_WRITE = 0x08, + HILINK_BT_CHAR_PROP_READ = 0x02, + HILINK_BT_CHAR_PROP_NOTIFY = 0x10, + HILINK_BT_CHAR_PROP_INDICATE = 0x20 +} HILINK_BT_CharProperty; + +/* GATTS char权限取值 */ +typedef enum { + HILINK_BT_CHAR_PERM_READ = 0x01, + HILINK_BT_CHAR_PERM_READ_ENCRYPTED = 0x02, + HILINK_BT_CHAR_PERM_READ_ENCRYPTED_MITM = 0x04, + HILINK_BT_CHAR_PERM_WRITE = 0x10, + HILINK_BT_CHAR_PERM_WRITE_ENCRYPTED = 0x20, + HILINK_BT_CHAR_PERM_WRITE_ENCRYPTED_MITM = 0x40, + HILINK_BT_CHAR_PERM_WRITE_SIGNED = 0x80, + HILINK_BT_CHAR_PERM_WRITE_SIGNED_MITM = 0x100, +} HILINK_BT_CharPermission; + +/* GATTS desc属性取值 */ +typedef enum { + HILINK_BT_DESC_PERM_WRITE = 0x01, + HILINK_BT_DESC_PERM_READ = 0x02 +} HILINK_BT_DescPermission; + +/* 属性值类型: 整型和属性 */ +typedef enum { + HILINK_BT_CMD_DATA_TYPE_INT, + HILINK_BT_CMD_DATA_TYPE_STR, +} HILINK_BT_CmdDataType; + +/* hilink蓝牙应用层数据编码类型 */ +typedef enum { + HILINK_BT_CMD_DATA_MODE_TLV = 0x00, /* TLV格式: 降低报文占用的空间 */ + HILINK_BT_CMD_DATA_MODE_JSON = 0x01 /* JSON格式: 扩展性更好,默认格式 */ +} HILINK_BT_CmdDataMode; + +/* 发送蓝牙SDK状态回调函数类型 */ +typedef void (*HILINK_BT_SdkEventCallBack)(HILINK_BT_SdkStatus event, const void *param); + +/* 自定义gatt服务读事件回调 */ +typedef int (*HILINK_BT_GattReadCallback)(unsigned char *out, unsigned int *outLen); + +/* 自定义gatt服务写事件回调 */ +typedef int (*HILINK_BT_GattWriteCallback)(const unsigned char *in, unsigned int inLen); + +/* 产品功能命令定义结构体 */ +typedef struct { + unsigned char attrIdx; + char *attr; + HILINK_BT_CmdDataType dataType; + int (*putFunc)(const void *data, unsigned int len); + int (*getFunc)(void *buf, unsigned int *bufLen, unsigned int len); +} HILINK_BT_AttrInfo; + +/* 产品功能定义结构体 */ +typedef struct { + unsigned char svcIdx; + char *service; + int (*putFunc)(const void *svc, const unsigned char *in, unsigned int inLen, + unsigned char **out, unsigned int *outLen); + int (*getFunc)(const void *svc, const unsigned char *in, unsigned int inLen, + unsigned char **out, unsigned int *outLen); + unsigned char attrNum; + HILINK_BT_AttrInfo *attrInfo; +} HILINK_BT_SvcInfo; + +/* 产品Profile定义结构体 */ +typedef struct { + unsigned int svcNum; + HILINK_BT_SvcInfo *svcInfo; +} HILINK_BT_Profile; + +/* 蓝牙gatt character描述 */ +typedef struct { + char *descUuid; + /* gatt属性描述读写权限:取值由HILINK_BT_DescPermission类型的成员或运算得出 */ + unsigned int descPermission; +} HILINK_BT_GattProfileDesc; + +/* 蓝牙gatt character */ +typedef struct { + char *charUuid; + /* gatt char权限:取值由HILINK_BT_CharPermission类型的成员或运算得出 */ + unsigned int charPermission; + /* gatt char属性:取值由HILINK_BT_CharProperty类型的成员或运算得出 */ + unsigned int charProperty; + HILINK_BT_GattReadCallback readFunc; + HILINK_BT_GattWriteCallback writeFunc; + HILINK_BT_GattProfileDesc *desc; + unsigned char descNum; +} HILINK_BT_GattProfileChar; + +/* 蓝牙gatt 服务 */ +typedef struct { + char *svcUuid; + int isPrimary; + HILINK_BT_GattProfileChar *character; + unsigned char charNum; +} HILINK_BT_GattProfileSvc; + +/* 厂商自定义蓝牙gatt服务列表 */ +typedef struct { + HILINK_BT_GattProfileSvc *service; + unsigned char serviceNum; +} HILINK_BT_GattServiceList; + +/* 配置保存回调结构体 */ +typedef struct { + int (*createItem)(const char *name, unsigned int size); + int (*readItem)(const char *name, unsigned char *buf, unsigned int len); + int (*writeItem)(const char *name, const unsigned char *buf, unsigned int len); + int (*deleteItem)(const char *name); + int (*destroyConfMgr)(void); + int (*getHichainFlashAddr)(unsigned int *start, unsigned int *size); +} HILINK_BT_ConfigInterface; + +/* 获取广播数据结构体 */ +typedef struct { + unsigned int advSvcDataLen; + unsigned char advSvcData[ADV_VALUE_MAX_LEN]; + unsigned int advRspDataLen; + unsigned char advRspData[ADV_VALUE_MAX_LEN]; +} HILINK_BT_AdvertiseData; + +/* 设置应用层编码模式 */ +int HILINK_BT_SetEncodeMode(HILINK_BT_CmdDataMode mode); + +/* 查询应用层编码模式 */ +HILINK_BT_CmdDataMode HILINK_BT_GetEncodeMode(void); + +/* 初始化启动HiLink Bluetooth SDK */ +int HILINK_BT_Init(const HILINK_BT_Profile *profile); + +/* 初始化蓝牙协议栈 */ +int HILINK_BT_InitBtStack(void); + +/* 启动HiLink BT SDK处理,调用HiLink协议栈 */ +int HILINK_BT_Process(void); + +/* + * 结束HiLink Bluetooth SDK + * flag为0:只销毁控制和调度线程,flag为1销毁蓝牙协议栈,该函数不可重入 + */ +int HILINK_BT_DeInit(unsigned int flag); + +/* 添加HiLink服务信息service信息 */ +int HILINK_BT_AddHiLilnkService(const HILINK_BT_SvcInfo *serviceArray, unsigned int serviceNum); + +/* 通知服务状态 */ +int HILINK_BT_ReportServiceState(const void *service, const void *buf, unsigned int len); + +/* 通知属性状态 */ +int HILINK_BT_ReportAttrState(const void *svc, const void *attr, const void *buf, unsigned int len); + +/* 查询蓝牙数据发送接口 */ +HILINK_BT_SendBtDataCallback HILINK_BT_GetBtDataSendCallback(void); + +/* 查询蓝牙OTA数据发送接口 */ +HILINK_BT_SendBtDataCallback HILINK_BT_GetOtaDataSendCallback(void); + +/* 设置蓝牙SDK事件处理函数 */ +int HILINK_BT_SetSdkEventCallback(HILINK_BT_SdkEventCallBack callback); + +/* + * 设置BLE最大连接数量 + * 入参connNum的范围为[1,10] + * 最大连接数上限为10,超过10个按10个执行 + * 最小连接数为1,小于1按1个执行 + * 若不调用该接口,默认最大连接数为1 + */ +void HILINK_BT_SetMaxConnNum(int connNum); + +/* 查询蓝牙SDK最大连接数量 */ +int HILINK_BT_GetMaxConnNum(void); + +/* 添加蓝牙SDK自定义gatt服务 */ +int HILINK_BT_SetGattProfile(const HILINK_BT_GattServiceList *gattServiceList); + +/* 注册配置保存回调函数到HiLink Bluetooth SDK,若不调用该函数,则默认使用HiLink Bluetooth SDK保存配置实现 */ +int HILINK_BT_RegisterConfigInterface(const HILINK_BT_ConfigInterface *interface); + +/* 启动广播 */ +int HILINK_BT_StartAdvertise(void); + +/* 停止广播 */ +int HILINK_BT_StopAdvertise(void); + +/* 上报蓝牙反馈数据 */ +int HILINK_BT_IndicateSvcCharData(const char *svcUuid, const char *charUuid, const char *buf, unsigned int len); + +/* 获取蓝牙SDK设备相关信息 */ +HILINK_BT_DevInfo *HILINK_BT_GetDevInfo(void); + +/* 获取靠近发现中广播数据 */ +int HILINK_BT_GetAdvertiseData(HILINK_BT_AdvertiseData *advertiseData); + +/* 获取BLE厂商注册的回调函数 */ +BLE_CfgNetCb *GetBleCfgNetCallback(void); + +/* 设置开启Kitframework认证 */ +void HILINK_BT_EnableKitframework(void); + +/* 设置关闭Kitframework认证 */ +void HILINK_BT_DisableKitframework(void); + +typedef struct { + unsigned char ivNonce[HIBEACON_IV_NONCE_LEN]; + unsigned char psk[HIBEACON_PSK_LEN]; +} HiBeaconData; + +typedef int (*HiBeaconDataHandler)(const HiBeaconData *data); + +/* 注册hibeacon设备配网数据回调 */ +void HILINK_BT_RegHiBeaconDataHandler(HiBeaconDataHandler handler); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_netcfg_api.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_netcfg_api.h new file mode 100755 index 0000000..f156851 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_bt_netcfg_api.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: 蓝牙SDK配网API头文件(此文件为DEMO,需集成方适配修改) + */ + +#ifndef HILINK_BT_NETCFG_API_H +#define HILINK_BT_NETCFG_API_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* 启动配网 */ +int HILINK_BT_StartNetCfg(void); + +/* 停止配网 */ +int HILINK_BT_StopNetCfg(void); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_custom.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_custom.h new file mode 100755 index 0000000..570ae89 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_custom.h @@ -0,0 +1,491 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLink SDK 定制化接口头文件(此文件为DEMO,需集成方适配修改) + */ +#ifndef HILINK_CUSTOM_H +#define HILINK_CUSTOM_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +typedef struct { + unsigned int method; + const char *uri; + const char *data; +} CloudMsgInfo; + +typedef int (*RecvSysEventCb)(const char *payload); + +#if defined(AM_PART_APOLLO3P) +/* + * 挂起hilink任务 + * 该函数由设备开发者或厂商调用 + */ +void HILINK_MainTaskSuspend(); + +/* + * 恢复hilink任务 + * 该函数由设备开发者或厂商调用 + */ +void HILINK_MainTaskResume(); +#endif + +/* + * 获取设备表面的最强点信号发射功率强度,最强点位置的确定以及功率测试方 + * 法,参照hilink认证wifi靠近发现功率设置及测试方法指导文档,power为出参 + * ,单位dbm,返回设备表面的最强信号强度值,如果厂商不想使用wifi靠近发现功 + * 能,接口直接返-1,sdk就不做wifi靠近发现的初始化,如果需要使用wifi靠近 + * 发现,则接口返回0,power返回对应的功率值,power的有效值必须<=20dbm,如 + * 果接口返回0,但power大于20,则也不做wifi靠近发现的初始化,功能不可用 + */ +typedef int (*HILINK_GetDevSurfaceWifiPower)(char *power); + +/* + * 功能: 获取当前设备唯一身份标识回调函数 + * 返回: 0,获取成功;返回非0,获取失败。 + * 注意: (1)仅android系统设备适配此接口 + * (2)固定长度6字节 + * (3)整个设备生命周期不可改变,包括设备重启和恢复出厂等 + */ +typedef int (*HILINK_GetUniqueIdentifier)(unsigned char *id, unsigned int len); + +/* + * 功能: 获取当前设备udid,仅ohos系统适用 + * 返回: 0,获取成功;返回非0,获取失败。 + */ +typedef int (*HILINK_GetDeviceUdidCallback)(char *udid, int size); + +/* + * 功能: 接收report消息后云侧返回的结果回调函数 + * 返回: 0,获取成功;返回非0,获取失败。 + */ +typedef void (*NotifyTokenCallback)(unsigned short token, const unsigned char *payload, unsigned int payloadLen); + +/* + * 获取家居云的URL + * 该函数由设备开发者或厂商调用 + * 返回0为获取成功,否则失败 + */ +int HILINK_GetCloudUrl(char *url, unsigned int len); + +/* + * 获取HOTA服务器的URL + * 该函数由设备开发者或厂商调用,不需要释放 + * 返回非NULL为获取成功,否则失败 + */ +const char *HILINK_GetHotaUrl(void); + +/* + * 设置配网信息 + * 入参数据为json格式字符串,具体内容字段如下: + * { + * "ssid": "xxx-xxxx", //路由器SSID字段,必选 + * "password": "xxxxxxxx", //路由器密码字段,必选 + * "devId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxx", //注册信息-设备ID字段,必选 + * "psk": "xxxxxxxxxxxxxxxxxxxxxxx", //注册信息-预制秘钥字段(转换十六进制字符串),必选 + * "code": "xxxxxxx", //注册信息-激活码字段,必选 + * "cloudPrimaryUrl": "xxxxx.xxxxx.xx", //主域名字段(主备域名),必选 + * "cloudStandbyUrl": "xxxxx.xxxxx.xx", //备份域名字段(主备域名),必选 + * "cloudUrl": "xxxxx.xxxxx.xx", //域名字段(兼容方案),可选 + * "WifiBgnSwitch": 1, //WiFi工作模式字段,可选 + * "timeZoneDisplay": "GMT+08:00", //时区信息,可选 + * "timeZoneId": "Asia/Shanghai" //时区ID,可选 + * } + * 返回0表示设置成功,其他表示设置失败(-2表示HiLink未处于接收配网数据状态) + */ +int HILINK_SetNetConfigInfo(const char *info); + +/* + * 功能: 查询HiLink SDK配置信息保存路径,仅posix或utils_file文件系统适用。 + * 参数: (1) path,出入参,保存路径的缓冲区; + * (2) len,入参,缓冲区长度。 + * 返回: 0,获取成功;非0,获取失败。 + * 注意: 非posix或utils_file文件系统无此接口实现 + */ +int HILINK_GetConfigInfoPath(char *path, unsigned int len); + +/* + * 功能: 设置HiLink SDK配置信息保存路径,默认保存在/usrdata/hilink目录下,仅posix或utils_file文件系统适用。 + * 参数: path,路径信息,绝对路径长度在posix下不超过127,在utils_file下不超过15。 + * 返回: 0,设置成功;非0,设置失败。 + * 注意: 非posix或utils_file文件系统无此接口实现 + */ +int HILINK_SetConfigInfoPath(const char *path); + +/* + * HiLink SDK外部诊断信息记录接口 + */ +void HILINK_DiagnosisRecordEx(int errCode); + +/** + * @brief 记录诊断信息 + * @param errCode [IN] 诊断错误码,范围982099001~982099999, 具体参考FaultCodeType + * @param param [IN] 辅助定位信息,大小限制在512字节内,可上传故障相关定位信息 + * 示例 + * 内存不足:"mem: used:xxx, free:yyy" + * 访问非法内存:"sp addr=0xaaaaaa sp content= 0xbbbbbb" + * @return 0 成功 ; 其他失败 + * @attention 设备发生故障时不能频繁调用 + */ +int HILINK_DiagnosisInfoRecord(int errCode, const char *param); + +/* + * 注册获取设备表面的最强点信号发射功率强度回调函数 + * 返回0表示成功,返回非0失败 + */ +int HILINK_RegDevSurfacePowerCallback(HILINK_GetDevSurfaceWifiPower cb); + +/* + * 功能: 注册获取当前设备唯一身份标识回调函数 + * 返回: 0表示成功,返回非0失败 + */ +int HILINK_RegUniqueIdentifierCallback(HILINK_GetUniqueIdentifier cb); + +/* + * 功能: 注册获取当前设备udid接口 + * 返回: 0表示成功,返回非0失败 + */ +int HILINK_RegGetUdidCallback(HILINK_GetDeviceUdidCallback cb); + +/* + * 功能:注册上报消息时云侧返回token的回调,与 HILINK_IndicateCharState 配合确定消息上报结果 + * 参数:(1) NotifyTokenCallback 入参,上报结果的处理函数 + * 返回:返回0表示注册成功,否则失败 + * 注意:此接口当前仅适用于直连云模式 + */ +int HILINK_RegisterNotifyTokenCallback(NotifyTokenCallback cb); + +/* + * 功能:(1) 主动上报服务属性状态且得到消息的token1 + * (2) 在 HILINK_RegisterNotifyTokenCallback 注册的回调中返回上报结果的token2 + * (3) 匹配token1和token2得到本次上报结果 + * 参数:(1) svcId 入参,服务ID + * (2) payload 入参,json格式服务属性数据 + * (3) payloadLen 入参,payload长度 + * (4) token 出参,此次上报消息的token值 + * 返回:返回0表示服务状态上报成功,返回-1表示服务状态上报失败 + * 注意:(1) 该接口只有同步使用方式,对于事件类上报推荐使用同步上报 + * (2) 同步上报:payload不为NULL且len不为0时,调用该接口时,HiLink SDK会立即上报该payload + * (3) 此处token与凭据无关,仅为此次上报消息的标识符 + * (4) 此接口当前仅适用于直连云模式 + */ +int HILINK_IndicateCharState(const char *svcId, const char *payload, unsigned int payloadLen, + unsigned short *token); + +/* + * 功能:HiLink SDK 清理资源并退出 + */ +void HILINK_Exit(void); + +/** + * @brief 发送device event消息到设备云 + * + * @param[in] device event消息请求详情 + * @return 0 成功 ; -1 失败 + */ +int HILINK_SendDeviceEventToCloud(const CloudMsgInfo *info); + +/** + * @brief 注册接收设备云的device event回复消息 + * + * @param[in] 接收回复消息的回调函数 + * @return 0 成功 ; -1 失败 + */ +int HILINK_RegRecvSysEventFromCloud(RecvSysEventCb cb); + +/** + * @brief 获取设备的devId + * + * @return 返回空字符串则获取失败,当前设备处于未注册绑定状态, 返回的指针不能释放 + */ +char *HILINK_GetDeviceID(void); + +/** + * @brief 设备向中枢请求配网注册信息 + * + * @param regInfoNums [IN] 申请注册信息的总数量 + * @return 正常返回0,异常返回其他错误码 + */ +int HILINK_RequestRegInfo(unsigned int regInfoNums); + +/** + * @brief 设备批量配网失败后,切换至SoftAP模式 + * + * @return 0表示成功,其他表示失败 + */ +int HILINK_SetSoftAPMode(void); + +/** + * @brief 设置OTA固件hash签名的填充方式 + * + * @param mode [IN] + * 0 - PKCS#1 v1.5(默认方式) + * 1 - PKCS#1 v2.1 + * @return 0表示成功,其他表示失败 + */ +int HILINK_SetOtaSigPaddingMode(unsigned int mode); + +/** + * @brief 设置优先搜索中枢间隔,默认3min + * + * @param interval [IN] + * 单位为秒,取值范围[5,600] + * @return 设置失败返回-1,成功返回0 + */ +int HILINK_SetPrioritySearchCentralInterval(unsigned long interval); + +typedef enum { + EVENT_ID_CENTRAL_INDEPEND_ERROR = 0, /* 协同升级中枢自立异常 */ +} EventId; + +/** + * @brief 回调函数 + * + * @param eventId 通知事件ID + */ +typedef void (*NotifyEventId)(EventId eventId); + +/** + * @brief 注册事件通知回调函数 + * + * @param cb [IN] 回调函数注册 + * + * @return 成功返回0 返回其他注册失败 +*/ +int HILINK_RegNotifyEventIdCallback(NotifyEventId cb); + +/** + * @brief 设备能力注册接口 + * + * @param pubCap [IN] 输入公共能力 + * @param prvCap [IN] 输入各网关定制的私有能力(功能预埋) + * @attention 当前协议已有的能力bit0~bit9: + * bit0:桥能力 bit1:全屋主机能力 bit2:场景本地控能力 bit3:中枢处理跨网关场景拆分能力 + * bit4:中枢处理动态场景拆分能力 bit5:设备是否支持V2版本COAP bit6:批控batchCmd的type1类型中的组合批控groups字段 + * bit7:设备处理去重能力 bit8:删除报文的回复能力 bit9:子设备(比如hiBeacon设备)漫游能力 + * bit10:查询和删除主机上异常设备的能力 + * @return 返回0表示成功,其他错误码异常 + */ +int HILINK_RegCapabilitySet(unsigned int pubCap, unsigned int prvCap); + +/** + * @brief 配置端云通道协议类型 + * + * @param protType [IN] 协议类型,与云端配置一样 + */ +void HILINK_SetProtType(const int protType); + +typedef enum { + CERT_UPDATE_TYPE_ADD = 0, + CERT_UPDATE_TYPE_DEL, +} CertUpdateType; + +/** + * @brief 证书更新回调 + * + * @param type [IN] 更新类型 + * @param certInfo [IN] 证书信息 + */ +typedef void (*CertUpdateCallback)(CertUpdateType type, const char *certInfo); + +/** + * @brief 注册服务证书更新回调 + * + * @param cb [IN] 回调函数 + * @return 0成功,其他失败 + */ +int HILINK_RegServiceCertUpdateCallback(CertUpdateCallback update); + +/** + * @brief 更新对应服务的证书 + * + * @retval 0成功,成功后通过HILINK_RegServiceCertUpdateCallback注册的回调通知 + * @retval 其他失败 + */ +int HILINK_UpdateServiceCert(const char *service); + +/** + * @brief 获取SDK中导入的证书 + * + * @param service [IN] 服务名 + * @param certInfo [OUT] 证书信息,json格式字符串 + * { + * "serviceName":"xxx", //证书服务名 + * "fingerprint":"xxx", // 证书指纹 + * "cert":"xxx", // pem格式证书 + * } + * @return 0成功,其他失败 + * @attention certInfo内存需由外部释放 + */ +int HILINK_GetServiceCert(const char *service, char **certInfo); + +/** + * @brief 向SDK导入/更新/删除证书 + * + * @param type [IN] 证书导入类型 + * @param certInfo [IN] 证书信息 + * { + * "serviceName":"xxx", //证书服务名 + * "fingerprint":"xxx", // 证书指纹 + * "cert":"xxx", // pem格式证书,删除证书不需要该字段 + * } + * @return 0成功,其他失败 + */ +int HILINK_ImportServiceCert(CertUpdateType type, const char *certInfo); + +typedef struct { + unsigned char *buffer; /* 未加密的原始coap报文数据 */ + unsigned int len; /* 未加密的原始coap报文长度 */ +} PacketBuffer; + +/** + * @brief 中枢接收SDK的消息回调函数 + * + * @param PacketBuffer [IN] 接收的未加密的coap报文数据以及长度 + * @return 0 成功 其他失败 + */ +typedef int (*CenterRecvPacketCb)(const PacketBuffer *packetBuffer); + +/** + * @brief 中枢发送消息到SDK + * + * @param packetBuffer [IN] 发送的二进制明文coap报文以及长度 + * @return 0 成功 其他失败 + */ +int HILINK_CenterSendPacket(const PacketBuffer *packetBuffer); + +/** + * @brief 中枢注册接收SDK的消息回调函数 + * + * @param cb [IN] 接收消息的回调函数 + * @return 0 成功 其他失败 + */ +int HILINK_RegCenterRecvPacket(const CenterRecvPacketCb cb); + +typedef struct { + unsigned char method; /* 直连云:header.code 中枢:payload: {"method":"xxx"} */ + PacketBuffer token; /* request消息返回token给调用方,response消息token由调用方指定 */ + char *uri; /* 直连云:COAP_OPTION_URI_PATH 中枢:payload: {"sid":"xxx"} */ + char *query; /* 直连云:COAP_OPTION_URI_QUERY 中枢:payload: {"query":"xxx"} */ + char *userId; /* 直连云:COAP_OPTION_USER_ID 中枢:payload: {"userId":"xxx"} */ + char *reqId; /* 直连云:COAP_OPTION_REQ_ID 中枢:payload: {"reqId":"xxx"} */ + char *payload; /* 直连云:payload 中枢:payload: {"data":xxx} */ +} PacketInfo; + +typedef int (*RecvPacketCallback)(const PacketInfo *msg); + +/** + * @brief 注册request消息和response消息接收函数回调 + * + * @param[in] 消息uri + * @param[in] request消息回调函数 + * @param[in] response消息回调函数 + * @return 0 成功 ; 其他 失败 + */ +int HILINK_RegisterRecvPacketCallback(const char *uri, RecvPacketCallback requestCallback, + RecvPacketCallback responseCallback); + +/** + * @brief 注册default消息接收函数回调,主要用于{deviceId}/sid等动态uri消息, + * + * @param[in] 消息uri + * @param[in] request消息回调函数 + * @param[in] response消息回调函数 + * @return 0 成功 ; 其他 失败 + */ +int HILINK_RegisterRecvReqPacketDefaultCallback(RecvPacketCallback requestCallback); + +/** + * @brief 发送response消息 + * + * @param[in] 消息主体,token、reqId等需要指定。 + * @return 0 成功 ; 其他 失败 + */ +int HILINK_SendPacketResponse(const PacketInfo *packet); + +/** + * @brief 发送request消息 + * +* @param[in] < passthrough > 中枢是否透传改消息 + * @param[in] 消息主体,token、reqId等需要指定。 + * @return 0 成功 ; 其他 失败 + */ +int HILINK_SendPacketRequest(int passthrough, PacketInfo *packet); + +/** + * @brief SDK基础组件初始化函数 + * + * @return 成功返回0 返回其他初始化失败 + * + * @attention SDK基础组件初始化失败,此接口会一直阻塞重试,直到成功退出 + */ +int HILINK_Init(void); + +/** + * @brief 启动SDK服务函数 + * + * @return 成功返回0 返回其他启动服务失败 + * + */ +int HILINK_ServiceStart(void); + +/** + * @brief 获取默认域名接口 + * + * @param serviceName [IN] 域名类型 + * @return NULL失败,非NULL成功 + * @attention 返回的指针不需要释放 + */ +const char *HILINK_GetDefaultUrl(const char *serviceName); + +/** + * @brief 接收GRS服务消息的回调函数 + * + * @param payload [IN] json格式的grs更新信息 + * @return 0 成功 ; 其他失败 + * + */ +typedef int (*RecvGrsCb)(const char *payload); + +/** + * @brief 注册接收GRS服务的域名更新消息 + * + * @param cb [IN] 接收GRS服务消息的回调函数 + * @return 0 成功 ; 其他失败 + */ +int HILINK_RegRecvGrsCallback(RecvGrsCb cb); + +#define TRACE_ID_HEX_STR_LEN 16 +#define SPAN_ID_HEX_STR_LEN 8 + +typedef struct { + char traceId[TRACE_ID_HEX_STR_LEN + 1]; + char spanId[SPAN_ID_HEX_STR_LEN + 1]; +} TraceIdInfo; + +/** + * @brief 获取接收到的traceid + * + * @param[out] 输出traceid数据 + * + * @return 成功返回0 返回其他获取失败 + */ +int HILINK_GetRecevieTraceId(TraceIdInfo *out); + +/** + * @brief 设置HiLink SDK打开中枢管控下的协同升级功能,默认为打开状态 + * 该函数由设备开发者或厂商在HILINK_Main函数之前调用一次,不可动态调用 + */ +void HILINK_DisableCentralOta(void); + +void HILINK_EnablePrescan(void); +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* HILINK_CUSTOM_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_entry.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_entry.h new file mode 100755 index 0000000..5d6622d --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_entry.h @@ -0,0 +1,27 @@ + +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HILINK SDK配网头文件 + */ + +#ifndef HILINK_ENTRY_H +#define HILINK_ENTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_SUPPORT_HILINK_INDIE_UPGRADE +int hilink_indie_upgrade_main(void); +int read_app_bin_hash(char *hash_str, unsigned int *size); +#endif + +int hilink_wifi_main(void); +int hilink_ble_main(void); +int SetBleAndSleAddrToStackFromNv(void); +void SetNetCfgMode(int mode); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_log_manage.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_log_manage.h new file mode 100755 index 0000000..e4e4e73 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_log_manage.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2024-2024. All rights reserved. + * Description: HiLink日志级别管理(此文件为DEMO,需集成方适配修改) + */ + +#ifndef _HILINK_LOG_MANAGE_H_ +#define _HILINK_LOG_MANAGE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + HILINK_LOG_INVALID = -1, /* 非法值 */ + HILINK_LOG_MIN = 0, + HILINK_LOG_EMERG = 0, /* 非常紧急, 系统不可用 */ + HILINK_LOG_ALERT = 1, /* 紧急级别, 必须立即采取措施 */ + HILINK_LOG_CRIT = 2, /* 致命级别 */ + HILINK_LOG_ERR = 3, /* 错误级别 */ + HILINK_LOG_WARN = 4, /* 告警级别 */ + HILINK_LOG_NOTICE = 5, /* 通知级别 */ + HILINK_LOG_INFO = 6, /* 信息级别 */ + HILINK_LOG_DEBUG = 7, /* 调试级别 */ + HILINK_LOG_MAX = HILINK_LOG_DEBUG +} HiLinkLogLevel; + +/* + * 配置当前日志打印最高级别, release版本默认为HILINK_LOG_ERR, debug版本默认为HILINK_LOG_DEBUG + * 例如配置的日志级别为HILINK_LOG_ERR, 表示级别在HILINK_LOG_ERR以下(HILINK_LOG_WARN等)的日志不会打印出来 + */ +void HILINK_SetLogLevel(HiLinkLogLevel level); + +/* + * 查询当前日志打印最高级别 + * 例如查询的日志级别为HILINK_LOG_ERR, 表示级别在HILINK_LOG_ERR以下(HILINK_LOG_WARN等)的日志不会打印出来 + */ +HiLinkLogLevel HILINK_GetLogLevel(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _HILINK_LOG_MANAGE_H_ */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_adapter.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_adapter.h new file mode 100755 index 0000000..b46aeef --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_adapter.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2024. All rights reserved. + * Description: 设备极速配网wifi管理帧驱动接口适配接口(此文件为DEMO,需集成方适配修改) + */ + +#ifndef HILINK_QUICK_NETCFG_ADAPTER_H +#define HILINK_QUICK_NETCFG_ADAPTER_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +typedef enum { + STA_MODE = 0, /* wifi sta 模式 */ + AP_MODE = 1, /* wifi ap 模式 */ +} WiFiMode; + +/** + * @brief 开启wifi帧混杂模式,需注册IEEE802.11 frames收包回调函数 + * + * @return 设置失败返回-1,成功返回0 + */ +typedef int (*StartWifiPromisCallback)(void); + +/** + * @brief 关闭wifi帧混杂模式 + * + * @return 设置失败返回-1,成功返回0 + */ +typedef int (*StopWifiPromisCallback)(void); + +/** + * @brief 获取wifi信道 + * + * @param channel [OUT] wifi信道号 + * @return 成功返回0,失败返回非0 + */ +typedef int (*GetWifiChannelCallback)(int *channel); + +/** + * @brief 切换wifi信道 + * + * @param channel [IN] wifi信道号 + * @return 成功返回0,失败返回非0 + */ +typedef int (*SetWifiChannelCallback)(int channel); + +/** + * @brief 切换wifi模式 + * + * @param mode [IN] 0 sta 模式 1 ap 模式 + * @return 成功返回0,失败返回非0 + */ +typedef int (*SetWifiModeCallback)(WiFiMode mode); + +/** + * @brief IEEE802.11 wifi管理帧的发送函数 + * + * @param data [IN] 发送数据 + * @param len [IN] 发送数据长度 + * @return 成功返回0,失败返回非0 + */ +typedef int (*SendWifiFrameCallback)(const unsigned char *data, unsigned int len); + +/** + * @brief 触发启动扫描wifi信息 + * + * @return 成功返回0,失败返回非0 + */ +typedef int (*ScanfWifiCallback)(void); + +typedef struct { + StartWifiPromisCallback startPromis; + StopWifiPromisCallback stopPromis; + GetWifiChannelCallback getChannel; + SetWifiChannelCallback setChannel; /* provider no need */ + SetWifiModeCallback setWifiMode; /* provider no need */ + SendWifiFrameCallback sendFrame; + ScanfWifiCallback scanWifi; +} QuickCfgWifiLoader; + +/** + * @brief 注册设备极速配网wifi管理帧驱动相关接口回调函数 + * + * @param loader [IN] 设备极速配网wifi管理帧驱动相关接口回调 + * @param loaderSize [IN] 回调函数结构体大小sizeof(QuickCfgWifiLoader) + * @return 成功返回0,失败返回非0 + */ +int HILINK_SetQuickCfgWifiLoader(QuickCfgWifiLoader *loader, unsigned int loaderSize); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* HILINK_QUICK_NETCFG_ADAPTER_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_api.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_api.h new file mode 100755 index 0000000..3bed03b --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_api.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2024. All rights reserved. + * Description: wifi管理帧极速配网对外通用接口api头文件 + */ + +#ifndef HILINK_QUICK_NETCFG_API_H +#define HILINK_QUICK_NETCFG_API_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +typedef enum { + DEVICE_TYPE = 0, /* 待配设备 */ + PROVIDER_TYPE = 1, /* 主配设备 */ +} DevType; + +typedef enum { + DISABLE_SET_CHAN = 0, + ENABLE_SET_CHAN = 1, +} SetChanSwitch; + +/** + * @brief 获取设备mac地址 + * + * @param mac [OUT] 设备mac地址 + * @param len [IN] 设备mac地址长度 + * @return 成功返回0,失败返回非0 + */ +typedef int (*GetDevMacCallback)(unsigned char *mac, unsigned int len); + +/** + * @brief 生成设备配网注册信息(中枢提供) + * + * @param payload [OUT] 返回payload数据,json格式如下 + { + "devId":"xxxx", + "psk":"xxxx", + "activeCode":"xxxx", + "url":"xxxx", + } + * @param len [IN] payload数据长度 + * @return 成功返回0,失败返回非0 + */ +typedef int (*GenRegInfoCallback)(char *payload, unsigned int len); + +/** + * @brief 设置配网信息, 作为设备端必须设置,主配设备端不需要 + * + * @param info [OUT] 配网信息数据 + * @return 返回0表示设置成功,其他表示设置失败(-2表示HiLink未处于接收配网数据状态) + */ +typedef int (*SetNetConfigInfo)(const char *info); + +/** + * @brief 获取连接路由信息(ssid、pwd)(中枢提供) + * + * @param payload [OUT] 设备连接路由信息json格式如下 + { + "ssid":"xxxx", + "pwd":"xxxx", + } + * @param len [IN] payload数据长度 + * @return 返回:设置失败返回-1,成功返回0 + */ +typedef int (*GetWifiInfo)(char *payload, unsigned int len); + +/** + * @brief 当设备配置为主配设备时,通过此接口向(中枢或云)申请设备注册信息, + 异步接口,通过HILINK_QuickCfgCmdParse接口返回数据 + * + * @param regNum [IN] 表示要申请的配网注册的数量 + * @return 0表示设置成功,其他表示设置失败 + */ +typedef int (*RequestRegInfo)(unsigned int regNum); + +typedef struct { + int type; /* 0 device 1 provider */ + int cmdMaxLen; /* 主配设备与app报文交互最大长度 */ + SetChanSwitch enable; /* 开启:主配设备在触发其他wifi设备配网时会切换到其他wifi设备信道发送数据 */ + GetDevMacCallback getDevMac; + GetWifiInfo getWifiInfo; + GenRegInfoCallback genRegInfo; /* device no need */ + SetNetConfigInfo setNetInfo; /* provider no need */ + RequestRegInfo reqRegInfo; /* device no need */ +} QuickCfgCommonLoader; + +/** + * @brief 注册设备极速配网通用接口回调函数 + * + * @param loader [IN] 设备极速配网通用接口回调 + * @param loaderSize [IN] 回调函数结构体大小sizeof(QuickCfgCommonLoader) + * @return 设置失败返回-1,成功返回0 + */ +int HILINK_SetQuickCfgCommonLoader(QuickCfgCommonLoader *loader, unsigned int loaderSize); + +/** + * @brief 启动极速配网 + * + * @return 设置失败返回-1,成功返回0 + */ +int HILINK_StartQuickCfg(void); + +/** + * @brief 开启Wifi混杂模式时注册此函数 + * + * @param frame [IN] 管理帧数据 + * @param len [IN] 管理帧数据长度 + * @return 设置失败返回-1,成功返回0 + * @attention 报文要求: 支持收802.11 标准MAC帧,包含数据帧(组播、广播)和管理帧(beacon、 probe request)等 + */ +int HILINK_FrameParse(const unsigned char *frame, unsigned int len); + +/** + * @brief 解析APP/中枢/云下发的极速配网数据报文 + * + * @param payload [IN] 配置json数据 + * @param len [IN] json数据长度 + * @return 设置失败返回-1,成功返回0 + */ +int HILINK_QuickCfgCmdParse(const char *payload, unsigned int len); + +/** + * @brief 切换配网设备模式 + * + * @param type [IN] type 0:待配设备 1:主配设备 + * @return 设置失败返回-1,成功返回0 + */ +int HILINK_SetDeviceType(DevType type); + +/** + * @brief 获取主配设备与app报文交互最大长度 + * + * @return 设置失败返回-1,成功返回最大长度 + */ +int HILINK_GetCmdMaxLen(void); +void HILINK_EnableQuickNetCfg(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* HILINK_QUICK_NETCFG_API_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_demo.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_demo.h new file mode 100755 index 0000000..f3b9cb1 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_quick_netcfg_demo.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2024. All rights reserved. + * Description: 设备通过80211 wifi管理帧实现demo头文件 + */ + +#ifndef QUICK_NETCFG_DEMO_H +#define QUICK_NETCFG_DEMO_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* + * 启动批量配网任务 + * 注意:为兼容softap配网在HILINK_Main启动后再启动次任务 + */ +int StartQuickNetCfg(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif /* QUICK_NETCFG_DEMO_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_sle_api.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_sle_api.h new file mode 100755 index 0000000..df4f12e --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/hilink_sle_api.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2024. All rights reserved. + * Description: 蓝牙Sdk sle接口头文件 + */ + +#ifndef HILINK_SLE_API_H +#define HILINK_SLE_API_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void HILINK_EnableSle(void); + +bool IsSleEnable(void); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_common.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_common.h new file mode 100755 index 0000000..bcf0afe --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_common.h @@ -0,0 +1,94 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE PUBLIC API module. + */ + +/** + * @defgroup oh_sle_common PUBLIC API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_COMMON_H +#define OH_SLE_COMMON_H + +#include +#include "oh_sle_errcode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief SLE version 1.0. + * @else + * @brief SLE版本1.0。 + * @endif + */ +#define OH_SLE_VERSION 0x10 + +/** + * @if Eng + * @brief SLE address length. + * @else + * @brief SLE地址长度。 + * @endif + */ +#define OH_SLE_ADDR_LEN 6 + +/** + * @if Eng + * @brief SLE device name max length. + * @else + * @brief SLE设备名称最大长度。 + * @endif + */ +#define OH_SLE_NAME_MAX_LEN 31 + +/** + * @if Eng + * @brief SLE link key length. + * @else + * @brief SLE 链路密钥长度。 + * @endif + */ +#define OH_SLE_LINK_KEY_LEN 16 + +/** + * @if Eng + * @brief SLE address type. + * @else + * @brief SLE地址类型。 + * @endif + */ +typedef enum { + OH_SLE_ADDRESS_TYPE_PUBLIC = 0, /*!< @if Eng public address + @else 公有地址 @endif */ + OH_SLE_ADDRESS_TYPE_RANDOM = 6, /*!< @if Eng random address + @else 随机地址 @endif */ +} SleAddrType; + +/** + * @if Eng + * @brief Struct of device address. + * @else + * @brief 设备地址。 + * @endif + */ +typedef struct { + uint8_t type; /*!< @if Eng SLE device address type { @ref @ref SleAddrType } + @else SLE设备地址类型 { @ref @ref SleAddrType } @endif */ + unsigned char addr[OH_SLE_ADDR_LEN]; /*!< @if Eng SLE device address + @else SLE设备地址 @endif */ +} SleAddr; + +#ifdef __cplusplus +} +#endif +#endif /* OH_SLE_COMMON_H */ +/** + * @} + */ + diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_connection_manager.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_connection_manager.h new file mode 100755 index 0000000..eb90e09 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_connection_manager.h @@ -0,0 +1,705 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE Connection Manager module. + */ + +/** + * @defgroup oh_sle_connection_manager connection manager API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_CONNECTION_MANAGER +#define OH_SLE_CONNECTION_MANAGER + +#include +#include "oh_sle_errcode.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Enum of sle pairing state. + * @else + * @brief 星闪配对状态。 + * @endif + */ +typedef enum { + OH_SLE_PAIR_NONE = 0x01, /*!< @if Eng Pair state of none + @else 未配对状态 @endif */ + OH_SLE_PAIR_PAIRING = 0x02, /*!< @if Eng Pair state of pairing + @else 正在配对 @endif */ + OH_SLE_PAIR_PAIRED = 0x03 /*!< @if Eng Pair state of paired + @else 已完成配对 @endif */ +} SlePairStateType; + +/** + * @if Eng + * @brief Enum of sle pairing state. + * @else + * @brief 星闪断链原因。 + * @endif + */ +typedef enum { + OH_SLE_DISCONNECT_BY_REMOTE = 0x10, /*!< @if Eng disconnect by remote + @else 远端断链 @endif */ + OH_SLE_DISCONNECT_BY_LOCAL = 0x11, /*!< @if Eng disconnect by local + @else 本端断链 @endif */ +} SleDiscReasonType; + +/** + * @if Eng + * @brief Enum of sle ACB connection state. + * @else + * @brief SLE ACB连接状态。 + * @endif + */ +typedef enum { + OH_SLE_ACB_STATE_NONE = 0x00, /*!< @if Eng SLE ACB connect state of none + @else SLE ACB 未连接状态 @endif */ + OH_SLE_ACB_STATE_CONNECTED = 0x01, /*!< @if Eng SLE ACB connect state of connected + @else SLE ACB 已连接 @endif */ + OH_SLE_ACB_STATE_DISCONNECTED = 0x02, /*!< @if Eng SLE ACB connect state of disconnected + @else SLE ACB 已断接 @endif */ +} SleAcbStateType; + +/** + * @if Eng + * @brief Enum of sle crytography algorithm. + * @else + * @brief 星闪加密算法类型。 + * @endif + */ +typedef enum { + OH_SLE_CRYTO_ALGO_AC1 = 0x00, /*!< @if Eng crytography algorithm ac1 + @else AC1加密算法类型 @endif */ + OH_SLE_CRYTO_ALGO_AC2 = 0x01, /*!< @if Eng crytography algorithm ac2 + @else AC2加密算法类型@endif */ + OH_SLE_CRYTO_ALGO_EA1 = 0x02, /*!< @if Eng crytography algorithm ea1 + @else EA1加密算法类型 @endif */ + OH_SLE_CRYTO_ALGO_EA2 = 0x03, /*!< @if Eng crytography algorithm ea2 + @else EA2加密算法类型 @endif */ +} SleCryptoAlgoType; + +/** + * @if Eng + * @brief Enum of sle key derivation algorithm + * @else + * @brief 星闪秘钥分发算法类型。 + * @endif + */ +typedef enum { + OH_SLE_KEY_DERIV_ALGO_HA1 = 0x00, /*!< @if Eng key derivation algorithm ac1 + @else HA1秘钥分发算法类型 @endif */ + OH_SLE_KEY_DERIV_ALGO_HA2 = 0x01, /*!< @if Eng key derivation algorithm ac2 + @else HA2秘钥分发算法类型 @endif */ +} SleKeyDerivAlgoType; + +/** + * @if Eng + * @brief Enum of sle integrity check indicator + * @else + * @brief 星闪完整性校验指示类型。 + * @endif + */ +typedef enum { + OH_SLE_ENCRYPTION_ENABLE_INTEGRITY_CHK_ENABLE = 0x00, /*!< @if Eng Encryption and integrity check + are enabled at the same time. + @else 加密和完整性保护同时启动 @endif */ + OH_SLE_ENCRYPTION_DISABLE_INTEGRITY_CHK_ENABLE = 0x01, /*!< @if Eng Do not enable encryption, but enable + integrity check. + @else 不启动加密,启动完整性保护 @endif */ + OH_SLE_ENCRYPTION_ENABLE_INTEGRITY_CHK_DISABLE = 0x02, /*!< @if Eng Encryption is enabled, but integrity + check is disabled. + @else 启动加密,不启动完整性保护 @endif */ + OH_SLE_ENCRYPTION_DISABLE_INTEGRITY_CHK_DISABLE = 0x03, /*!< @if Eng Encryption and integrity check + are not enabled. + @else 不启动加密,不启动完整性保护 @endif */ +} SleIntegrChkIndType; + +/** + * @if Eng + * @brief Enum of sle logical link update parameters. + * @else + * @brief 星闪逻辑链路更新参数请求 + * @endif + */ +typedef struct { + uint16_t intervalMin; /*!< @if Eng minimum interval + @else 链路调度最小间隔,单位slot @endif */ + uint16_t intervalMax; /*!< @if Eng maximum interval + @else 链路调度最大间隔,单位slot @endif */ + uint16_t maxLatency; /*!< @if Eng maximum latency + @else 延迟周期,单位slot @endif */ + uint16_t supervisionTimeout; /*!< @if Eng timeout + @else 超时时间,单位10ms @endif */ +} SleConnectionParamUpdateReq; + +/** + * @if Eng + * @brief Enum of sle logical link update parameters. + * @else + * @brief 星闪逻辑链路更新参数 + * @endif + */ +typedef struct { + uint16_t connId; /*!< @if Eng connection ID + @else 连接ID @endif */ + uint16_t intervalMin; /*!< @if Eng minimum interval + @else 链路调度最小间隔,单位slot @endif */ + uint16_t intervalMax; /*!< @if Eng maximum interval + @else 链路调度最大间隔,单位slot @endif */ + uint16_t maxLatency; /*!< @if Eng maximum latency + @else 延迟周期,单位slot @endif */ + uint16_t supervisionTimeout; /*!< @if Eng timeout + @else 超时时间,单位10ms @endif */ +} SleConnectionParamUpdate; + +/** + * @if Eng + * @brief Enum of sle logical link update event parameters. + * @else + * @brief 星闪逻辑链路更新事件参数 + * @endif + */ +typedef struct { + uint16_t interval; /*!< @if Eng interval + @else 链路调度间隔,单位slot @endif */ + uint16_t latency; /*!< @if Eng latency + @else 延迟周期,单位slot @endif */ + uint16_t supervision; /*!< @if Eng timeout + @else 超时时间,单位10ms @endif */ +} SleConnectionParamUpdateEvt; + +/** + * @if Eng + * @brief Enum of sle authentication result. + * @else + * @brief 星闪认证结果 + * @endif + */ +typedef struct { + uint8_t linkKey[OH_SLE_LINK_KEY_LEN]; /*!< @if Eng link key + @else 链路密钥 @endif */ + uint8_t cryptoAlgo; /*!< @if Eng encryption algorithm type { @ref SleCryptoAlgoType } + @else 加密算法类型 { @ref SleCryptoAlgoType } @endif */ + uint8_t keyDerivAlgo; /*!< @if Eng key distribution algorithm type { @ref SleKeyDerivAlgoType } + @else 秘钥分发算法类型 { @ref SleKeyDerivAlgoType } @endif */ + uint8_t integrChkInd; /*!< @if Eng integrity check indication { @ref SleIntegrChkIndType } + @else 完整性校验指示 { @ref SleIntegrChkIndType } @endif */ +} SleAuthInfoEvt; + +/** + * @if Eng + * @brief Struct of sle phy parameter. + * @else + * @brief 星闪phy参数 + * @endif + */ +typedef struct { + uint8_t txFormat; /*!< @if Eng Transmitted radio frame type, @ref sle_radio_frame_t + @else 发送无线帧类型,参考 { @ref sle_radio_frame_t }。 @endif */ + uint8_t rxFormat; /*!< @if Eng Received radio frame type, @ref sle_radio_frame_t + @else 接收无线帧类型,参考 { @ref sle_radio_frame_t }。 @endif */ + uint8_t txPhy; /*!< @if Eng Transmitted PHY, @ref sle_phy_tx_rx_t + @else 发送PHY,参考 { @ref sle_phy_tx_rx_t }。 @endif */ + uint8_t rxPhy; /*!< @if Eng Received PHY, @ref sle_phy_tx_rx_t + @else 接收PHY,参考 { @ref sle_phy_tx_rx_t }。 @endif */ + uint8_t txPilotDensity; /*!< @if Eng Transmitted pilot density indicator, @ref sle_phy_tx_rx_pilot_density_t + @else 发送导频密度指示,参考 { @ref sle_phy_tx_rx_pilot_density_t }。 @endif */ + uint8_t rxPilotDensity; /*!< @if Eng Received pilot density indicator, @ref sle_phy_tx_rx_pilot_density_t + @else 接收导频密度指示,参考 { @ref sle_phy_tx_rx_pilot_density_t }。 @endif */ + uint8_t gFeedback; /*!< @if Eng Indicates the feedback type of the pre-transmitted link. + The value range is 0 to 63. + @else 先发链路反馈类型指示,取值范围0-63。 @endif */ + uint8_t tFeedback; /*!< @if Eng Indicates the feedback type of the post-transmit link. + The value range is 0-7. + @else 后发链路反馈类型指示,取值范围0-7。 @endif */ +} SleSetPhy; + +/** + * @if Eng + * @brief Callback invoked when connect state changed. + * @par Callback invoked when connect state changed. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] addr address. + * @param [in] connState connection state { @ref SleAcbStateType }. + * @param [in] pairState pairing state { @ref SlePairStateType }. + * @param [in] discReason the reason of disconnect { @ref SleDiscReasonType }. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 连接状态改变的回调函数。 + * @par 连接状态改变的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] addr 地址。 + * @param [in] connState 连接状态 { @ref SleAcbStateType }。 + * @param [in] pairState 配对状态 { @ref SlePairStateType }。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleConnectStateChangedCallback)(uint16_t connId, const SleAddr *addr, + SleAcbStateType connState, SlePairStateType pairState, SleDiscReasonType discReason); + +/** + * @if Eng + * @brief Callback invoked when connect parameter updated. + * @par Callback invoked when connect parameter updated. + * @attention 1.This function is called in SLE service context, should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] addr address. + * @param [in] status error code. + * @param [in] param connection param. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 连接参数更新的回调函数。 + * @par 连接参数更新的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] addr 地址。 + * @param [in] status 执行结果错误码。 + * @param [in] param 连接参数。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleConnectParamUpdateCallback)(uint16_t connId, ErrCodeType status, + const SleConnectionParamUpdateEvt *param); + +/** + * @if Eng + * @brief Callback invoked before the request for updating the connect parameter is complete. + * @par Callback invoked before the request for updating the connect parameter is complete. + * @attention 1.This function is called in SLE service context, should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] status error code. + * @param [in] param connection param. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 连接参数更新请求完成前的回调函数。 + * @par 连接参数更新请求完成前的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] status 执行结果错误码。 + * @param [in] param 连接参数。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleConnectParamUpdateReqCallback)(uint16_t connId, ErrCodeType status, + const SleConnectionParamUpdateReq *param); + +/** + * @if Eng + * @brief Callback invoked when authentication complete. + * @par Callback invoked when authentication complete. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] addr address. + * @param [in] status error code. + * @param [in] evt authentication event. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 认证完成的回调函数。 + * @par 认证完成的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] addr 地址。 + * @param [in] status 执行结果错误码。 + * @param [in] evt 认证事件。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleAuthCompleteCallback)(uint16_t connId, const SleAddr *addr, ErrCodeType status, + const SleAuthInfoEvt* evt); + +/** + * @if Eng + * @brief Callback invoked when pairing complete. + * @par Callback invoked when pairing complete. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] addr address. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 配对完成的回调函数。 + * @par 配对完成的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] addr 地址。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SlePairCompleteCallback)(uint16_t connId, const SleAddr *addr, ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when rssi read complete. + * @par Callback invoked when rssi read complete. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] rssi rssi. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 读取rssi的回调函数。 + * @par 读取rssi的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] rssi rssi。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleReadRssiCallback)(uint16_t connId, int8_t rssi, ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when set low latency complete. + * @par Callback invoked when set low latency complete. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status result of set low latency. + * @param [in] addr remote device address. + * @param [in] rate mouse report rate { @ref sle_low_latency_rate_t }. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @else + * @brief 设置low latency的回调函数。 + * @par 设置low latency的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 设置low latency结果。 + * @param [in] addr 对端设备地址。 + * @param [in] rate 鼠标回报率 { @ref sle_low_latency_rate_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @endif + */ +typedef void (*SleLowLatencyCallback)(uint8_t status, SleAddr *addr, uint8_t rate); + + /** + * @if Eng + * @brief Callback invoked when set PHY complete. + * @par Callback invoked when set PHY complete. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] connId connection ID. + * @param [in] status result of setting the PHY. + * @param [in] param current PHY parameters { @ref sle_set_phy_t }. + * @par Dependency: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @else + * @brief 设置PHY的回调函数。 + * @par 设置PHY的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] connId 连接 ID。 + * @param [in] status 设置PHY结果。 + * @param [in] param 当前PHY参数 { @ref sle_set_phy_t }。 + * @par 依赖: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @endif + */ +typedef void (*SleSetPhyCallback)(uint16_t connId, ErrCodeType status, const SleSetPhy *param); + +/** + * @if Eng + * @brief Struct of SLE connection manager callback function. + * @else + * @brief SLE连接管理回调函数接口定义。 + * @endif + */ +typedef struct { + SleConnectStateChangedCallback connectStateChangedCb; /*!< @if Eng Connect state changed callback. + @else 连接状态改变回调函数。 @endif */ + SleConnectParamUpdateReqCallback connectParamUpdateReqCb; /*!< @if Eng Connect param updated callback. + @else 连接参数更新回调函数。 @endif */ + SleConnectParamUpdateCallback connectParamUpdateCb; /*!< @if Eng Connect param updated callback. + @else 连接参数更新回调函数。 @endif */ + SleAuthCompleteCallback authCompleteCb; /*!< @if Eng Authentication complete callback. + @else 认证完成回调函数。 @endif */ + SlePairCompleteCallback pairCompleteCb; /*!< @if Eng Pairing complete callback. + @else 配对完成回调函数。 @endif */ + SleReadRssiCallback readRssiCb; /*!< @if Eng Read rssi callback. + @else 读取rssi回调函数。 @endif */ + SleLowLatencyCallback lowLatencCb; /*!< @if Eng Set low latency callback. + @else 设置low latency回调函数。 @endif */ + SleSetPhyCallback setPhyCb; /*!< @if Eng Set PHY callback. + @else 设置PHY回调函数。 @endif */ +} SleConnectionCallbacks; + +/** + * @if Eng + * @brief Send connect request to remote device. + * @par Description: Send connect request to remote device. + * @param [in] addr address. + * @retval error code, connection state change result will be returned at { @ref SleConnectStateChangedCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发送连接请求。 + * @par Description: 发送连接请求。 + * @param [in] addr 地址。 + * @retval 执行结果错误码, 连接状态改变结果将在 { @ref SleConnectStateChangedCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleConnectRemoteDevice(const SleAddr *addr); + +/** + * @if Eng + * @brief Send disconnect request to remote device. + * @par Description: Send disconnect request to remote device. + * @param [in] addr address. + * @retval error code, connection state change result will be returned at { @ref SleConnectStateChangedCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发送断开连接请求。 + * @par Description: 发送断开连接请求。 + * @param [in] addr 地址。 + * @retval 执行结果错误码, 连接状态改变结果将在 { @ref SleConnectStateChangedCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleDisconnectRemoteDevice(const SleAddr *addr); + +/** + * @if Eng + * @brief Send connection parameter update request to remote device. + * @par Description: Send connection parameter update request to remote device. + * @param [in] params connection parameter. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发送更新连接参数请求。 + * @par Description: 发送更新连接参数请求。 + * @param [in] params 连接参数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleUpdateConnectParam(SleConnectionParamUpdate *params); + +/** + * @if Eng + * @brief Send pairing request to remote device. + * @par Description: Send pairing request to remote device. + * @param [in] addr address. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发送配对请求。 + * @par Description: 发送配对请求。 + * @param [in] addr 地址。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SlePairRemoteDevice(const SleAddr *addr); + +/** + * @if Eng + * @brief Remove pairing. + * @par Description: Remove pairing. + * @param [in] addr address. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 删除配对。 + * @par Description: 删除配对。 + * @param [in] addr 地址。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleRemovePairedRemoteDevice(const SleAddr *addr); + +/** + * @if Eng + * @brief Remove all pairing. + * @par Description: Remove all pairing. + * @param NULL + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 删除所有配对。 + * @par Description: 删除所有配对。 + * @param NULL + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleRemoveAllPairs(void); + +/** + * @if Eng + * @brief Get paired device number. + * @par Description: Get paired device number. + * @param [out] number device number. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 获取配对设备数量。 + * @par Description: 获取配对设备数量。 + * @param [out] number 设备数量。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleGetPairedDevicesNum(uint16_t *number); + +/** + * @if Eng + * @brief Get paired device. + * @par Description: Get paired device. + * @param [out] addr linked list of device address. + * @param [inout] number device number. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 获取配对设备。 + * @par Description: 获取配对设备。 + * @param [out] addr 设备地址链表。 + * @param [inout] number 设备数量。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleGetPairedDevices(SleAddr *addr, uint16_t *number); + +/** + * @if Eng + * @brief Get pair state. + * @par Description: Get pair state. + * @param [in] addr device address. + * @param [out] state pair state { @ref SlePairStateType }. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 获取配对状态。 + * @par Description: 获取配对状态。 + * @param [in] addr 设备地址。 + * @param [out] state 配对状态 { @ref SlePairStateType }。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleGetPairState(const SleAddr *addr, uint8_t *State); + +/** + * @if Eng + * @brief Read remote device rssi value. + * @par Description: Read remote device rssi value. + * @param [in] connId connection ID. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 读取对端设备rssi值。 + * @par Description: 读取对端设备rssi值。 + * @param [in] connId 连接 ID。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleReadRemoteDeviceRssi(uint16_t connId); + +/** + * @if Eng + * @brief Register SLE connection manager callbacks. + * @par Description: Register SLE connection manager callbacks. + * @param [in] func Callback function. + * @retval error code. + * @else + * @brief 注册SLE连接管理回调函数。 + * @par Description: 注册SLE连接管理回调函数。 + * @param [in] func 回调函数。 + * @retval 执行结果错误码。 + * @endif + */ +ErrCodeType SleConnectionRegisterCallbacks(SleConnectionCallbacks *func); + +#ifdef __cplusplus +} +#endif +#endif /* OH_OH_SLE_CONNECTION_MANAGER */ +/** + * @} + */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_device_discovery.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_device_discovery.h new file mode 100755 index 0000000..7042bf0 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_device_discovery.h @@ -0,0 +1,906 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE Device Announce, Seek Manager, module. + */ + +/** + * @defgroup sle_device_announce Device Announce & Seek Manager API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_DEVICE_ANC_SEK +#define OH_SLE_DEVICE_ANC_SEK + +#include +#include "errcode.h" +#include "oh_sle_errcode.h" +#include "oh_sle_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Maximum of announce ID. + * @else + * @brief 设备公开多路最大值。 + * @endif + */ +#define OH_SLE_ANNOUNCE_ID_MAX 16 + +/** + * @if Eng + * @brief Maximum of scan PHY num. + * @else + * @brief 设备发现PHY最大值。 + * @endif + */ +#define OH_SLE_SEEK_PHY_NUM_MAX 3 + +/** + * @if Eng + * @brief announce level. + * @else + * @brief 被发现方可发现等级 + * @endif + */ +typedef enum { + OH_SLE_ANNOUNCE_LEVEL_NONE, /*!< @if Eng announce level none, reserve + @else 不可见发现,预留 @endif */ + OH_SLE_ANNOUNCE_LEVEL_NORMAL, /*!< @if Eng announce level normal + @else 一般可发现 @endif */ + OH_SLE_ANNOUNCE_LEVEL_PRIORITY, /*!< @if Eng announce level priority, reserve + @else 优先可发现,预留 @endif */ + OH_SLE_ANNOUNCE_LEVEL_PAIRED, /*!< @if Eng announce level paired, reserve + @else 被曾配对过的设备发现,预留 @endif */ + OH_SLE_ANNOUNCE_LEVEL_SPECIAL, /*!< @if Eng announce level special + @else 被指定设备发现 @endif */ +} SleAnnounceLevelType; + +/** + * @if Eng + * @brief G/T role negotiation indication. + * @else + * @brief G/T 角色协商指示。 + * @endif + */ +typedef enum { + OH_SLE_ANNOUNCE_ROLE_T_CAN_NEGO = 0, /*!< @if Eng Expect to be T, negotiable + @else 期望做T可协商 @endif */ + OH_SLE_ANNOUNCE_ROLE_G_CAN_NEGO, /*!< @if Eng Expect to be G, negotiable + @else 期望做G可协商 @endif */ + OH_SLE_ANNOUNCE_ROLE_T_NO_NEGO, /*!< @if Eng Expect to be T, non-negotiable + @else 期望做T不可协商 @endif */ + OH_SLE_ANNOUNCE_ROLE_G_NO_NEGO /*!< @if Eng Expect to be G, non-negotiable + @else 期望做G不可协商 @endif */ +} SleAnnounceGtRoleType; + +/** + * @if Eng + * @brief announce mode. + * @else + * @brief 设备公开类型。 + * @endif + */ +typedef enum { + OH_SLE_ANNOUNCE_MODE_NONCONN_NONSCAN = 0x00, /*!< @if Eng non-connectable, non-scannable. + @else 不可连接不可扫描。 @endif */ + OH_SLE_ANNOUNCE_MODE_CONNECTABLE_NONSCAN = 0x01, /*!< @if Eng connectable, non-scannable. + @else 可连接不可扫描。 @endif */ + OH_SLE_ANNOUNCE_MODE_NONCONN_SCANABLE = 0x02, /*!< @if Eng non-connectable, scannable. + @else 不可连接可扫描。 @endif */ + OH_SLE_ANNOUNCE_MODE_CONNECTABLE_SCANABLE = 0x03, /*!< @if Eng connectable, scannable. + @else 可连接可扫描。 @endif */ + OH_SLE_ANNOUNCE_MODE_CONNECTABLE_DIRECTED = 0x07, /*!< @if Eng connectable, scannable, directed. + @else 可连接可扫描定向。 */ +} SleAnnounceModeType; + +/** + * @if Eng + * @brief Seek phy type. + * @else + * @brief 设备发现PHY类型。 + * @endif + */ +typedef enum { + OH_SLE_SEEK_PHY_1M = 0x1, /*!< @if Eng 1M PHY + @else 1M PHY @endif */ + OH_SLE_SEEK_PHY_2M = 0x2, /*!< @if Eng 2M PHY + @else 2M PHY @endif */ + OH_SLE_SEEK_PHY_4M = 0x4, /*!< @if Eng 4M PHY + @else 4M PHY @endif */ +} SleSeekPhyType; + +/** + * @if Eng + * @brief seek type. + * @else + * @brief 设备发现类型。 + * @endif + */ +typedef enum { + OH_SLE_SEEK_PASSIVE = 0x00, /*!< @if Eng passive seek + @else 被动扫描 @endif */ + OH_SLE_SEEK_ACTIVE = 0x01, /*!< @if Eng active seek + @else 主动扫描 @endif */ +} SleSeekType; + +/** + * @if Eng + * @brief Seek filter type. + * @else + * @brief 设备发现过滤类型。 + * @endif + */ +typedef enum { + OH_SLE_SEEK_FILTER_ALLOW_ALL = 0x00, /*!< @if Eng allow all + @else 允许来自任何人的设备发现数据包 @endif */ + OH_SLE_SEEK_FILTER_ALLOW_WLST = 0x01, /*!< @if Eng allow only white list, reserve + @else 允许来自白名单设备的设备发现数据包,预留 @endif */ +} SleSeekFilterType; + +/** + * @if Eng + * @brief Connection parameter, only valid in role G. + * @else + * @brief 连接参数,做G时有效。 + * @endif + */ +typedef struct SleConnParam { + uint16_t intervalMin; /*!< @if Eng minimum of connection interval + @else 连接间隔最小取值,取值范围[0x001E,0x3E80], + 时间 = N * 0.25ms, 时间范围[7.5ms,4s] @endif */ + uint16_t intervalMax; /*!< @if Eng maximum of connection interval + @else 连接间隔最大取值,取值范围[0x001E,0x3E80], + 时间 = N * 0.25ms, 时间范围[7.5ms,4s] @endif */ + uint16_t maxLatency; /*!< @if Eng maximum of sleep connection latency + @else 最大休眠连接间隔,取值范围[0x0000,0x01F3],默认0x0000 @endif */ + uint16_t supervisionTimeout; /*!< @if Eng maximum of timeout + @else 最大超时时间,取值范围[0x000A,0x0C80],时间 = N * 10ms, + 时间范围是[100ms,32s] @endif */ + uint16_t minCeLength; /*!< @if Eng minimum of connection event + @else 推荐的连接事件的最小取值,取值范围[0x0000,0xFFFF], + 时间 = N * 0.125ms @endif */ + uint16_t maxCeLength; /*!< @if Eng maximum of connection event + @else 推荐的连接事件的最大取值,取值范围[0x0000,0xFFFF], + 时间 = N * 0.125ms @endif */ +} SleConnParam; + +/** + * @if Eng + * @brief Announce parameter. + * @else + * @brief 设备公开参数。 + * @endif + */ +typedef struct SleAnnounceParam { + uint8_t announceHandle; /*!< @if Eng announce handle + @else 设备公开句柄,取值范围[0, 0xFF] @endif */ + uint8_t announceMode; /*!< @if Eng announce mode { @ref SleAnnounceModeType } + @else 设备公开类型, { @ref SleAnnounceModeType } @endif */ + uint8_t announceGtRole; /*!< @if Eng G/T role negotiation indication + { @ref SleAnnounceGtRoleType } + @else G/T 角色协商指示, + { @ref SleAnnounceGtRoleType } @endif */ + uint8_t announceLevel; /*!< @if Eng announce level + { @ref SleAnnounceLevelType } + @else 发现等级, + { @ref SleAnnounceLevelType } @endif */ + uint32_t announceIntervalMin; /*!< @if Eng minimum of announce interval + @else 最小设备公开周期, 0x000020~0xffffff, 单位125us @endif */ + uint32_t announceIntervalMax; /*!< @if Eng maximum of announce interval + @else 最大设备公开周期, 0x000020~0xffffff, 单位125us @endif */ + uint8_t announceChannelMap; /*!< @if Eng announce channel map + @else 设备公开信道, 0:76, 1:77, 2:78 @endif */ + uint8_t announceTxPower; /*!< @if Eng announce tx power + @else 广播tx功率 @endif */ + SleAddr ownAddr; /*!< @if Eng own address + @else 本端地址 @endif */ + SleAddr peerAddr; /*!< @if Eng peer address + @else 对端地址 @endif */ + uint16_t connIntervalMin; /*!< @if Eng minimum of connection interval + @else 连接间隔最小取值,取值范围[0x001E,0x3E80], + announce_gt_role 为 OH_SLE_ANNOUNCE_ROLE_T_NO_NEGO + 时无需配置 @endif */ + uint16_t connIntervalMax; /*!< @if Eng maximum of connection interval + @else 连接间隔最大取值,取值范围[0x001E,0x3E80], + announce_gt_role 为 OH_SLE_ANNOUNCE_ROLE_T_NO_NEGO + 无需配置 @endif */ + uint16_t connMaxLatency; /*!< @if Eng max connection latency + @else 最大休眠连接间隔,取值范围[0x0000,0x01F3], + announce_gt_role 为 OH_SLE_ANNOUNCE_ROLE_T_NO_NEGO + 无需配置 @endif */ + uint16_t connSupervisionTimeout; /*!< @if Eng connect supervision timeout + @else 最大超时时间,取值范围[0x000A,0x0C80], + announce_gt_role 为 OH_SLE_ANNOUNCE_ROLE_T_NO_NEGO + 无需配置 @endif */ + void *extParam; /*!< @if Eng extend parameter, default value is NULL + @else 扩展设备公开参数, 缺省时置空 @endif */ +} SleAnnounceParam; + +/** + * @if Eng + * @brief Announce data. + * @else + * @brief 设备公开数据。 + * @endif + */ +typedef struct SleAnnounceData { + uint16_t announceDataLen; /*!< @if Eng announce data length + @else 设备公开数据长度 @endif */ + uint16_t seekRspDataLen; /*!< @if Eng scan response data length + @else 扫描响应数据长度 @endif */ + uint8_t *announceData; /*!< @if Eng announce data + @else 设备公开数据 @endif */ + uint8_t *seekRspData; /*!< @if Eng scan response data + @else 扫描响应数据 @endif */ +} SleAnnounceData; + +/** + * @if Eng + * @brief Announce enable parameter. + * @else + * @brief 设备公开使能参数。 + * @endif + */ +typedef struct SleAnnounceEnableType { + uint8_t enable; /*!< @if Eng enable flag + @else 0x0:关闭设备公开, 0x1: 使能设备公开 @endif */ + uint8_t announceHandle; /*!< @if Eng announce handle + @else 设备公开句柄 @endif */ + uint16_t duration; /*!< @if Eng announce duration + @else 0x0:设备公开时间无限制, 0x1~0xFFFF:设备公开时间=N*10ms @endif */ + uint8_t maxAnnounceEvents; /*!< @if Eng maximum of announce events + @else 0x0:设备公开事件个数无限制, 0x1~0xFF:设备公开事件个数限制 @endif */ +} SleAnnounceEnable; + +/** + * @if Eng + * @brief Seek scan parameter. + * @else + * @brief 设备发现扫描参数。 + * @endif + */ +typedef struct SleSeekParam { + uint8_t ownaddrtype; /*!< @if Eng own address type + @else 本端地址类型 @endif */ + uint8_t filterduplicates; /*!< @if Eng duplicates filter + @else 重复过滤开关,0:关闭,1:开启 @endif */ + uint8_t seekfilterpolicy; /*!< @if Eng scan filter policy { @ref SleSeekFilterType } + @else 扫描设备使用的过滤类型, + { @ref SleSeekFilterType } @endif */ + uint8_t seekphys; /*!< @if Eng scan PHY type { @ref SleSeekPhyType } + @else 扫描设备所使用的PHY,{ @ref SleSeekPhyType } + @endif */ + uint8_t seekType[OH_SLE_SEEK_PHY_NUM_MAX]; /*!< @if Eng scan type { @ref sle_seek_scan_t } + @else 扫描类型,{ @ref SleSeekType } + @endif */ + uint16_t seekInterval[OH_SLE_SEEK_PHY_NUM_MAX]; /*!< @if Eng scan interval + @else 扫描间隔,取值范围[0x0004, 0xFFFF],time = N * 0.125ms + @endif */ + uint16_t seekWindow[OH_SLE_SEEK_PHY_NUM_MAX]; /*!< @if Eng scan window + @else 扫描窗口,取值范围[0x0004, 0xFFFF],time = N * 0.125ms + @endif */ +} SleSeekParam; + +/** + * @if Eng + * @brief Seek result. + * @else + * @brief 扫描结果报告设备信息。 + * @endif + */ +typedef struct SleSeekResultInfo { + uint8_t eventType; /*!< @if Eng event type + @else 上报事件类型 @endif */ + SleAddr addr; /*!< @if Eng address + @else 地址 @endif */ + SleAddr directAddr; /*!< @if Eng direct address + @else 定向发现地址 @endif */ + int8_t rssi; /*!< @if Eng rssi + @else 信号强度指示,取值范围[-127dBm, 20dBm],0x7F表示不提供信号强度指示 + @endif */ + uint8_t dataStatus; /*!< @if Eng data status + @else 数据状态 @endif */ + uint8_t dataLength; /*!< @if Eng data length + @else 数据长度 @endif */ + uint8_t *data; /*!< @if Eng data + @else 数据 @endif */ +} SleSeekResultInfo; + +/** + * @if Eng + * @brief Callback invoked when connect announce enabled. + * @par Callback invoked when connect announce enabled. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] announce_id announce ID. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 设备公开使能的回调函数。 + * @par 设备公开使能的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] announce_id 公开ID。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleAnnounceEnableCallback)(uint32_t announceId, ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when connect announce disabled. + * @par Callback invoked when connect announce disabled. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] announce_id announce ID. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 设备公开关闭的回调函数。 + * @par 设备公开关闭的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] announce_id 公开ID。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleAnnounceDisableCallback)(uint32_t announceId, ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when announce terminated. + * @par Callback invoked when announce terminated. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] announce_id announce ID. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 设备公开停止的回调函数。 + * @par 设备公开停止的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] announce_id 公开ID。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleAnnounceTerminalCallback)(uint32_t announceId); + +/** + * @if Eng + * @brief Callback invoked when announce remove. + * @par Callback invoked when announce remove. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] announce_id announce ID. + * @param [in] status error code. + * @par Dependency: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @else + * @brief 删除广播的回调函数。 + * @par 删除广播的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] announce_id 公开ID。 + * @param [in] status 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @see sle_connection_callbacks_t + * @endif + */ +typedef void (*SleAnnounceRemoveCallback)(uint32_t announceId, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when seek enabled. + * @par Callback invoked when seek enabled. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 扫描使能的回调函数。 + * @par 扫描使能的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleStartSeekCallback)(ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when scan disabled. + * @par Callback invoked when scan disabled. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 扫描关闭的回调函数。 + * @par 扫描关闭的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleSeekDisableCallback)(ErrCodeType status); + +/** + * @if Eng + * @brief Callback invoked when receive seek data. + * @par Callback invoked when receive seek data. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] seekresultdata seek result. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief 扫描结果上报的回调函数。 + * @par 扫描结果上报的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] seekresultdata 扫描结果数据。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleSeekResultCallback)(SleSeekResultInfo *SeekResultData); + +/** + * @if Eng + * @brief The callback interface for sle dfr function. + * @retval no return value + * @else + * @brief sle协议栈dfr流程 + * @retval 无返回值 + * @endif + */ +typedef void (*SleDfrCallback)(void); + +/** + * @if Eng + * @brief Callback invoked when device power on. + * @par Callback invoked when device power on. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status error code. + * @retval void no return value. + * @par Dependency: + * @li sle_common.h + * @see sle_dev_manager_callbacks_t + * @else + * @brief SLE设备上电。 + * @par SLE设备上电。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see sle_dev_manager_callbacks_t + * @endif + */ +typedef void (*SlePowerOnCallback)(uint8_t status); + +/** + * @if Eng + * @brief Callback invoked when SLE stack enable. + * @par Callback invoked when SLE stack enable. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief SLE协议栈使能。 + * @par SLE协议栈使能。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleEnableCallback)(uint8_t status); + +/** + * @if Eng + * @brief Callback invoked when SLE stack disable. + * @par Callback invoked when SLE stack disable. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SleConnectionCallbacks + * @else + * @brief SLE协议栈去使能。 + * @par SLE协议栈去使能。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. 指针由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SleConnectionCallbacks + * @endif + */ +typedef void (*SleDisableCallback)(uint8_t status); + +/** + * @if Eng + * @brief Struct of SLE device announce callback function. + * @else + * @brief SLE 设备公开回调函数接口定义。 + * @endif + */ +typedef struct { + SleEnableCallback sleEnableCb; /*!< @if Eng SLE stack enable callback. + @else SLE协议栈使能回调函数。 @endif */ + SleDisableCallback sleDisableCb; /*!< @if Eng SLE stack disable callback. + @else SLE协议栈去使能回调函数。 @endif */ + SleAnnounceEnableCallback announceEnableCb; /*!< @if Eng device announce enable callback. + @else 设备公开使能回调函数。 @endif */ + SleAnnounceDisableCallback announceDisableCb; /*!< @if Eng device announce disable callback. + @else 设备公开关闭回调函数。 @endif */ + SleAnnounceTerminalCallback announceTerminalCb; /*!< @if Eng device announce terminated callback. + @else 设备公开停止回调函数。 @endif */ + SleAnnounceRemoveCallback announceRemoveCb; /*!< @if Eng device announce remove callback. + @else 设备公开停止回调函数。 @endif */ + SleStartSeekCallback seekEnableCb; /*!< @if Eng scan enable callback. + @else 扫描使能回调函数。 @endif */ + SleSeekDisableCallback seekDisableCb; /*!< @if Eng scan disable callback. + @else 扫描关闭回调函数。 @endif */ + SleSeekResultCallback seekResultCb; /*!< @if Eng scan result callback. + @else 扫描结果回调函数。 @endif */ + SleDfrCallback seekDfrCb; /*!< @if Eng scan result callback. + @else 扫描结果回调函数。 @endif */ + SlePowerOnCallback slePowerOnCb; /*!< @if Eng SLE device power on callback. + @else SLE设备上电回调函数。 @endif */ +} SleAnnounceSeekCallbacks; + +/** + * @if Eng + * @brief Enable SLE stack. + * @par Description: Enable SLE stack. + * @param NULL + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 使能SLE协议栈。 + * @par Description: 使能SLE协议栈。 + * @param NULL + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType EnableSle(void); + +/** + * @if Eng + * @brief Disable SLE stack. + * @par Description: Disable SLE stack. + * @param NULL + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 关闭SLE协议栈。 + * @par Description: 关闭SLE协议栈。 + * @param NULL + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType DisableSle(void); + +/** + * @if Eng + * @brief Set local device address. + * @par Description: Set local device address. + * @param [in] addr address. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 设置本地设备地址。 + * @par Description: 设置本地设备地址。 + * @param [in] addr 地址。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleSetLocalAddr(SleAddr *addr); + +/** + * @if Eng + * @brief Get local device address. + * @par Description: Get local device address. + * @param [out] addr address. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 获取本地设备地址。 + * @par Description: 获取本地设备地址。 + * @param [out] addr 地址。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleGetLocalAddr(SleAddr *addr); + +/** + * @if Eng + * @brief Use this funtion to set local device name. + * @par Use this funtion to set local device name. + * @attention NULL + * @param [in] name local device name. + * @param [in] len local device name length. + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 设置本地设备名称。 + * @par 设置本地设备名称。 + * @attention 无 + * @param [in] name 本地设备名称。 + * @param [in] len 本地设备名称长度,包括结束符\0。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleSetLocalName(const uint8_t *name, uint8_t len); + +/** + * @if Eng + * @brief Use this funtion to get local device name. + * @par Use this funtion to get local device name. + * @attention NULL + * @param [out] name local device name. + * @param [inout] len as input parameter, the buffer size of user, + as output parameter, the length of local device name. + * @retval error code + * @par Dependency: + * @li sle_common.h + * @else + * @brief 获取本地设备名称。 + * @par 获取本地设备名称。 + * @attention 无 + * @param [out] name 本地设备名称。 + * @param [inout] len 作为入参时为用户分配的内存大小,作为出参时为本地设备名称长度。 + * @retval 执行结果错误码 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleGetLocalName(uint8_t *name, uint8_t *len); + +/** + * @if Eng + * @brief Use this funtion to set announce data. + * @par Use this funtion to set announce data + * @attention NULL + * @param [in] announce_id announce ID + * @param [in] data a pointer to the announce data + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 设置设备公开数据。 + * @par 设置设备公开数据。 + * @attention 无 + * @param [in] announce_id 设备公开 ID + * @param [in] data 设备公开数据 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleSetAnnounceData(uint8_t announceId, const SleAnnounceData *data); + +/** + * @if Eng + * @brief Use this funtion to set announce parameter. + * @par Use this funtion to set announce parameter + * @attention NULL + * @param [in] announce_id announce ID + * @param [in] param a pointer to the announce parameter + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 设置设备公开参数。 + * @par 设置设备公开参数。 + * @attention 无 + * @param [in] announce_id 设备公开 ID + * @param [in] param 设备公开参数 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleSetAnnounceParam(uint8_t announceId, const SleAnnounceParam *param); + +/** + * @if Eng + * @brief Use this funtion to start announce. + * @par Use this funtion to start announce. + * @attention NULL + * @param [in] announce_id announce ID + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 开始设备公开。 + * @par 开始设备公开。 + * @attention 无 + * @param [in] announce_id 设备公开 ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleStartAnnounce(uint8_t announceId); + +/** + * @if Eng + * @brief Use this funtion to stop announce. + * @par Use this funtion to stop announce. + * @attention NULL + * @param [in] announce_id announce ID + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 结束设备公开。 + * @par 结束设备公开。 + * @attention 无 + * @param [in] announce_id 设备公开 ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleStopAnnounce(uint8_t announceId); + +/** + * @if Eng + * @brief Use this funtion to set device seek parameter. + * @par Use this funtion to set device seek parameter. + * @attention NULL + * @param [in] param device device seek parameter. + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 设置设备公开扫描参数。 + * @par 设置设备公开扫描参数。 + * @attention 无 + * @param [in] param 设备公开扫描参数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleSetSeekParam(SleSeekParam *param); + +/** + * @if Eng + * @brief Use this funtion to start device seek. + * @par Use this funtion to start device seek. + * @attention NULL + * @param NULL + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 开始设备公开扫描。 + * @par 开始设备公开扫描。 + * @attention 无 + * @param NULL + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleStartSeek(void); + +/** + * @if Eng + * @brief Use this funtion to stop device seek. + * @par Use this funtion to stop device seek. + * @attention NULL + * @param NULL + * @retval error code. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 停止设备公开扫描。 + * @par 停止设备公开扫描。 + * @attention 无 + * @param NULL + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +ErrCodeType SleStopSeek(void); + +/** + * @if Eng + * @brief Register SLE device device_seek callbacks. + * @par Description: Register SLE device device_seek callbacks. + * @param [in] func Callback function. + * @retval error code. + * @else + * @brief 注册SLE设备发现回调函数。 + * @par Description: 注册SLE设备发现回调函数。 + * @param [in] func 回调函数。 + * @retval 执行结果错误码。 + * @endif + */ +ErrCodeType SleAnnounceSeekRegisterCallbacks(SleAnnounceSeekCallbacks *func); + +#ifdef __cplusplus +} +#endif +#endif /* OH_OH_SLE_DEVICE_ANC_SEK */ +/** + * @} + */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_errcode.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_errcode.h new file mode 100755 index 0000000..4866332 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_errcode.h @@ -0,0 +1,193 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + * + * Description: SLE error code. + */ + +/** + * @defgroup sle_error_code Error Code API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_ERR_CODE_TYPE_H +#define OH_SLE_ERR_CODE_TYPE_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/** + * @if Eng + * @brief SLE error code base. + * @else + * @brief SLE 错误码起始。 + * @endif + */ +#define OH_ERRCODE_SLE_COMMON_BASE 0x80006000 + +/** + * @if Eng + * @brief SLE SSAP error code base. + * @else + * @brief SLE SSAP 错误码起始。 + * @endif + */ +#define OH_ERRCODE_SLE_SSAP_BASE 0x80006100 + +/** + * @if Eng + * @brief SLE SSAP error code end. + * @else + * @brief SLE SSAP 错误码结束。 + * @endif + */ +#define OH_ERRCODE_SLE_SSAP_END 0x800061FF + +/** + * @if Eng + * @brief SLE error code base. + * @else + * @brief SLE 错误码结束。 + * @endif + */ +#define OH_ERRCODE_SLE_COMMON_END 0x800067FF + +/** + * @if Eng + * @brief SLE error code. + * @else + * @brief SLE 错误码(非协议相关)。 + * @endif + */ +typedef enum { + OH_ERRCODE_SLE_SUCCESS = 0, /*!< @if Eng error code of success + @else 执行成功错误码 @endif */ + OH_ERRCODE_SLE_CONTINUE = OH_ERRCODE_SLE_COMMON_BASE, /*!< @if Eng error code of continue + @else 继续执行错误码 @endif */ + OH_ERRCODE_SLE_DIRECT_RETURN, /*!< @if Eng error code of direct return + @else 直接返回错误码 @endif */ + OH_ERRCODE_SLE_NO_ATTATION, /*!< @if Eng error code of no attention + @else 错误码 @endif */ + OH_ERRCODE_SLE_PARAM_ERR, /*!< @if Eng error code of parameter error + @else 参数错误错误码 @endif */ + OH_ERRCODE_SLE_FAIL, /*!< @if Eng error code of configure fail + @else 配置失败错误码 @endif */ + OH_ERRCODE_SLE_TIMEOUT, /*!< @if Eng error code of configure timeout + @else 配置超时错误码 @endif */ + OH_ERRCODE_SLE_UNSUPPORTED, /*!< @if Eng error code of unsupported parameter + @else 参数不支持错误码 @endif */ + OH_ERRCODE_SLE_GETRECORD_FAIL, /*!< @if Eng error code of get current record fail + @else 获取当前记录失败错误码 @endif */ + OH_ERRCODE_SLE_POINTER_NULL, /*!< @if Eng error code of pointer is NULL + @else 指针为空错误码 @endif */ + OH_ERRCODE_SLE_NO_RECORD, /*!< @if Eng error code of no record return + @else 无记录返回错误码 @endif */ + OH_ERRCODE_SLE_STATUS_ERR, /*!< @if Eng error code of state error + @else 状态错误错误码 @endif */ + OH_ERRCODE_SLE_NOMEM, /*!< @if Eng error code of no memory + @else 内存不足错误码 @endif */ + OH_ERRCODE_SLE_AUTH_FAIL, /*!< @if Eng error code of authentication failure + @else 认证失败错误码 @endif */ + OH_ERRCODE_SLE_AUTH_PKEY_MISS, /*!< @if Eng error code of authentication fail due to pin + code or key lost + @else PIN码或密钥丢失致认证失败错误码 @endif */ + OH_ERRCODE_SLE_RMT_DEV_DOWN, /*!< @if Eng error code of remote device down + @else 对端设备关闭错误码 @endif */ + OH_ERRCODE_SLE_PAIRING_REJECT, /*!< @if Eng error code of pair reject + @else 配对拒绝错误码 @endif */ + OH_ERRCODE_SLE_BUSY, /*!< @if Eng error code of system busy + @else 系统繁忙错误码 @endif */ + OH_ERRCODE_SLE_NOT_READY, /*!< @if Eng error code of system not ready + @else 系统未准备好错误码 @endif */ + OH_ERRCODE_SLE_CONN_FAIL, /*!< @if Eng error code of connect fail + @else 连接失败错误码 @endif */ + OH_ERRCODE_SLE_OUT_OF_RANGE, /*!< @if Eng error code of out of range + @else 越界错误码 @endif */ + OH_ERRCODE_SLE_MEMCPY_FAIL, /*!< @if Eng error code of memcpy fail + @else 拷贝失败错误码 @endif */ + OH_ERRCODE_SLE_MALLOC_FAIL, /*!< @if Eng error code of malloc fail + @else 内存申请失败错误码 @endif */ + OH_ERRCODE_SLE_MAX = OH_ERRCODE_SLE_COMMON_END /*!< @if Eng maximum of SLE error code + @else SLE 错误码最大值 @endif */ +} ErrCodeType; + +/** + * @if Eng + * @brief SLE SSAP protocol error code. + * @else + * @brief SLE SSAP 协议错误码。 + * @endif + */ +typedef enum { + OH_ERRCODE_SSAP_INVALID_PDU = OH_ERRCODE_SLE_SSAP_BASE + 0x01, /*!< @if Eng invalid PDU + @else 服务端接收的 PDU 无效 + @endif */ + OH_ERRCODE_SSAP_PDU_NOT_SUPPORT = OH_ERRCODE_SLE_SSAP_BASE + 0x02, /*!< @if Eng PDU not support + @else 服务端不支持处理接收的 + PDU + @endif */ + OH_ERRCODE_SSAP_UNKNOW = OH_ERRCODE_SLE_SSAP_BASE + 0x03, /*!< @if Eng PDU unknow + @else 服务端执行请求时发生 + 未知错误 + @endif */ + OH_ERRCODE_SSAP_INVALID_HANDLE = OH_ERRCODE_SLE_SSAP_BASE + 0x04, /*!< @if Eng invalid handle + @else 请求中的句柄无效 + @endif */ + OH_ERRCODE_SSAP_INSUFFICIENT_RESOURCES = OH_ERRCODE_SLE_SSAP_BASE + 0x05, /*!< @if Eng insufficient resources + @else 服务端没有足够资源完成 + 请求 + @endif */ + OH_ERRCODE_SSAP_PROHIBIT_READING = OH_ERRCODE_SLE_SSAP_BASE + 0x06, /*!< @if Eng prohibit reading + @else 服务端禁止客户端读取值 + @endif */ + OH_ERRCODE_SSAP_PROHIBIT_WRITE = OH_ERRCODE_SLE_SSAP_BASE + 0x07, /*!< @if Eng prohibit writing + @else 服务端禁止客户端写入值 + @endif */ + OH_ERRCODE_SSAP_CLIENT_NOT_AUTHENTICATED = OH_ERRCODE_SLE_SSAP_BASE + 0x08, /*!< @if Eng client no authentication + @else 客户端未经过认证 + @endif */ + OH_ERRCODE_SSAP_CLIENT_NOT_AUTHORIZATION = OH_ERRCODE_SLE_SSAP_BASE + 0x09, /*!< @if Eng client no authorizaion + @else 客户端未被授权 + @endif */ + OH_ERRCODE_SSAP_BEARER_NOT_ENCRYPTED = OH_ERRCODE_SLE_SSAP_BASE + 0x0A, /*!< @if Eng bearer not encrypted + @else 传输 PDU 的承载未加密 + @endif */ + OH_ERRCODE_SSAP_ENTRIES_NOT_FOUND = OH_ERRCODE_SLE_SSAP_BASE + 0x0B, /*!< @if Eng entries not found + @else 服务端未找到对应条目 + @endif */ + OH_ERRCODE_SSAP_DATA_NOT_FOUND = OH_ERRCODE_SLE_SSAP_BASE + 0x0C, /*!< @if Eng data not found + @else 服务端未找到对应类型数据 + @endif */ + OH_ERRCODE_SSAP_INCORRECT_DATA_TYPE = OH_ERRCODE_SLE_SSAP_BASE + 0x0D, /*!< @if Eng data type incorrected + @else 客户端发送写入数据类型 + 不符的错误 + @endif */ + OH_ERRCODE_SSAP_INCORRECT_DATA_VALUE = OH_ERRCODE_SLE_SSAP_BASE + 0x0E, /*!< @if Eng data value incorrected + @else 客户端发送写入值不符 + 的错误 + @endif */ + OH_ERRCODE_SSAP_VALUE_OUT_OF_RANGE = OH_ERRCODE_SLE_SSAP_BASE + 0x0F, /*!< @if Eng data value incorrected + @else 客户端写入的值超出范围 + @endif */ + OH_ERRCODE_SSAP_UPPERLAYER_APPLICATION_ERROR_MIN = OH_ERRCODE_SLE_SSAP_BASE + 0xAF, /*!< @if Eng reserve + @else 预留给上层协议定义应用 + 错误 + @endif */ + OH_ERRCODE_SSAP_UPPERLAYER_APPLICATION_ERROR_MAX = OH_ERRCODE_SLE_SSAP_BASE + 0xFF, /*!< @if Eng reserve + @else 预留给上层协议定义应用 + 错误 + @endif */ +} ErrCode_SsapType; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif +#endif /* OH_SLE_ERR_CODE_TYPE_H */ +/** + * @} + */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_client.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_client.h new file mode 100755 index 0000000..36ffc98 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_client.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + */ + +#ifndef BTH_GLE_SERVICE_SERVICE_ACCESS_PROTOCOL_CLIENT_H +#define BTH_GLE_SERVICE_SERVICE_ACCESS_PROTOCOL_CLIENT_H + +#include "sdk_list.h" + +#define btsrv_send_sle_sspac_msg(id, p0, p1, p2) \ + btsrv_send_simple_msg(BTSRV_MSG_ID_SLE_SSAPC_MANAGER, \ + (uintptr_t)(id), (uintptr_t)(p0), (uintptr_t)(p1), (uintptr_t)(p2)) + +/* 本地服务管理客户端模块消息定义 */ +enum { + SLE_SSAPC_MSG_ID_FIND_STRUCTURE, + SLE_SSAPC_MSG_ID_FIND_PROPERTY, + SLE_SSAPC_MSG_ID_FIND_STRUCTURE_COMPLETE, + SLE_SSAPC_MSG_ID_READ_BY_UUID_COMPLETE, + SLE_SSAPC_MSG_ID_READ_CFM, + SLE_SSAPC_MSG_ID_WRITE_CFM, + SLE_SSAPC_MSG_ID_EXCHANGE_INFO, + SLE_SSAPC_MSG_ID_NOTIFICATION, + SLE_SSAPC_MSG_ID_INDICATION +}; + +void ssapc_client_init(void); +#endif \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_server.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_server.h new file mode 100755 index 0000000..4aa4981 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_srv_ssap_server.h @@ -0,0 +1,178 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + * + * Description: SLE ssap server manager module. + */ +#ifndef SLE_SERVICE_SERVICE_ACCESS_PROTOCOL_SERVER_H +#define SLE_SERVICE_SERVICE_ACCESS_PROTOCOL_SERVER_H + +#include "btsrv_task.h" +#include "sdk_list.h" +#include "sle_ssap_stru.h" +#include "bt_srv_msg.h" +#include "sle_ssap_stru.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define btsrv_send_sle_ssaps_msg(id, p0, p1, p2) \ + btsrv_send_simple_msg(BTSRV_MSG_ID_SLE_SSAPS, \ + (uintptr_t)(id), (uintptr_t)(p0), (uintptr_t)(p1), (uintptr_t)(p2)) +#define btsrv_errcode_base(ret) (((ret) == ERRCODE_GLE_SUCCESS) ? (ret) : ((ret) + ERRCODE_SLE_COMMON_BASE)) + +/* 本地设备管理模块消息定义 */ +typedef enum { + SLE_SSAPS_MSG_ID_SERVICE_ADD, + SLE_SSAPS_MSG_ID_PROPERITY_ADD, + SLE_SSAPS_MSG_ID_DESCRIPTOR_ADD, + SLE_SSAPS_MSG_ID_START_SERVICE, + SLE_SSAPS_MSG_ID_DELETE_ALL_SERVICE, + SLE_SSAPS_MSG_ID_MTU_CHANGE, + SLE_SSAPS_MSG_ID_REQUEST_READ, + SLE_SSAPS_MSG_ID_REQUEST_WRITE, +} sle_ssaps_msg_id_t; + +/** + * @brief bts 维护service状态枚举 + */ +typedef enum { + SLE_SSAP_SERVICE_UNKNOW = 0x00, + SLE_SSAP_SERVICE_NOT_ACTIVE = 0x01, + SLE_SSAP_SERVICE_STARTING = 0x02, + SLE_SSAP_SERVICE_ACTIVE = 0x03, +} ssaps_service_t; + +/** + * @brief 星闪服务类型 + */ +typedef enum { + SLE_SSAP_STD_PRIMARY_SERVICE = 0x00, /*!< 星闪标准定义的首要服务 */ + SLE_SSAP_STD_SECOND_SERVICE = 0x01, /*!< 星闪标准定义的次要服务 */ + SLE_SSAP_STD_PROPERTY = 0x02, /*!< 星闪标准定义的服务属性 */ + SLE_SSAP_STD_METHOD = 0x03, /*!< 星闪标准定义的服务方法 */ + SLE_SSAP_STD_EVENT = 0x04, /*!< 星闪标准定义的服务事件 */ + SLE_SSAP_STD_SERVICE_REFERENCE = 0x05, /*!< 引用星闪标准定义服务 */ + SLE_SSAP_STD_DESCRIPTOR = 0x06, /*!< 星闪标准定义服务属性描述 */ + SLE_SSAP_STD_RFU = 0x07, /*!< 保留后续扩展 */ + SLE_SSAP_CUST_PRIMARY_SERVICE = 0x08, /*!< 厂商自定义首要服务 */ + SLE_SSAP_CUST_SECOND_SERVICE = 0x09, /*!< 厂商自定义次要服务 */ + SLE_SSAP_CUST_PROPERTY = 0x0A, /*!< 厂商自定义服务属性 */ + SLE_SSAP_CUST_METHOD = 0x0B, /*!< 厂商自定义服务方法 */ + SLE_SSAP_CUST_EVENT = 0x0C, /*!< 厂商自定义服务事件 */ + SLE_SSAP_CUST_SERVICE_REFERENCE = 0x0D, /*!< 厂商自定义服务引用 */ + SLE_SSAP_CUST_DESCRIPTOR = 0x0E, /*!< 厂商自定义服务属性描述 */ +} ssap_table_type_t; + +/** + * @brief bts 维护descriptor 节点,ssaps内部使用,禁止外部调用 + */ +typedef struct { + uint16_t handle; /* 特征句柄 */ + uint16_t permission; /* 特征描述符权限 */ + uint8_t type; /* 描述符类型, 参见ssap_property_descriptor_type_t定义 */ + SleUuid uuid; /* 特征描述符uuid */ + uint32_t operateIndication; /* 操作指示 */ + uint16_t len; /* 特征描述符值长度 */ + uint8_t *val; /* 特征描述符值 */ +} ssaps_descriptor_node_t; + +/** + * @brief bts 维护descriptor 链表,ssaps内部使用,禁止外部调用 + */ +typedef struct { + struct list_stru list; /* ssaps_descriptor_node_t */ +} ssaps_descriptor_list_t; + +/** + * @brief bts 维护property 节点,ssaps内部使用,禁止外部调用 + */ +typedef struct { + uint16_t handle; /* 特征句柄 */ + uint16_t permission; /* 特征权限 */ + uint8_t type; /* 特征类型 */ + SleUuid uuid; /* 特征uuid */ + uint32_t operateIndication; /* 操作指示 ssap_property_operate_indication_t */ + ssaps_descriptor_list_t descriptor; /* 包含描述符 */ + uint8_t protocol; /* see cs_service_type defination */ + + uint16_t len; /* 特征值长度 */ + uint8_t *val; /* 特征值 */ +} ssaps_property_node_t; + +/** + * @brief bts 维护property 链表,ssaps内部使用,禁止外部调用 + */ +typedef struct { + struct list_stru list; /* ssaps_property_node_t */ +} ssaps_property_list_t; + +/** + * @brief bts 维护include 链表,ssaps内部使用,禁止外部调用 + */ +typedef struct { + struct list_stru list; +} ssaps_include_list_t; + +/** + * @brief bts 维护service 节点,ssaps内部使用,禁止外部调用 + */ +typedef struct serv_node { + uint16_t handle; + uint16_t endHandle; + SleUuid uuid; + uint8_t primary; /* 是否是首要服务 */ + uint8_t active; /* 是否开启 */ + + ssaps_property_list_t property; /* 所含特征 */ + ssaps_include_list_t include; /* 所含包含服务 */ + uint8_t service_type; + uint8_t type_indication; /* 服务成员类型指示 */ +} ssaps_service_node_t; + +/** + * @brief bts 维护service 链表,ssaps内部使用,禁止外部调用 + */ +typedef struct { + struct list_stru list; /* ssaps_service_node_t */ +} ssaps_service_list_t; + +/** + * @brief bts 维护server 节点,ssaps内部使用,禁止外部调用 + */ +typedef struct { + uint8_t serverId; + SleUuid appUuid; + ssaps_service_list_t service; + uint16_t current_adding_service_hdl; + uint16_t current_item_idle_hdl; + uint16_t total_hdl_num; + uint16_t current_add_item_type; /* ssap_item_type_t */ +} ssaps_server_node_t; + +/** + * @brief bts 维护server 链表,ssaps内部使用,禁止外部调用 + */ +typedef struct { + struct list_stru list; +} ssaps_server_list_t; + +void btsrv_sle_ssaps_init(void); +void btsrv_sle_ssaps_deinit(void); +errcode_t btsrv_sle_ssap_server_callback_register(void); + +/** + * @brief bts 设置当前添加节点,ssaps内部使用,禁止外部调用 + */ +void btsrv_sle_set_current_starting_node(ssaps_server_node_t *srv_node, ssaps_service_node_t *node); +/** + * @brief bts 设置当前添加队列,ssaps内部使用,禁止外部调用 + */ +struct list_stru *get_ssaps_start_service_queue(void); +#ifdef __cplusplus +} +#endif +#endif /* SLE_SERVICE_SERVICE_ACCESS_PROTOCOL_SERVER_H */ +/** + * @} + */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_client.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_client.h new file mode 100755 index 0000000..58c34cd --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_client.h @@ -0,0 +1,681 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE Service Access Protocol CLIENT module. + */ + +/** + * @defgroup sle ssap client Service Access Protocol CLient API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_SSAP_CLIENT_H +#define OH_SLE_SSAP_CLIENT_H + +#include +#include "errcode.h" +#include "oh_sle_common.h" +#include "oh_sle_ssap_stru.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Service discovery result. + * @else + * @brief 服务发现结果。 + * @endif + */ +typedef struct { + uint16_t startHdl; /*!< @if Eng service start handle. + @else 服务起始句柄。 @endif */ + uint16_t endHdl; /*!< @if Eng service end handle. + @else 服务结束句柄。 @endif */ + SleUuid uuid; /*!< @if Eng service end handle. + @else 服务UUID。 @endif */ +} SsapcFindServiceResult; + + /** + * @if Eng + * @brief Attribute discovery result. + * @else + * @brief 属性发现结果。 + * @endif + */ +typedef struct { + uint16_t handle; /*!< @if Eng property handle. + @else 属性句柄。 @endif */ + uint32_t operateIndication; /*!< @if Eng Operation instructions. + @else 操作指示。 @endif */ + SleUuid uuid; /*!< @if Eng UUID. + @else UUID标识。 @endif */ + uint8_t descriptorsCount; /*!< @if Eng Attribute Descriptor Type List Length. + @else 属性描述符类型列表长度。 @endif */ + uint8_t descriptorsType[0]; /*!< @if Eng Attribute descriptor type list. + { @ref ssap_property_descriptor_type_t }. + @else 属性描述符类型列表,{ @ref ssap_property_descriptor_type_t }类型定义 + @endif */ +} SsapcFindPropertyResult; + +/** + * @if Eng + * @brief Results for SSAP handle and value. + * @else + * @brief SSAP 句柄值。 + * @endif + */ +typedef struct { + uint16_t handle; /*!< @if Eng property handle. + @else 属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type. + @else 属性类型。 @endif */ + uint16_t dataLen; /*!< @if Eng Data Length. + @else 数据长度。 @endif */ + uint8_t *data; /*!< @if Eng Data. + @else 数据内容。 @endif */ +} SsapcHandleValue, SsapcWriteParam; + +/** + * @if Eng + * @brief Results for SSAP write operation. + * @else + * @brief SSAP 写结果。 + * @endif + */ +typedef struct { + uint16_t handle; /*!< @if Eng property handle. + @else 属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type. + @else 属性类型。 @endif */ +} SsapcWriteResult; + +/** + * @if Eng + * @brief Read by uuid complete. + * @else + * @brief 读取by uuid完成。 + * @endif + */ +typedef struct { + SleUuid uuid; /*!< @if Eng property handle. + @else 属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type. + @else 属性类型。 @endif */ +} SsapcReadByUuidCmpResult; + +/** + * @if Eng + * @brief SSAP find operation parameter. + * @else + * @brief SSAP 查找参数。 + * @endif + */ +typedef struct { + uint8_t type; /*!< @if Eng find type { @ref SsapFindType }. + @else 查找类型 { @ref SsapFindType }。 @endif */ + uint16_t startHdl; /*!< @if Eng start handle. + @else 起始句柄 @endif */ + uint16_t endHdl; /*!< @if Eng end handle. + @else 结束句柄 @endif */ + SleUuid uuid; /*!< @if Eng uuid, only valid when find structure by uuid. + @else uuid,按照uuid查找时生效,其余不生效 @endif */ + uint8_t reserve; /*!< @if Eng reserve, "0" for default value. + @else 预留,默认值写0 @endif */ +} SsapcFindStructureParam; + +/** + * @if Eng + * @brief Service Discovery Response Parameters + * @else + * @brief 服务发现响应参数 + * @endif + */ +typedef struct { + uint8_t type; /*!< @if Eng find type { @ref SsapFindType }. + @else 查找类型 { @ref SsapFindType }。 @endif */ + SleUuid uuid; /*!< @if Eng uuid + @else uuid @endif */ +} SsapcFindStructureResult; + +/** + * @if Eng + * @brief Struct of send read request by uuid parameter. + * @else + * @brief 向对端发送按照uuid读取请求的参数。 + * @endif + */ +typedef struct { + uint8_t type; /*!< @if Eng find type { @ref SsapFindType }. + @else 查找类型 { @ref SsapFindType }。 @endif */ + uint16_t start_hdl; /*!< @if Eng start handle. + @else 起始句柄。@endif */ + uint16_t end_hdl; /*!< @if Eng end handle. + @else 结束句柄。@endif */ + SleUuid uuid; /*!< @if Eng uuid. + @else uuid@endif */ +} SsapcReadReqByUuidParam; + +/** + * @if Eng + * @brief Callback invoked when service discovery. + * @par Callback invoked when service discovery. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] service service information. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @else + * @brief 服务发现的回调函数。 + * @par 服务发现的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] service 发现的服务信息。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +typedef void (*SsapcFindStructureCallback)(uint8_t clientId, uint16_t connId, + SsapcFindServiceResult *service, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when property discovered. + * @par Callback invoked when property discovered. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] property property. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 属性发现的回调函数。 + * @par 属性发现的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] property 特征。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcFindPropertyCallback)(uint8_t clientId, uint16_t connId, + SsapcFindPropertyResult *property, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when find completed. + * @par Callback invoked when find completed. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] structureResult input parameter. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 查找完成的回调函数。 + * @par 查找完成的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] structureResult 入参回传。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcFindStructureCompleteCallback)(uint8_t clientId, uint16_t connId, + SsapcFindStructureResult *structureResult, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when receive read response. + * @par Callback invoked when receive read response. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] readData read data. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 收到读响应的回调函数。 + * @par 收到读响应的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] readData 读取到的数据。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcReadCfmCallback)(uint8_t clientId, uint16_t connId, SsapcHandleValue *readData, + errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when read feature completed. + * @par Callback invoked when read feature completed. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] cmpResult input parameter. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 读取完成的回调函数。 + * @par 读取完成的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] cmpResult 入参回传。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcReadByUuidCompleteCallback)(uint8_t clientId, uint16_t connId, + SsapcReadByUuidCmpResult *cmpResult, errcode_t status); + +/** + * @if Eng + * @brief Callback function for receiving write response. + * @par Callback function for receiving write response. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] writeResult write result. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 收到写响应的回调函数。 + * @par 收到写响应的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] writeResult 写结果。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcWriteCfmCallback)(uint8_t clientId, uint16_t connId, SsapcWriteResult *writeResult, + errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when receive exchange info response. + * @par Callback invoked when receive exchange info response. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] param exchange info. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief mtu改变的回调函数。 + * @par mtu改变的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 交换信息。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcExchangeInfoCallback)(uint8_t clientId, uint16_t connId, SsapcExchangeInfo *param, + errcode_t status); + +/** + * @if Eng + * @brief Callback function for receiving a notification. + * @par Callback function for receiving a notification. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] data data. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 收到通知的回调函数。 + * @par 收到通知的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] data 数据。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcNotificationCallback)(uint8_t clientId, uint16_t connId, SsapcHandleValue *data, + errcode_t status); + +/** + * @if Eng + * @brief Callback function for receiving a indication. + * @par Callback function for receiving a indication. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2.The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] clientId client ID. + * @param [in] connId connection ID. + * @param [in] data data. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_common.h + * @see SsapcCallbacks + * @else + * @brief 收到指示的回调函数。 + * @par 收到指示的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] data 数据。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_common.h + * @see SsapcCallbacks + * @endif + */ +typedef void (*SsapcIndicationCallback)(uint8_t clientId, uint16_t connId, SsapcHandleValue *data, + errcode_t status); + +/** + * @if Eng + * @brief Struct of ssap client callback function. + * @else + * @brief ssap client回调函数接口定义。 + * @endif + */ +typedef struct { + SsapcFindStructureCallback findStructureCb; /*!< @if Eng Discovery structure callback. + @else 发现服务回调函数。 @endif */ + SsapcFindPropertyCallback ssapcFindPropertyCbk; /*!< @if Eng Discovery property callback. + @else 发现特征回调函数。 @endif */ + SsapcFindStructureCompleteCallback findStructureCmpCb; /*!< @if Eng Discovery structure complete callback. + @else 发现服务完成回调函数。 @endif */ + SsapcReadCfmCallback readCfmCb; /*!< @if Eng Receive write response callback. + @else 收到写响应回调函数。 @endif */ + SsapcReadByUuidCompleteCallback readByUuidCmpCb; /*!< @if Eng Callback hook for read property complete. + @else 读特征值完成回调钩子。 @endif */ + SsapcWriteCfmCallback writeCfmCb; /*!< @if Eng Receive write response callback. + @else 收到写响应回调函数。 @endif */ + SsapcExchangeInfoCallback exchangeInfoCb; /*!< @if Eng Callback hook for configure mtu size + complete. + @else 更新mtu大小回调钩子。 @endif */ + SsapcNotificationCallback notificationCb; /*!< @if Eng Callback hook for receive notification. + @else 通知事件上报钩子。 @endif */ + SsapcIndicationCallback indicationCb; /*!< @if Eng Callback hook for receive indication. + @else 指示事件上报钩子。 @endif */ +} SsapcCallbacks; + +/** + * @if Eng + * @brief Register ssap client. + * @par Description: Register ssap client. + * @param [in] appUuid App uuid + * @param [out] clientId Client ID + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 注册ssap客户端。 + * @par Description: 注册ssap客户端。 + * @param [in] appUuid 上层应用uuid + * @param [out] clientId 客户端ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcRegisterClient(SleUuid *appUuid, uint8_t *clientId); +/** + * @if Eng + * @brief Unregister ssap client. + * @par Description: Unregister ssap client. + * @param [in] clientId Client ID + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 注销ssap客户端。 + * @par Description: 注销ssap服务端。 + * @param [in] clientId 客户端ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcUnregisterClient(uint8_t clientId); + +/** + * @if Eng + * @brief Find structure. + * @par Description: Find structure. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] param structure uuid, if NULL, discover all structure, else filter by uuid. + * @retval error code, discovery structure result will be returned at { @ref SsapcFindStructureCallback } and + { @ref SsapcFindStructureCompleteCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 查找服务、特征、描述符。 + * @par Description: 查找服务、特征、描述符。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 查找参数。 + * @retval 执行结果错误码, 服务发现结果将在 { @ref SsapcFindStructureCallback }和 + { @ref SsapcFindStructureCompleteCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcFindStructure(uint8_t clientId, uint16_t connId, SsapcFindStructureParam *param); + +/** + * @if Eng + * @brief Send read by uuid request. + * @par Description: Send read by uuid request. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] param Parameter for read request by uuid. + * @retval error code, read result will be returned at { @ref SsapcReadCfmCallback } and + { @ref SsapcReadByUuidCompleteCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发起按照uuid读取请求。 + * @par Description: 发起按照uuid读取请求。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 按照uuid读取请求参数。 + * @retval 执行结果错误码,读取结果将在 { @ref SsapcReadCfmCallback }和 + { @ref SsapcReadByUuidCompleteCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcReadReqByUuid(uint8_t clientId, uint16_t connId, SsapcReadReqByUuidParam *param); + + /** + * @if Eng + * @brief Send read by handle request. + * @par Description: Send read by handle request. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] handle handle. + * @param [in] type property type. + * @retval error code, read result will be returned at { @ref SsapcReadCfmCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发起按照句柄读取请求。 + * @par Description: 发起按照句柄读取请求。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] handle 句柄。 + * @param [in] type 特征类型。 + * @retval 执行结果错误码,读取结果将在 { @ref SsapcReadCfmCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcReadReq(uint8_t clientId, uint16_t connId, uint16_t handle, uint8_t type); + +/** + * @if Eng + * @brief Send write request. + * @par Description: Send write request. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] param Parameter for write request. + * @retval error code, write result will be returned at { @ref SsapcWriteCfmCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发起写请求。 + * @par Description: 发起写请求。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 写请求参数。 + * @retval 执行结果错误码,写结果将在 { @ref SsapcWriteCfmCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapWriteReq(uint8_t clientId, uint16_t connId, SsapcWriteParam *param); + +/** + * @if Eng + * @brief Send write command. + * @par Description: Send write command. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] param Parameter for write command. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发起写命令。 + * @par Description: 发起写命令。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 写命令参数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcWriteCmd(uint8_t clientId, uint16_t connId, SsapcWriteParam *param); + +/** + * @if Eng + * @brief Send exchange info request. + * @par Description: Send exchange info request. + * @param [in] clientId Client ID. + * @param [in] connId Connection ID. + * @param [in] param Client info. + * @retval error code, exchange result will be returned at { @ref SsapcExchangeInfoCallback }. + * @par Depends: + * @li sle_common.h + * @else + * @brief 发送交换info请求。 + * @par Description: 发送交换info请求。 + * @param [in] clientId 客户端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] param 客户端info。 + * @retval 执行结果错误码, mtu改变结果将在 { @ref SsapcExchangeInfoCallback }中返回。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcExchangeInfoReq(uint8_t clientId, uint16_t connId, SsapcExchangeInfo* param); + +/** + * @if Eng + * @brief Register SSAP client callbacks. + * @par Description: Register SSAP client callbacks. + * @param [in] func Callback function. + * @retval error code. + * @par Depends: + * @li sle_common.h + * @else + * @brief 注册SSAP客户端回调函数。 + * @par Description: 注册SSAP客户端回调函数。 + * @param [in] func 回调函数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_common.h + * @endif + */ +errcode_t SsapcRegisterCallbacks(SsapcCallbacks *func); + +#ifdef __cplusplus +} +#endif +#endif /* SLE_SSAP_CLIENT_H */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_server.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_server.h new file mode 100755 index 0000000..20c1d6f --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_server.h @@ -0,0 +1,857 @@ +/** + * Copyright (c) @CompanyNameMagicTag 2022. All rights reserved. + * + * Description: SLE Service Access Protocol SERVER module. + */ + +/** + * @defgroup sle_ssap_server Service Access Protocol SERVER API + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_SSAP_SERVER_H +#define OH_SLE_SSAP_SERVER_H + +#include +#include +#include "errcode.h" +#include "oh_sle_common.h" +#include "oh_sle_ssap_stru.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Enum of sle indication cfm result. + * @else + * @brief 指示确认结果。 + * @endif + */ +typedef enum { + OH_SLE_INDICATION_CFM_FAIL = 0x00, /*!< @if Eng Indication cfm fail + @else 指示失败 @endif */ + OH_SLE_INDICATION_CFM_SUCESS = 0x01, /*!< @if Eng Indication cfm sucess + @else 指示成功 @endif */ +} SleIndicationCfmResult; + +/** + * @if Eng + * @brief Struct of add property information. + * @else + * @brief 添加特征信息。 + * @endif + */ +typedef struct { + SleUuid uuid; /*!< @if Eng UUID of SSAP property. + @else SSAP 特征 UUID。 @endif */ + uint16_t permissions; /*!< @if Eng Properity permissions. { @ref SsapPermissionType } + @else 特征权限。{ @ref SsapPermissionType }。 @endif */ + uint32_t operateIndication; /*!< @if Eng Operate Indication. { @ref SsapOperateIndication } + @else 操作指示 { @ref SsapOperateIndication } @endif */ + uint16_t valueLen; /*!< @if Eng Length of reponse data. + @else 响应的数据长度。 @endif */ + uint8_t *value; /*!< @if Eng Reponse data. + @else 响应的数据。 @endif */ +} SsapsPropertyInfo; + +/** + * @if Eng + * @brief Struct of add property descriptor information. + * @else + * @brief 添加特征描述符信息。 + * @endif + */ +typedef struct { + SleUuid uuid; /*!< @if Eng UUID of SSAP descriptor. + @else SSAP 描述符 UUID。 @endif */ + uint16_t permissions; /*!< @if Eng descriptor permissions. { @ref SsapPermissionType }. + @else 特征权限。 { @ref SsapPermissionType } @endif */ + uint32_t operateIndication; /*!< @if Eng operate Indication. { @ref SsapOperateIndication } + @else 操作指示 { @ref SsapOperateIndication } @endif */ + uint8_t type; /*!< @if Eng descriptor type. { @ref SsapPropertyType }. + @else 描述符类型。 { @ref SsapPropertyType } @endif */ + uint16_t valueLen; /*!< @if Eng data length. + @else 数据长度。 @endif */ + uint8_t *value; /*!< @if Eng data. + @else 数据。 @endif */ +} SsapsDescInfo; + +/** + * @if Eng + * @brief Struct of read request information. + * @else + * @brief 读请求信息。 + * @endif + */ +typedef struct { + uint16_t requestId; /*!< @if Eng Request id. + @else 请求id。 @endif */ + uint16_t handle; /*!< @if Eng Properity handle of the read request. + @else 请求读的属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type { @ref SsapPropertyType }. + @else 属性类型。 @endif { @ref SsapPropertyType } */ + bool need_rsp; /*!< @if Eng Whether response is needed. + @else 是否需要发送响应。 @endif */ + bool needAuthorize; /*!< @if Eng Whether authorize is needed. + @else 是否授权。 @endif */ +} SsapsReqReadCb; + +/** + * @if Eng + * @brief Struct of write request information. + * @else + * @brief 写请求信息。 + * @endif + */ +typedef struct { + uint16_t requestId; /*!< @if Eng Request id. + @else 请求id。 @endif */ + uint16_t handle; /*!< @if Eng Properity handle of the write request. + @else 请求写的属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type { @ref SsapPropertyType }. + @else 属性类型。 @endif { @ref SsapPropertyType } */ + bool need_rsp; /*!< @if Eng Whether response is needed. + @else 是否需要发送响应。 @endif */ + bool needAuthorize; /*!< @if Eng Whether authorize is needed. + @else 是否授权。 @endif */ + uint16_t length; /*!< @if Eng Length of write request data. + @else 请求写的数据长度。 @endif */ + uint8_t *value; /*!< @if Eng Write request data. + @else 请求写的数据。 @endif */ +} SsapsReqWriteCb; + +/** + * @if Eng + * @brief Struct of send response information. + * @else + * @brief 发送响应信息。 + * @endif + */ +typedef struct { + uint16_t requestId; /*!< @if Eng Request ID. + @else 请求 ID。 @endif */ + uint8_t status; /*!< @if Eng Status code of read/write. Success: + ERRCODE_SLE_SUCCESS. For details about the exception { @ref errcode_sle_ssap_t } + @else 读写结果的状态, 成功ERRCODE_SLE_SUCCESS + 异常参考{ @ref errcode_sle_ssap_t } @endif */ + uint16_t valueLen; /*!< @if Eng Length of reponse data. + @else 响应的数据长度。 @endif */ + uint8_t *value; /*!< @if Eng Reponse data. + @else 响应的数据。 @endif */ +} SsapsSendRsp; + +/** + * @if Eng + * @brief Struct of send notification/indication information. + * @else + * @brief 发送通知/指示信息。 + * @endif + */ +typedef struct { + uint16_t handle; /*!< @if Eng Properity handle. + @else 属性句柄。 @endif */ + uint8_t type; /*!< @if Eng property type { @ref SsapPropertyType }. + @else 属性类型 { @ref SsapPropertyType }。 @endif */ + uint16_t valueLen; /*!< @if Eng Length of notification/indication data. + @else 通知/指示数据长度。 @endif */ + uint8_t *value; /*!< @if Eng Notification/indication data. + @else 发送的通知/指示数据。 @endif */ +} SsapsNtfInd; + +/** + * @if Eng + * @brief Struct of send notification/indication by uuid information. + * @else + * @brief 通过uuid发送通知/指示信息。 + * @endif + */ +typedef struct { + SleUuid uuid; /*!< @if Eng Properity UUID. + @else 特征UUID。 @endif */ + uint16_t startHandle; /*!< @if Eng start handle. + @else 起始句柄。 @endif */ + uint16_t endHandle; /*!< @if Eng end handle. + @else 结束句柄。 @endif */ + uint8_t type; /*!< @if Eng property type { @ref SsapPropertyType }. + @else 属性类型。 @endif { @ref SsapPropertyType } */ + uint16_t valueLen; /*!< @if Eng Length of notification/indication data. + @else 通知/指示数据长度。 @endif */ + uint8_t *value; /*!< @if Eng Notification/indication data. + @else 发送的通知/指示数据。 @endif */ +} SsapsNtfIndByUuid; + +/** + * @if Eng + * @brief Callback invoked when service add. + * @par Callback invoked when service add. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] uuid service uuid. + * @param [in] handle service attribute handle. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 服务注册的回调函数。 + * @par 服务注册的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] uuid 服务uuid。 + * @param [in] handle 服务属性句柄。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsAddServiceCallback)(uint8_t serverId, SleUuid *uuid, uint16_t handle, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when property add. + * @par Callback invoked when property add. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] uuid property uuid. + * @param [in] serviceHandle service attribute handle. + * @param [in] handle character attribute handle. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 特征注册的回调函数。 + * @par 特征注册的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] uuid 特征 uuid。 + * @param [in] serviceHandle 服务属性句柄。 + * @param [in] handle 特征属性句柄。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsAddPropertyCallback)(uint8_t serverId, SleUuid *uuid, uint16_t serviceHandle, + uint16_t handle, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when property descriptor add. + * @par Callback invoked when property descriptor add. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] uuid property uuid. + * @param [in] serviceHandle service attribute handle. + * @param [in] propertyHandle character descriptor attribute handle. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 特征描述符注册的回调函数。 + * @par 特征描述符注册的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] uuid 特征 uuid。 + * @param [in] serviceHandle 服务属性句柄。 + * @param [in] propertyHandle 特征描述符属性句柄。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsAddDescriptorCallback)(uint8_t serverId, SleUuid *uuid, uint16_t serviceHandle, + uint16_t propertyHandle, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when service started. + * @par Callback invoked when service started. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] handle service attribute handle. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 开始服务的回调函数。 + * @par 开始服务的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] handle 服务属性句柄。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsStartServiceCallback)(uint8_t serverId, uint16_t handle, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when all services deleted. + * @par Callback invoked when all services deleted. + * @attention 1.This function is called in bts context,should not be blocked or do long time waiting. + * @attention 2. The memories of are requested and freed by the bts automatically. + * @param [in] serverId server ID. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 删除全部服务的回调函数。 + * @par 删除全部服务的回调函数。 + * @attention 1. 该回调函数运行于bts线程,不能阻塞或长时间等待。 + * @attention 2. 由bts申请内存,也由bts释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsDeleteAllServiceCallback)(uint8_t serverId, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when receive read request. + * @par Callback invoked when receive read request. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] connId connection ID. + * @param [in] readCbPara read request parameter. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 收到读请求的回调函数。 + * @par 收到读请求的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] readCbPara 读请求参数。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsReadRequestCallback)(uint8_t serverId, uint16_t connId, SsapsReqReadCb *readCbPara, + errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when receive write request. + * @par Callback invoked when receive write request. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] connId connection ID. + * @param [in] writeCbPara write request parameter. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 收到写请求的回调函数。 + * @par 收到写请求的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] writeCbPara 写请求参数。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsWriteRequestCallback)(uint8_t serverId, uint16_t connId, SsapsReqWriteCb *writeCbPara, + errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when receive indicate cfm. + * @par Callback invoked when receive indicate cfm. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] server_id server ID. + * @param [in] conn_id connection ID. + * @param [in] cfm_result cfm result. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief 收到指示确认的回调函数。 + * @par 收到指示确认的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] server_id 服务端 ID。 + * @param [in] conn_id 连接 ID。 + * @param [in] cfm_result 确认结果。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsIndicateCfmCallback)(uint8_t serverId, uint16_t connId, + SleIndicationCfmResult cfmResult, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when mtu size changed. + * @par Callback invoked when mtu size changed. + * @attention 1.This function is called in SLE service context,should not be blocked or do long time waiting. + * @attention 2. The memories of pointer are requested and freed by the SLE service automatically. + * @param [in] serverId server ID. + * @param [in] connId connection ID. + * @param [in] mtuSize mtu size. + * @param [in] status error code. + * @retval #void no return value. + * @par Dependency: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @else + * @brief mtu大小改变的回调函数。 + * @par mtu大小改变的回调函数。 + * @attention 1. 该回调函数运行于SLE service线程,不能阻塞或长时间等待。 + * @attention 2. pointer由SLE service申请内存,也由SLE service释放,回调中不应释放。 + * @param [in] serverId 服务端 ID。 + * @param [in] connId 连接 ID。 + * @param [in] mtuSize mtu 大小。 + * @param [in] status 执行结果错误码。 + * @retval 无返回值。 + * @par 依赖: + * @li sle_ssap_stru.h + * @see sle_ssaps_callbacks_t + * @endif + */ +typedef void (*SsapsMtuChangedCallback)(uint8_t serverId, uint16_t connId, + SsapcExchangeInfo *mtuSize, errcode_t status); + +/** + * @if Eng + * @brief Struct of SSAP server callback function. + * @else + * @brief SSAP server回调函数接口定义。 + * @endif + */ +typedef struct { + SsapsAddServiceCallback addServiceCb; /*!< @if Eng Service added callback. + @else 添加服务回调函数。 @endif */ + SsapsAddPropertyCallback addPropertyCb; /*!< @if Eng Characteristc added callback. + @else 添加特征回调函数。 @endif */ + SsapsAddDescriptorCallback addDescriptorCb; /*!< @if Eng Descriptor added callback. + @else 添加描述符回调函数。 @endif */ + SsapsStartServiceCallback startServiceCb; /*!< @if Eng Service started callback. + @else 启动服务回调函数。 @endif */ + SsapsDeleteAllServiceCallback deleteAllServiceCb; /*!< @if Eng Service deleted callback. + @else 删除服务回调函数。 @endif */ + SsapsReadRequestCallback readRequestCb; /*!< @if Eng Read request received callback. + @else 收到远端读请求回调函数。 @endif */ + SsapsWriteRequestCallback writeRequestCb; /*!< @if Eng Write request received callback. + @else 收到远端写请求回调函数。 @endif */ + SsapsIndicateCfmCallback indicateCfmCb; /*!< @if Eng Indicate cfm callback. + @else 指示确认回调函数。 @endif */ + SsapsMtuChangedCallback mtuChangedCb; /*!< @if Eng Mtu changed callback. + @else mtu 大小更新回调函数。 @endif */ +} SsapsCallbacks; + +/** + * @if Eng + * @brief Register ssap server. + * @par Description: Register ssap server. + * @param [in] appUuid App uuid + * @param [out] serverId Server ID + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 注册ssap服务端。 + * @par Description: 注册ssap服务端。 + * @param [in] appUuid 上层应用uuid + * @param [out] serverId 服务端ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t ssapsRegisterServer(SleUuid *appUuid, uint8_t *serverId); + +/** + * @if Eng + * @brief Unregister ssap server. + * @par Description: Unregister ssap server. + * @param [in] serverId Server ID + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 注销ssap服务端。 + * @par Description: 注销ssap服务端。 + * @param [in] serverId 服务端ID + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsUnregisterServer(uint8_t serverId); + +/** + * @if Eng + * @brief asynchronously add an SSAP service. The registered service handle is returned in addServiceCb. + * @par Description: Add a ssap service. + * @param [in] serverId Server ID. + * @param [in] serviceUuid Service uuid. + * @param [in] isPrimary is primary service or not. + * @retval error code, the service handle will be returned in { @ref SsapsAddServiceCallback }. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 异步添加一个ssap服务,注册service handle在add_service_cb中返回。 + * @par Description: 添加一个ssap服务。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceUuid 服务uuid。 + * @param [in] isPrimary 是否是首要服务。 + * @retval 执行结果错误码,服务句柄将在 { @ref SsapsAddServiceCallback }中返回。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddService(uint8_t serverId, SleUuid *serviceUuid, bool isPrimary); + +/** + * @if Eng + * @brief Add an ssap attribute asynchronously. The register attribute handle is returned in addPropertyCb. + * @par Description: Add a ssap property. + * @param [in] serverId Server ID. + * @param [in] serviceHandle Service handle. + * @param [in] property SSAP Properity. + * @retval error code, the character handle will be returned in { @ref SsapsAddPropertyCallback }. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 异步添加一个ssap属性,注册属性 handle在add_property_cb中返回 + * @par Description: 添加一个ssap特征。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceHandle 服务句柄。 + * @param [in] property SSAP 特征。 + * @retval 执行结果错误码,特征句柄将在 { @ref SsapsAddPropertyCallback }中返回。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddProperty(uint8_t serverId, uint16_t serviceHandle, SsapsPropertyInfo *property); + +/** + * @if Eng + * @brief An SSAP description is added asynchronously. The registration result is returned in addDescriptorCb. + * @par Description: Add a ssap property descriptor. + * @param [in] serverId Server ID. + * @param [in] serviceHandle Service handle. + * @param [in] propertyHandle Property handle. + * @param [in] descriptor Properity descriptor. + * @retval error code, the descriptor handle will be returned in { @ref SsapsAddDescriptorCallback }. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 异步添加一个ssap描述,注册描述结果在add_descriptor_cb中返回 + * @par Description: 添加一个ssap特征描述符。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceHandle 服务句柄。 + * @param [in] propertyHandle 特征句柄。 + * @param [in] descriptor SSAP 特征描述符。 + * @retval 执行结果错误码,特征句柄将在 { @ref SsapsAddDescriptorCallback } 中返回。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddDescriptor(uint8_t serverId, uint16_t serviceHandle, uint16_t propertyHandle, + SsapsDescInfo *descriptor); + +/** + * @if Eng + * @brief Add a ssap service. + * @par Description: Add a ssap service. + * @param [in] serverId Server ID. + * @param [in] serviceUuid Service uuid. + * @param [in] isPrimary is primary service or not. + * @param [out] handle service handle. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 添加一个ssap服务。 + * @par Description: 添加一个ssap服务。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceUuid 服务uuid。 + * @param [in] isPrimary 是否是首要服务。 + * @param [out] handle 服务句柄. + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddServiceSync(uint8_t serverId, SleUuid *serviceUuid, bool isPrimary, uint16_t *handle); + +/** + * @if Eng + * @brief Add a ssap property. + * @par Description: Add a ssap property. + * @param [in] serverId Server ID. + * @param [in] serviceHandle Service handle. + * @param [in] property SSAP Properity Info. + * @param [out] handle Properity handle. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 添加一个ssap特征。 + * @par Description: 添加一个ssap特征。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceHandle 服务句柄。 + * @param [in] property SSAP 特征信息。 + * @param [out] handle 特征句柄 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddPropertySync(uint8_t serverId, uint16_t serviceHandle, SsapsPropertyInfo *property, + uint16_t *handle); + +/** + * @if Eng + * @brief Add a ssap property descriptor. + * @par Description: Add a ssap property descriptor. + * @param [in] serverId Server ID. + * @param [in] serviceHandle Service handle. + * @param [in] propertyHandle Properity handle corresponding to the descriptor. + * @param [in] descriptor Properity descriptor. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 添加一个ssap特征描述符。 + * @par Description: 添加一个ssap特征描述符。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceHandle 服务句柄。 + * @param [in] propertyHandle 描述符所在得特征句柄。 + * @param [in] descriptor 特征描述符。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsAddDescriptorSync(uint8_t serverId, uint16_t serviceHandle, uint16_t propertyHandle, + SsapsDescInfo *descriptor); + +/** + * @if Eng + * @brief Start a SSAP service. + * @par Description: Start a SSAP service. + * @param [in] serverId server ID. + * @param [in] serviceHandle service handle. + * @retval error code, the service start result will be returned at { @ref SsapsStartServiceCallback }. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 开始一个SSAP服务。 + * @par Description: 开始一个SSAP服务。 + * @param [in] serverId 服务端 ID。 + * @param [in] serviceHandle 服务句柄。 + * @retval 执行结果错误码,服务开启结果将在 { @ref SsapsStartServiceCallback }中返回。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsStartService(uint8_t serverId, uint16_t serviceHandle); + +/** + * @if Eng + * @brief Delete all SSAP service. + * @par Description: Delete all SSAP service. + * @param [in] serverId server ID. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 删除所有SSAP服务。 + * @par Description: 删除所有SSAP服务。 + * @param [in] serverId 服务端 ID。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsDeleteAllServices(uint8_t serverId); + +/** + * @if Eng + * @brief Send response when receive the request need to response by user. + * @par Description: Send response when receive the request need to response by user + { @ref SsapsReadRequestCallback } { @ref SsapsWriteRequestCallback }. + * @param [in] serverId server ID. + * @param [in] connId connection ID. + * @param [in] param response parameter. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 当收到需要用户回复响应的请求时发送响应。 + * @par Description: 当收到需要用户回复响应的请求时发送响应 + { @ref SsapsReadRequestCallback } { @ref SsapsWriteRequestCallback }。 + * @param [in] serverId 服务端 ID. + * @param [in] connId 连接ID。 + * @param [in] param 响应参数. + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsSendResponse(uint8_t serverId, uint16_t connId, SsapsSendRsp *param); + +/** + * @if Eng + * @brief Send indication or notification to remote device. + * @par Description: Send indication or notification to remote device, + send status depend on character descriptor: client property configuration. + value = 0x0000: notification and indication not allowed + value = 0x0001: notification allowed + value = 0x0002: indication allowed + * @param [in] serverId server ID. + * @param [in] connId connection ID,To send packets to all peer ends, enter connId = 0xffff. + * @param [in] param notify/indicate parameter. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 向对端发送通知或指示。 + * @par Description: 向对端发送通知或指示,具体发送状态取决于特征描述符:客户端特征配置 + value = 0x0000:不允许通知和指示 + value = 0x0001:允许通知 + value = 0x0002:允许指示 + * @param [in] serverId 服务端 ID。 + * @param [in] connId 连接ID,如果向全部对端发送则输入conn_id = 0xffff; + * @param [in] param 通知或指示参数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsNotifyIndicate(uint8_t serverId, uint16_t connId, SsapsNtfInd *param); + +/** + * @if Eng + * @brief Send indication or notification to remote device by uuid. + * @par Description: Send indication or notification to remote device by uuid, + send status depend on client property configuration descriptor value, + value = 0x0000: notification and indication not allowed + value = 0x0001: notification allowed + value = 0x0002: indication allowed + * @param [in] serverId server ID. + * @param [in] connId connection ID,To send packets to all peer ends, enter connId = 0xffff. + * @param [in] param notify/indicate parameter. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 通过uuid向对端发送通知或指示。 + * @par Description: 通过uuid向对端发送通知或指示,具体发送状态取决于客户端特征配置描述符值, + value = 0x0000:不允许通知和指示 + value = 0x0001:允许通知 + value = 0x0002:允许指示 + * @param [in] serverId 服务端 ID。 + * @param [in] connId 连接ID,如果向全部对端发送则输入conn_id = 0xffff; + * @param [in] param 通知或指示参数。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsNotifyIndicateByUuid(uint8_t serverId, uint16_t connId, SsapsNtfIndByUuid *param); + + +/** + * @if Eng + * @brief Set server info before connected. + * @par Description: Set server info before connected. + * @param [in] serverId server ID. + * @param [in] info server info. + * @retval error code. + * @par Depends: + * @li bts_def.h + * @else + * @brief 在连接之前设置服务端info。 + * @par Description: 在连接之前设置服务端info。 + * @param [in] serverId 服务端ID。 + * @param [in] info 服务端info。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li bts_def.h + * @endif + */ +errcode_t SsapsSetInfo(uint8_t serverId, SsapcExchangeInfo *info); + +/** + * @if Eng + * @brief Register SSAP server callbacks. + * @par Description: Register SSAP server callbacks. + * @param [in] func callback function. + * @retval error code. + * @par Depends: + * @li sle_ssap_stru.h + * @else + * @brief 注册 SSAP server 回调函数。 + * @par Description: 注册回调函数。 + * @param [in] func 回调函数 + * @retval 执行结果错误码。 + * @par 依赖: + * @li sle_ssap_stru.h + * @endif + */ +errcode_t SsapsRegisterCallbacks(SsapsCallbacks *func); + +#ifdef __cplusplus +} +#endif +#endif +/** @} */ + diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_stru.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_stru.h new file mode 100755 index 0000000..33cf51e --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/oh_sle_ssap_stru.h @@ -0,0 +1,173 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023. All rights reserved. + * + * Description: SLE Service Access Protocol data struct defination. + */ + +/** + * @defgroup sle_ssap_server Service Access Protocol data struct defination. + * @ingroup SLE + * @{ + */ + +#ifndef OH_SLE_SSAP_STRU_H +#define OH_SLE_SSAP_STRU_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Length of sle UUID. + * @else + * @brief 星闪UUID长度。 + * @endif + */ +#define SLE_UUID_LEN 16 + +/** + * @if Eng + * @brief Enum of write types for ssap clients to write property and descriptor. + * @else + * @brief 定义SSAP client写property和descriptor时的写类型。 + * @endif + */ +typedef enum { + OH_SSAP_WRITE_NO_RSP = 0x01, /*!< @if Eng type of wirte with no server response + @else 只写,且不需要server回复响应 @endif */ + OH_SSAP_WRITE_DEFAULT_WITH_RSP = 0x02, /*!< @if Eng type of wirte with server response + @else 只写,且需要server回复响应 @endif */ +} SsapWriteType; + +/** + * @if Eng + * @brief SSAP attribute permission. + * @else + * @brief SSAP attribute操作权限。 + * @endif + */ +typedef enum { + OH_SSAP_PERMISSION_READ = 0x01, /*!< @if Eng readable + @else 可读 @endif */ + OH_SSAP_PERMISSION_WRITE = 0x02, /*!< @if Eng writable + @else 可写 @endif */ + OH_SSAP_PERMISSION_ENCRYPTION_NEED = 0x04, /*!< @if Eng need encryption + @else 需要加密 @endif */ + OH_SSAP_PERMISSION_AUTHENTICATION_NEED = 0x08, /*!< @if Eng need authentication + @else 需要认证 @endif */ + OH_SSAP_PERMISSION_AUTHORIZATION_NEED = 0x10, /*!< @if Eng need authorization + @else 需要授权 @endif */ +} SsapPermissionType; + +/** + * @if Eng + * @brief SSAP find type. + * @else + * @brief SSAP 查找类型 + * @endif + */ +typedef enum { + OH_SSAP_FIND_TYPE_SERVICE_STRUCTURE = 0x00, /*!< @if Eng service structure + @else 服务结构 @endif */ + OH_SSAP_FIND_TYPE_PRIMARY_SERVICE = 0x01, /*!< @if Eng primary service + @else 首要服务 @endif */ + OH_SSAP_FIND_TYPE_REFERENCE_SERVICE = 0x02, /*!< @if Eng reference service + @else 引用服务 @endif */ + OH_SSAP_FIND_TYPE_PROPERTY = 0x03, /*!< @if Eng property + @else 属性 @endif */ + OH_SSAP_FIND_TYPE_METHOD = 0x04, /*!< @if Eng method + @else 方法 @endif */ + OH_SSAP_FIND_TYPE_EVENT = 0x05, /*!< @if Eng event + @else 事件 @endif */ +} SsapFindType; + +/** + * @if Eng + * @brief SSAP property type. + * @else + * @brief SSAP 特征类型。 + * @endif + */ +typedef enum { + OH_SSAP_PROPERTY_TYPE_VALUE = 0x00, /*!< @if Eng property value + @else 特征值 @endif */ + OH_SSAP_DESCRIPTOR_USER_DESCRIPTION = 0x01, /*!< @if Eng user description descriptor + @else 属性说明描述符 @endif */ + OH_SSAP_DESCRIPTOR_CLIENT_CONFIGURATION = 0x02, /*!< @if Eng client configuration descriptor + @else 客户端配置描述符 @endif */ + OH_SSAP_DESCRIPTOR_SERVER_CONFIGURATION = 0x03, /*!< @if Eng server configuration descriptor + @else 服务端配置描述符 @endif */ + OH_SSAP_DESCRIPTOR_PRESENTATION_FORMAT = 0x04, /*!< @if Eng presentation format descriptor + @else 格式描述符 @endif */ + OH_SSAP_DESCRIPTOR_RFU = 0x05, /*!< @if Eng RFU descriptor, 0x05 – 0x1F + @else 服务管理保留描述符,0x05 – 0x1F @endif */ + OH_SSAP_DESCRIPTOR_CUSTOM = 0xFF, /*!< @if Eng custom descriptor + @else 厂商自定义描述符 @endif */ +} SsapPropertyType; + +/** + * @if Eng + * @brief SSAP operation indication. + * @else + * @brief SSAP 操作指示。 + * @endif + */ +typedef enum { + OH_SSAP_OPERATE_INDICATION_BIT_READ = 0x01, /*!< @if Eng data values can be read + @else 数据值可被读取 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_WRITE_NO_RSP = 0x02, /*!< @if Eng data values can be written without feedback. + @else 数据值可被写入,写入后无反馈 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_WRITE = 0x04, /*!< @if Eng data values can be written. After being + written, a feedback is generated to the client. + @else 数据值可被写入,写入后产生反馈给客户端 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_NOTIFY = 0x08, /*!< @if Eng data value send to client by notification. + @else 数据值通过通知方式传递给客户端 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_INDICATE = 0x10, /*!< @if Eng data value send to client by indication. + @else 数据值通过指示方式传递给客户端 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_BROADCAST = 0x20, /*!< @if Eng data value can be carried in broadcast + @else 数据值可携带在广播中 @endif */ + OH_SSAP_OPERATE_INDICATION_BIT_DESCRITOR_WRITE = 0x100, /*!< @if Eng data value description descriptor can be + written + @else 数据值说明描述符可被写入 @endif */ + OH_SSAP_OPERATE_INDICATION_MAX, /*!< @if Eng maximum of operation indication + @else 操作指示最大值 @endif */ +} SsapOperateIndication; + +/** + * @if Eng + * @brief UUID. + * @else + * @brief 通用唯一识别码。 + * @endif + */ +typedef struct { + uint8_t len; /*!< @if Eng uuid len + @else UUID 长度 @endif */ + uint8_t uuid[SLE_UUID_LEN]; /*!< @if Eng uuid + @else UUID字段 @endif */ +} SleUuid; + +/** + * @if Eng + * @brief Struct of ssap info exchange + * @else + * @brief ssap 信息交换结构体。 + * @endif + */ +typedef struct { + uint32_t mtuSize; /*!< @if Eng mtu size + · @else mtu大小 @endif */ + uint16_t version; /*!< @if Eng version + @else 版本 @endif */ +} SsapcExchangeInfo; + +#ifdef __cplusplus +} +#endif +#endif /* OH_SLE_SSAP_STRU_H */ +/** + * @} + */ diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_def.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_def.h new file mode 100755 index 0000000..7803f87 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_def.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. + * Description: Common definition + */ + +#ifndef OHOS_BT_DEF_H +#define OHOS_BT_DEF_H + +/* Device address length */ +#define OHOS_BD_ADDR_LEN 6 + +/* Bluetooth 16-byte UUID */ +#define OHOS_BLE_UUID_MAX_LEN 16 + +/* Characteristic Properties */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_BROADCAST 0x01 /* Characteristic is broadcastable */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_READ 0x02 /* Characteristic is readable */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP 0x04 /* Characteristic can be written without response */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_WRITE 0x08 /* Characteristic can be written */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_NOTIFY 0x10 /* Characteristic supports notification */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_INDICATE 0x20 /* Characteristic supports indication */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_SIGNED_WRITE 0x40 /* Characteristic supports write with signature */ +#define OHOS_GATT_CHARACTER_PROPERTY_BIT_EXTENDED_PROPERTY 0x80 /* Characteristic has extended properties */ + +/* Attribute permissions */ +#define OHOS_GATT_PERMISSION_READ 0x01 /* read permission */ +#define OHOS_GATT_PERMISSION_READ_ENCRYPTED 0x02 /* Allow encrypted read operations */ +#define OHOS_GATT_PERMISSION_READ_ENCRYPTED_MITM 0x04 /* Allow reading with man-in-the-middle protection */ +#define OHOS_GATT_PERMISSION_WRITE 0x10 /* write permission */ +#define OHOS_GATT_PERMISSION_WRITE_ENCRYPTED 0x20 /* Allow encrypted writes */ +#define OHOS_GATT_PERMISSION_WRITE_ENCRYPTED_MITM 0x40 /* Allow encrypted writes with man-in-the-middle protection */ +#define OHOS_GATT_PERMISSION_WRITE_SIGNED 0x80 /* Allow signed write operations */ +/* Allow signed write operations with man-in-the-middle protection */ +#define OHOS_GATT_PERMISSION_WRITE_SIGNED_MITM = 0x100 + +typedef enum { + OHOS_BT_TRANSPORT_INVALID = 0x00, + OHOS_BT_TRANSPORT_BR_EDR = 0x01, + OHOS_BT_TRANSPORT_LE = 0x02, + OHOS_BT_TRANSPORT_DUAL_MONO = 0x03, +} BtTransportId; + +typedef enum { + OHOS_BT_STATUS_SUCCESS, + OHOS_BT_STATUS_FAIL, + OHOS_BT_STATUS_NOT_READY, + OHOS_BT_STATUS_NOMEM, + OHOS_BT_STATUS_BUSY, + OHOS_BT_STATUS_DONE, + OHOS_BT_STATUS_UNSUPPORTED, + OHOS_BT_STATUS_PARM_INVALID, + OHOS_BT_STATUS_UNHANDLED, + OHOS_BT_STATUS_AUTH_FAILURE, + OHOS_BT_STATUS_RMT_DEV_DOWN, + OHOS_BT_STATUS_AUTH_REJECTED +} BtStatus; + +/* Error Code, BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 3, Part F, table 3.4 */ +typedef enum { + OHOS_GATT_SUCCESS = 0x00, + OHOS_GATT_INVALID_HANDLE = 0x01, + OHOS_GATT_READ_NOT_PERMITTED = 0x02, + OHOS_GATT_WRITE_NOT_PERMITTED = 0x03, + OHOS_GATT_INVALID_PDU = 0x04, + OHOS_GATT_INSUFFICIENT_AUTHENTICATION = 0x05, + OHOS_GATT_REQUEST_NOT_SUPPORTED = 0x06, + OHOS_GATT_INVALID_OFFSET = 0x07, + OHOS_GATT_INSUFFICIENT_AUTHORIZATION = 0x08, + OHOS_GATT_PREPARE_QUEUE_FULL = 0x09, + OHOS_GATT_ATTRIBUTE_NOT_FOUND = 0x0A, + OHOS_GATT_ATTRIBUTE_NOT_LONG = 0x0B, + OHOS_GATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE = 0x0C, + OHOS_GATT_INVALID_ATTRIBUTE_VALUE_LENGTH = 0x0D, + OHOS_GATT_UNLIKELY_ERROR = 0x0E, + OHOS_GATT_INSUFFICIENT_ENCRYPTION = 0x0F, + OHOS_GATT_UNSUPPORTED_GROUP_TYPE = 0x10, + OHOS_GATT_INSUFFICIENT_RESOURCES = 0x11, + OHOS_GATT_DATABASE_OUT_OF_SYNC = 0x12, + OHOS_GATT_VALUE_NOT_ALLOWED = 0x13, +} GattStatus; + +typedef enum { + OHOS_BLE_ATTRIB_TYPE_SERVICE = 0x00, + OHOS_BLE_ATTRIB_TYPE_CHAR, + OHOS_BLE_ATTRIB_TYPE_CHAR_VALUE, + OHOS_BLE_ATTRIB_TYPE_CHAR_CLIENT_CONFIG, + OHOS_BLE_ATTRIB_TYPE_CHAR_USER_DESCR, +} BleAttribType; + +typedef enum { + OHOS_UUID_TYPE_NULL = 0x00, + OHOS_UUID_TYPE_16_BIT, + OHOS_UUID_TYPE_32_BIT, + OHOS_UUID_TYPE_128_BIT, +} UuidType; + +typedef enum { + OHOS_GATT_AUTH_REQ_NONE = 0x00, + OHOS_GATT_AUTH_REQ_NO_MITM = 0x01, /* unauthenticated encryption */ + OHOS_GATT_AUTH_REQ_MITM = 0x02, /* authenticated encryption */ + OHOS_GATT_AUTH_REQ_SIGNED_NO_MITM = 0x03, + OHOS_GATT_AUTH_REQ_SIGNED_MITM = 0x04 +} BtGattAuthReq; + +typedef enum { + OHOS_GATT_WRITE_NO_RSP = 0x01, /* Write only. "Write Command" */ + OHOS_GATT_WRITE_DEFAULT = 0x02, /* Write and need response from remote device. "Write Request" */ + OHOS_GATT_WRITE_PREPARE = 0x03, /* Request the server to prepare to write the value. "Prepare Write" */ + OHOS_GATT_WRITE_SIGNED = 0x04 /* Write including authentication signature. "Signed Write Command" */ +} BtGattWriteType; + +/** + * @brief Profile的连接状态 + * + * @since 3 + */ +typedef enum { + /** 正在连接 */ + OHOS_PROFILE_STATE_CONNECTING = 0x01, + /** 已连接 */ + OHOS_PROFILE_STATE_CONNECTED = 0x02, + /** 正在断连 */ + OHOS_PROFILE_STATE_DISCONNECTING = 0x03, + /** 已断连 */ + OHOS_PROFILE_STATE_DISCONNECTED = 0x04 +} BtProfileConnectState; + +/** + * @brief 设置连接策略 + * + * @since 3 + */ +typedef enum { + /** 未知 */ + OHOS_CONNECTION_UNKNOWN = 0x00, + /** 允许连接 */ + OHOS_CONNECTION_ALLOWED, + /** 禁止连接 */ + OHOS_CONNECTION_FORBIDDEN +} BtConnectStrategyType; + +/** + * @brief 定义设备的媒体播放状态 + * + * @since 3 + */ +typedef enum { + /** 未播放 */ + OHOS_A2DP_NOT_PLAYING = 0x00, + /** 正在播放 */ + OHOS_A2DP_IS_PLAYING +} BtA2dpPlayingState; + +typedef enum { + OHOS_STATE_CONNECTING = 0x00, + OHOS_STATE_CONNECTED, + OHOS_STATE_DISCONNECTING, + OHOS_STATE_DISCONNECTED, +} BtConnectState; +/* Device address */ +typedef struct { + unsigned char addr[OHOS_BD_ADDR_LEN]; +} BdAddr; + +/* uuid with len */ +typedef struct { + unsigned char uuidLen; + char *uuid; +} BtUuid; +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gap.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gap.h new file mode 100755 index 0000000..bf1cef8 --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gap.h @@ -0,0 +1,370 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. + * Description: ohos 蓝牙gap相关宏与接口定义 + */ +#ifndef OHOS_BT_GAP_H +#define OHOS_BT_GAP_H + +#include "ohos_bt_def.h" + +#define SERVICE_LIMITED_DISCOVERABILITY 0x002000 +#define SERVICE_POSITIONING 0x010000 +#define SERVICE_NETWORKING 0x020000 +#define SERVICE_RENDER 0x040000 +#define SERVICE_CAPTURE 0x080000 +#define SERVICE_OBJECT_TRANSFER 0x100000 +#define SERVICE_AUDIO 0x200000 +#define SERVICE_TELEPHONY 0x400000 +#define SERVICE_INFORMATION 0x800000 + +#define OHOS_BD_NAME_LEN 32 +typedef struct { + BdAddr addr; + unsigned char deviceName[OHOS_BD_NAME_LEN]; /* Name of the device record, must be in UTF-8 */ +} PairedDeviceInfo; + +/* Bluetooth stack state */ +typedef enum { + OHOS_GAP_STATE_TURNING_ON = 0x0, + OHOS_GAP_STATE_TURN_ON, + OHOS_GAP_STATE_TURNING_OFF, + OHOS_GAP_STATE_TURN_OFF +} BtStackState; + +/* Bluetooth ACL connection state */ +typedef enum { + OHOS_GAP_ACL_STATE_CONNECTED, + OHOS_GAP_ACL_STATE_DISCONNECTED, + OHOS_GAP_ACL_STATE_LE_CONNECTED, + OHOS_GAP_ACL_STATE_LE_DISCONNECTED +} GapAclState; + +/* bondable mode */ +typedef enum { + OHOS_GAP_BONDABLE_MODE_OFF = 0x00, + OHOS_GAP_BONDABLE_MODE_ON = 0x01 +} GapBtBondableMode; + +typedef enum { + OHOS_GAP_ACCESS_UNKNOWN, + OHOS_GAP_ACCESS_ALLOWED, + OHOS_GAP_ACCESS_FORBIDDEN, +} GapBtPermissionType; + +typedef enum { + OHOS_GAP_SCAN_MODE_NONE = 0x00, + OHOS_GAP_SCAN_MODE_CONNECTABLE, + OHOS_GAP_SCAN_MODE_GENERAL_DISCOVERABLE, + OHOS_GAP_SCAN_MODE_LIMITED_DISCOVERABLE, + OHOS_GAP_SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, + OHOS_GAP_SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE +} GapBtScanMode; + +typedef enum { + OHOS_PROFILE_HEADSET = 0x0, + OHOS_PROFILE_A2DP, + OHOS_PROFILE_OPP, + OHOS_PROFILE_HID, + OHOS_PROFILE_PANU, + OHOS_PROFILE_NAP, + OHOS_PROFILE_HFP +} GapBtProfileType; + +typedef enum { + OHOS_GAP_PAIR_NONE = 0x01, + OHOS_GAP_PAIR_PAIRING = 0x02, + OHOS_GAP_PAIR_PAIRED = 0x03 +} GapBtPairedState; + +bool EnableBle(void); + +bool DisableBle(void); + +bool EnableBt(void); + +bool DisableBt(void); + +/** + * @brief Get local host bluetooth address + * @return @c Local host bluetooth address + */ +BdAddr* GetLocalAddress(void); + +/** + * @brief Get local host bluetooth name + * @param localName actual receiving device name + length - localName length, initail set length to zero, and call this func to set real length + * @return Local host bluetooth name + */ +bool GetLocalName(unsigned char *localName, unsigned char *length); + +/** + * @brief Set local device name. + * @param localName Device name. + length device name length + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool SetLocalName(unsigned char *localName, unsigned char length); + +/** + * @brief Factory reset bluetooth service. + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool BluetoothFactoryReset(void); + +/** + * @brief Set device scan mode. + * @param mode Scan mode. + * @param duration Scan time, see details {@link GapBtScanMode} + * @return special mode + */ +int GetBtScanMode(void); + +/** + * @brief Set device scan mode. + * @param mode Scan mode, see details {@link GapBtScanMode}. + * @param duration Scan time. + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool SetBtScanMode(int mode, int duration); + +/* + * @brief Get paired devices. + * @param pairList - 按照maxPairNums申请的设备列表数组 + maxPairNums - 指定需要获取的设备列表最大个数 + realPairNums - 实际的配对设备列表个数 + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool GetPariedDevicesNum(unsigned int *number); + +bool GetPairedDevicesList(PairedDeviceInfo *devInfo, int *number); + +bool GetRemoteDevName(PairedDeviceInfo *devInfo); + +/** + * @brief Get device pair state. + * @param device Remote device. + * @return Returns device pair state. see detail {@link GapBtPairedState} + */ +int GetPairState(void); + +/** + * @brief Remove pair. + * @param BdAddr Remote device address. + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool RemovePair(const BdAddr addr); + +/** + * @brief Remove all pairs. + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool RemoveAllPairs(void); + +/** + * @brief Read remote device rssi value. + * + * @param bdAddr device address. + * @param transport Transport type, details see {@link BtTransportId} + * @return Returns true if the operation is successful; + * returns false if the operation fails. + */ +bool ReadRemoteRssiValue(const BdAddr *bdAddr, int transport); + +/** + * @brief Check if device acl connected. + * @param addr device address. + * @return Returns true if device acl connected; + * returns false if device does not acl connect. + */ +bool IsAclConnected(BdAddr *addr); + +/** + * @brief disconnect remote device all profile. + * @param addr device address. + * @return Returns true if device acl connected; + * returns false if device does not acl connect. + */ +bool DisconnectRemoteDevice(BdAddr *addr); + +/* + * @brief connect remote device acl profile. + * @param: remote device address + * @return Returns true if device acl connected; + * returns false if device does not acl connect. + */ +bool ConnectRemoteDevice(BdAddr *addr); + +/** + * @brief Adapter state change function. 开关蓝牙的callback上报 + * @param transport Transport type when state change. + * OHOS_BT_TRANSPORT_BR_EDR : classic; + * OHOS_BT_TRANSPORT_LE : ble. + * detail see {@link BtTransportId} + * @param state Change to the new state + * details see {@link BtStackState}. + */ +typedef void (*GapStateChangedCallback)(const int transport, const int status); + +/** + * @brief ACL state change callback + * @param BtGapAclState - details of acl state changed + * @param reason - clarify detals of REASON CODE from stack - If possible, suggest using the standard HCI error code. + * @return void + */ +typedef void (*GapAclStateChangedCallback)(const BdAddr *bdAddr, GapAclState state, unsigned int reason); + +/** + * @brief Discovery state changed observer. + * @param status DISCOVERY_STARTED/DISCOVERYING/DISCOVERY_STOPED + * @return void + */ +typedef void (*GapDiscoveryStateChangedCallback)(int status); + +/** + * @brief Discovery state changed observer. + * @param status Device discovery status. + * @return void + */ +typedef void (*GapDiscoveryResultCallback)(const BdAddr *bdAddr); + +/** + * @brief Pair request observer. + * @param bdAddr Remote device address. + * @return void + */ +typedef void (*GapPairRequestedCallback)(const BdAddr *bdAddr); + +/** + * @brief Pair confirmed observer. + * @param BdAddr Remote device address. + * @param reqType Pair type. + * @param number Paired passkey. + * @return void + */ +typedef void (*GapPairConfirmedCallback)(const BdAddr *bdAddr, int reqType, int number); + +/** + * @brief Scan mode changed observer. + * @param mode Device scan mode. + * @return void + */ +typedef void (*GapScanModeChangedCallback)(int mode); + +/** + * @brief Device name changed observer. + * @param deviceName Device name. + * @return void + */ +typedef void (*GapLocalDeviceNameChangedCallback)(const unsigned char *deviceName, unsigned char length); + +/** + * @brief Device address changed observer. + * @param bdAddr Device address. + * @return void + */ +typedef void (*GapLocalDeviceAddrChangedCallback)(const BdAddr *bdAddr); + +/** + * @brief Pair status changed observer. + * @param bdAddr Device address. + * @param status Remote device pair status. + * @return void + */ +typedef void (*GapPairStatusChangedCallback)(const BdAddr *bdAddr, int status); + +/** + * @brief Remote uuid changed observer. + * @param bdAddr Device address. + * @param uuid Remote device uuids. + * @return void + */ +typedef void (*GapRemoteUuidChangedCallback)(const BdAddr *bdAddr, BtUuid uuid); + +/** + * @brief Remote name changed observer. + * @param bdAddr Device address. + * @param deviceName Remote device name. + * @return void + */ +typedef void (*GapRemoteNameChangedCallback)(const BdAddr *bdAddr, + const unsigned char *deviceName, unsigned char length); + +/** + * @brief Remote alias changed observer. + * @param bdAddr Device address. + * @param alias Remote device alias. + * @return void + */ +typedef void (*GapRemoteAliasChangedCallback)(const BdAddr *bdAddr, const unsigned char *alias, unsigned char length); + +/** + * @brief Remote cod changed observer. + * @param bdAddr Device address. + * @param cod Remote device cod. + * @return void + */ +typedef void (*GapRemoteCodChangedCallback)(const BdAddr *bdAddr, int cod); + +/** + * @brief Remote battery level changed observer. + * @param bdAddr Device address. + * @param cod Remote device battery Level. + * @return void + */ +typedef void (*GapRemoteBatteryLevelChangedCallback)(const BdAddr *bdAddr, int batteryLevel); + +/** + * @brief Remote rssi event observer. + * @param bdAddr Device address. + * @param rssi Remote device rssi. + * @param status Read status. + * @return void + */ +typedef void (*GapReadRemoteRssiEventCallback)(const BdAddr *bdAddr, int rssi, int status); + +/** + * @brief Query application whether to accept the connection. + * @param bdAddr Device address. + * @param res Application decision, 0 is reject, 1 is accept. + * @return void + */ +typedef void (*GapIsAcceptConnOnSafeModeCallback)(const BdAddr *bdAddr, bool *res); + +/** + * @brief GAP回调函数接口定义 + */ +typedef struct { + GapStateChangedCallback stateChangeCallback; + GapAclStateChangedCallback aclStateChangedCallbak; + GapScanModeChangedCallback scanModeChangedCallback; + GapPairStatusChangedCallback pairStatusChangedCallback; + GapLocalDeviceNameChangedCallback deviceNameChangedCallback; + GapLocalDeviceAddrChangedCallback deviceAddrChangedCallback; + GapPairRequestedCallback pairRequestedCallback; + GapPairConfirmedCallback pairConfiremedCallback; + GapDiscoveryStateChangedCallback discoveryStateChangedCallback; + GapDiscoveryResultCallback discoveryResultCallback; + GapRemoteUuidChangedCallback remoteUuidChangedCallback; + GapRemoteNameChangedCallback remoteNameChangedCallback; + GapRemoteAliasChangedCallback remoteAliasChangedCallback; + GapRemoteCodChangedCallback remoteCodChangedCallback; + GapRemoteBatteryLevelChangedCallback remoteBatteryLevelChangedCallback; + GapReadRemoteRssiEventCallback readRemoteRssiEventCallback; + GapIsAcceptConnOnSafeModeCallback isAcceptConnOnSafeModeCallback; +} BtGapCallBacks; + +/** + * @brief 注册GAP回调函数。 + * @param func 回调函数原型,参考{@link BtGapCallBacks}。 + * @return 成功返回{@link OHOS_BT_STATUS_SUCCESS},失败返回错误码,具体错误码含义参考{@link BtStatus}定义 + */ +int GapRegisterCallbacks(BtGapCallBacks *func); + +#endif \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt.h new file mode 100755 index 0000000..628e16e --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt.h @@ -0,0 +1,478 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. + * Description: GATT interfaces + */ + +#ifndef OHOS_BT_GATT_H +#define OHOS_BT_GATT_H + +#include "ohos_bt_def.h" + +/* e.g. Legacy SCAN_RSP to an ADV_IND, 0x1B + OHOS_BLE_EVT_TYPE_LEGACY_ADV | OHOS_BLE_EVT_TYPE_SCAN_RESPONSE | OHOS_BLE_EVT_TYPE_SCANNABLE_ADV | */ + +#define OHOS_BLE_EVT_TYPE_CONNECTABLE_ADV 0x01 /* bit[0] */ +#define OHOS_BLE_EVT_TYPE_SCANNABLE_ADV 0x02 /* bit[1] */ +#define OHOS_BLE_EVT_TYPE_DIRECTED_ADV 0x04 /* bit[2] */ +#define OHOS_BLE_EVT_TYPE_SCAN_RESPONSE 0x08 /* bit[3] */ +#define OHOS_BLE_EVT_TYPE_LEGACY_ADV 0x10 /* bit[4] */ +#define OHOS_BLE_EVT_TYPE_DATA_STATUS_COMPLETE 0x00 /* bit[6:5] , 0b00:Complete */ +#define OHOS_BLE_EVT_TYPE_DATA_STATUS_INCOMPLETE 0x20 /* bit[6:5], 0b01:Incomplete, more data to come */ +/* bit[6:5], 0b10:Incomplete,data truncated, no more to come */ +#define OHOS_BLE_EVT_TYPE_DATA_STATUS_INCOMPLETE_TRUNCATED 0x40 + +typedef enum { + OHOS_BLE_ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY = 0x00, + OHOS_BLE_ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY = 0x01, + OHOS_BLE_ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST = 0x02, + OHOS_BLE_ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST = 0x03, +} BleAdvFilter; + +/* BLUETOOTH CORE SPECIFICATION Version 5.2|Vol4,Part E, "HCI_LE_Set_Advertising_Parameters" */ +typedef enum { + OHOS_BLE_ADV_IND = 0x00, /* Connectable and scannable undirected advertising (default) */ + OHOS_BLE_ADV_DIRECT_IND_HIGH = 0x01, /* Connectable high duty cycle directed advertising */ + OHOS_BLE_ADV_SCAN_IND = 0x02, /* Scannable undirected advertising */ + OHOS_BLE_ADV_NONCONN_IND = 0x03, /* Non connectable undirected advertising */ + OHOS_BLE_ADV_DIRECT_IND_LOW = 0x04, /* Connectable low duty cycle directed advertising */ +} BleAdvType; + +/* Local IO capability, shall be the same value defined in HCI Specification. */ +typedef enum { + OHOS_BLE_IO_CAP_OUT = 0x00, /* DisplayOnly */ + OHOS_BLE_IO_CAP_IO, /* DisplayYesNo */ + OHOS_BLE_IO_CAP_IN, /* KeyboardOnly */ + OHOS_BLE_IO_CAP_NONE, /* NoInputNoOutput */ + OHOS_BLE_IO_CAP_KBDISP, /* Keyboard display */ +} BleIoCapMode; + +typedef enum { + OHOS_BLE_AUTH_NO_BOND = 0x00, + OHOS_BLE_AUTH_BOND, + OHOS_BLE_AUTH_REQ_MITM, + OHOS_BLE_AUTH_REQ_SC_ONLY, + OHOS_BLE_AUTH_REQ_SC_BOND, + OHOS_BLE_AUTH_REQ_SC_MITM, + OHOS_BLE_AUTH_REQ_SC_MITM_BOND +} BleAuthReqMode; + +typedef enum { + OHOS_BLE_FILTER_ACTION_ADD = 0x00, + OHOS_BLE_FILTER_ACTION_DELETE, + OHOS_BLE_FILTER_ACTION_CLEAR +} BleFilterActionType; + +typedef enum { + OHOS_BLE_ADV_ADDRESS_FILTER_MASK = 0x01, + OHOS_BLE_SERVICE_DATA_CHANGE_FILTER_MASK = 0x02, + OHOS_BLE_SERVICE_UUID_CHECK_MASK = 0x04, + OHOS_BLE_SERVICE_SOLICITATION_UUID_CHECK_MASK = 0x08, + OHOS_BLE_LOCAL_NAME_CHECK_MASK = 0x10, + OHOS_BLE_MANUFACTURER_DATA_CHECK_MASK = 0x20, + OHOS_BLE_SERVICE_DATA_CHECK_MASK = 0x40 +} BleFilterSelectMask; + +typedef enum { + OHOS_BLE_FILTER_LOGIC_OR = 0x00, + OHOS_BLE_FILTER_LOGIC_AND +} BleFilterLogicType; + +typedef enum { + OHOS_BLE_FILTER_IMMEDIATE_MODE = 0x00, + OHOS_BLE_FILTER_ON_FOUND_MODE, + OHOS_BLE_FILTER_BATCHED_MODE +} BleFilterDeliveryMode; + +typedef enum { + OHOS_BLE_ADV_ADDRESS_FILTER = 0x00, + OHOS_BLE_SERVICE_DATA_CHANGE_FILTER, + OHOS_BLE_SERVICE_UUID_CHECK_FILTER, + OHOS_BLE_SERVICE_SOLICITATION_UUID_CHECK_FILTER, + OHOS_BLE_LOCAL_NAME_CHECK_FILTER, + OHOS_BLE_MANUFACTURER_DATA_CHECK_FILTER, + OHOS_BLE_SERVICE_DATA_CHECK_FILTER +} BleFilterSelectType; + +typedef enum { + OHOS_BLE_FILTER_PUBLIC_ADDR = 0x00, + OHOS_BLE_FILTER_RANDOM_ADDR +} BleFilterAddrType; + +/* Ble scan type */ +typedef enum { + OHOS_BLE_SCAN_TYPE_PASSIVE = 0x00, /* Passive Scanning. No scan request PDUs shall be sent. */ + OHOS_BLE_SCAN_TYPE_ACTIVE, /* Active Scanning. Scan request PDUs may be sent. */ +} BleScanType; + +/* Scan filter policy, possible values of BleScanParams::scanFilterPolicy + 0-Accept all advertisement packets except directed advertising packets not addressed to this device (default); + 1-Accept only advertisement packets from devices where the advertiser's address is in the White list. + Directed advertising packets which are not addressed for this device shall be ignored; + 2-Accept all undirected advertisement packets, and all directed advertising packets where the initiator address + is a resolvable private address, and all directed advertising packets addressed to this device; + 3-Accept all undirected advertisement packets from devices where the advertiser's address is in the White list, + and all directed advertising packets where the initiator address is a resolvable private address, and all + directed advertising packets addressed to this device. */ +typedef enum { + OHOS_BLE_SCAN_FILTER_POLICY_ACCEPT_ALL = 0x00, + OHOS_BLE_SCAN_FILTER_POLICY_ONLY_WHITE_LIST, + OHOS_BLE_SCAN_FILTER_POLICY_ACCEPT_ALL_AND_RPA, + OHOS_BLE_SCAN_FILTER_POLICY_ONLY_WHITE_LIST_AND_RPA +} BleScanFilterPolicy; + +/* Extended Advertising Event Type, possible values of BtScanResultData::eventType */ +typedef enum { + OHOS_BLE_EVT_NON_CONNECTABLE_NON_SCANNABLE = 0x00, /* Extended Non-Connectable and Non-Scannable undirected */ + OHOS_BLE_EVT_NON_CONNECTABLE_NON_SCANNABLE_DIRECTED = 0x04, /* Extended NonConnectable and NonScannable directed */ + OHOS_BLE_EVT_CONNECTABLE = 0x01, /* Extended Connectable undirected */ + OHOS_BLE_EVT_CONNECTABLE_DIRECTED = 0x05, /* Extended Connectable directed */ + OHOS_BLE_EVT_SCANNABLE = 0x02, /* Extended Scannable undirected */ + OHOS_BLE_EVT_SCANNABLE_DIRECTED = 0x06, /* Extended Scannable directed */ + + OHOS_BLE_EVT_LEGACY_NON_CONNECTABLE = 0x10, /* Legacy Non-Connectable undirected, ADV_NONCONN_IND */ + OHOS_BLE_EVT_LEGACY_SCANNABLE = 0x12, /* Legacy Scannable undirected, ADV_SCAN_IND */ + OHOS_BLE_EVT_LEGACY_CONNECTABLE = 0x13, /* Legacy Connectable & Scannable undirected, ADV_IND */ + OHOS_BLE_EVT_LEGACY_CONNECTABLE_DIRECTED = 0x15, /* Legacy Connectable directed, ADV_DIRECT_IND */ + OHOS_BLE_EVT_LEGACY_SCAN_RSP_TO_ADV_SCAN = 0x1A, /* Legacy SCAN_RSP to an ADV_SCAN_IND */ + OHOS_BLE_EVT_LEGACY_SCAN_RSP_TO_ADV = 0x1B, /* Legacy SCAN_RSP to an ADV_IND */ +} BleScanResultEvtType; + +/* Extended Advertising Data Status, possible values of BtScanResultData::dataStatus */ +typedef enum { + OHOS_BLE_DATA_COMPLETE = 0x00, /* Complete data or final trunck */ + OHOS_BLE_DATA_INCOMPLETE_MORE_TO_COME = 0x01, /* Incomplete data, more data to come */ + OHOS_BLE_DATA_INCOMPLETE_TRUNCATED = 0x02, /* Incomplete data, truncated, no more data to come */ +} BleScanResultDataStatus; + +/* Addr type of scan result, possible values of BtScanResultData::addrType */ +typedef enum { + OHOS_BLE_PUBLIC_DEVICE_ADDRESS = 0x00, /* Public Device Address */ + OHOS_BLE_RANDOM_DEVICE_ADDRESS = 0x01, /* Random Device Address */ + OHOS_BLE_PUBLIC_IDENTITY_ADDRESS = 0x02, /* Public Identity Address (corresponds to Resolved Private Address) */ + /* Random (static) Identity Address (corresponds to Resolved Private Address) */ + OHOS_BLE_RANDOM_STATIC_IDENTITY_ADDRESS = 0x03, + OHOS_BLE_UNRESOLVABLE_RANDOM_DEVICE_ADDRESS = 0xFE, + OHOS_BLE_NO_ADDRESS = 0xFF, /* No address provided (anonymous advertisement) */ +} BleScanResultAddrType; + +/** + * @brief BLE扫描结果PHY类型 + * + * @since 3 + */ +typedef enum { + /** 无广播包 */ + OHOS_BLE_SCAN_PHY_NO_PACKET = 0x00, + /** 1M PHY */ + OHOS_BLE_SCAN_PHY_1M = 0x01, + /** 2M PHY */ + OHOS_BLE_SCAN_PHY_2M = 0x02, + /** Coded PHY */ + OHOS_BLE_SCAN_PHY_CODED = 0x03 +} BleScanResultPhyType; + +/** + * @brief 设置BLE广播/扫描响应数据 + * + * @since 3 + */ +typedef struct { + unsigned short advLength; + char *advData; /* advertising data */ + unsigned short scanRspLength; + char *scanRspData; /* scan response data */ +} BleConfigAdvData; + +typedef struct { + /* Minimum advertising interval for undirected and low duty cycle directed advertising. [N * 0.625ms] */ + int minInterval; + /* Maximum advertising interval for undirected and low duty cycle directed advertising. [N * 0.625ms] */ + int maxInterval; + BleAdvType advType; + unsigned char ownAddrType; /* Ref. Core spec Version 5.2|Vol 4,Part E, HCI_LE_Set_Advertising_Parameters */ + unsigned char peerAddrType; /* Ref. Core spec Version 5.2|Vol 4,Part E, HCI_LE_Set_Advertising_Parameters */ + BdAddr peerAddr; + int channelMap; /* channel used bit map, bit[0:2]->[37,38,39]. e.g. 0x01-only 37 used, 0x07-all used */ + BleAdvFilter advFilterPolicy; + int txPower; /* dbm */ + int duration; /* duration for sending BLE ADV. [N * 10 ms] */ +} BleAdvParams; + +/* used to add or delete a filter specification or clear a filter list for onchip filtering */ +typedef struct { + unsigned char clientId; /* APP identifier */ + unsigned char action; /* BleFilterActionType, [0->add,1->delte,2->clear] */ + unsigned char filtIndex; /* Filter index 0 ~ max_filter */ + unsigned int featureSelection; /* BleFilterSelectMask, Bit masks for the selected features */ + unsigned int listLogicType; /* BleFilterLogicType, Logic operation for each feature selected in featureSelection */ + unsigned char filtLogicType; /* BleFilterLogicType */ + unsigned char rssiHighThres; /* [In dBm] ignore the advertiser if the signal is lower than rssiHighThres */ + unsigned char rssiLowThres; /* Valid only if delivery_mode is on_found [in dBm] */ + unsigned char deliveryMode; /* BleFilterDeliveryMode */ + /* Time for firmware to linger and collect additional advertisements before reporting. + (Valid only if deliveryMode is on_found)[in milliseconds] */ + unsigned int onFoundTimeout; + /* If an advertisement, after being found, is not seen contiguously for the lost_timeout period, + it will be reported lost. (Valid only if deliveryMode is on_found)[in milliseconds] */ + unsigned int onLostTimeout; + /* If an advertisement in onFound lingers in firmware for the onfound_timeout duration, + it will collect a few advertisements and the count is checked. If the count exceeds onFoundTimeoutCnt, + it's reported OnFound, immediately thereafter. Valid only if deliveryMode is on_found [count] */ + unsigned char onFoundTimeoutCnt; + /* Total number of advertisers to track per filter. Valid only if delivery_mode is on_found [count] */ + unsigned int numOfTrackingEntries; +} BleAdvScanFilterParam; + +typedef struct { + unsigned char clientId; /* APP identifier */ + unsigned char action; /* BleFilterActionType, [0->add, 1->delte, 2->clear] */ + unsigned char filtType; /* BleFilterSelectType */ + unsigned char filtIndex; /* filter index */ + int manufacturerId; /* manufacturer id */ + int manufacturerIdMask; /* the mask of manufacturer id */ + BtUuid *uuid; /* uuid, 128bit */ + BtUuid *uuidMask; /* mask of 128bit uuid */ + BdAddr *bdAddr; /* address, e.g. "AA:BB:CC:DD:EE:FF" */ + unsigned char addrType; /* BleFilterAddrType, [0->public, 1->random] */ + unsigned int dataLen; /* length of value */ + char *data; /* value */ + unsigned int maskLen; /* length of mask */ + char mask; /* mask */ +} BleAdvScanFilterCondition; + +/* BLE scan parameter */ +typedef struct { + /* Time interval from when the Controller started its last scan until it begins the subsequent scan. + [N=0xXX] Time = N * 0.625 ms */ + unsigned short scanInterval; + /* Duration of the scan on the primary advertising physical channel. [N=0xXX] Time = N * 0.625 ms */ + unsigned short scanWindow; + unsigned char scanType; /* one of BleScanType, [0->Passive, 1->Active] */ + unsigned char scanPhy; /* [0->LE 1M phy, 1->LE 2M phy, 2->LE Coded phy] */ + unsigned char scanFilterPolicy; /* one of BleScanFilterPolicy */ +} BleScanParams; + +typedef struct { + unsigned char *advData; + unsigned int advDataLen; + unsigned char *rspData; + unsigned int rspDataLen; +} StartAdvRawData; + +typedef struct { + unsigned char eventType; /* Advertising event type, one of BleScanResultEvtType */ + unsigned char dataStatus; /* Data status, one of BleScanResultDataStatus */ + unsigned char addrType; /* one of BleScanResultAddrType, except 0xFE */ + BdAddr addr; + unsigned char primaryPhy; /* 0x01->LE 1M phy, 0x03->LE Coded phy */ + unsigned char secondaryPhy; /* 0x00->No packets, 0x01->LE 1M phy, 0x02->LE 2M phy, 0x03->LE Coded phy */ + /* Value of the Advertising SID subfield in the ADI field of the PDU or, for scan responses, + in the ADI field of the original scannable advertisement, 0xFF->No ADI field provided */ + unsigned char advSid; + char txPower; /* Range: -127 to +20dBm, 0x7F->Tx Power information not available */ + char rssi; /* Range: -127 to +20dBm, 0x7F->RSSI is not available */ + /* Interval of the periodic advertising, Time = N * 1.25 ms, 0x0000->No periodic advertising */ + unsigned short periodicAdvInterval; + unsigned char directAddrType; /* one of BleScanResultAddrType, except 0xFF */ + BdAddr directAddr; /* TargetA address for directed advertising event only */ + unsigned char advLen; + unsigned char *advData; +} BtScanResultData; + +/* Callback invoked when start adv operation has completed */ +typedef void (*AdvEnableCallback)(int advId, int status); + +/* Callback invoked when stop adv operation has completed */ +typedef void (*AdvDisableCallback)(int advId, int status); + +/* Callback invoked when adv instance data set operation has completed */ +typedef void (*AdvDataCallback)(int advId, int status); + +/* Callback invoked when adv param update operation has completed */ +typedef void (*AdvUpdateCallback)(int advId, int status); + +/* Callback invoked when security response operation has completed */ +typedef void (*SecurityRespondCallback)(const BdAddr *bdAddr); + +/* Callback for scan results */ +typedef void (*ScanResultCallback)(BtScanResultData *scanResultdata); + +/* Callback invoked when a scan filter enable/disable has completed */ +typedef void (*ScanFilterStatusCallback)(int enable, int clientId, int status); + +/* Callback invoked when a scan filter configuration command has completed */ +typedef void (*ScanFilterCfgCallback)(int action, int clientId, int status, int filtType, int avblSpace); + +/* Callback invoked when a scan filter param setup has completed */ +typedef void (*ScanFilterParamCallback)(int action, int clientId, int status, int avblSpace); + +/* Callback invoked when scan parameter set has completed */ +typedef void (*ScanParameterSetCompletedCallback)(int clientId, int status); + +typedef struct { + AdvEnableCallback advEnableCb; /* start adv */ + AdvDisableCallback advDisableCb; /* stop adv */ + AdvDataCallback advDataCb; + AdvUpdateCallback advUpdateCb; /* update adv */ + SecurityRespondCallback securityRespondCb; + ScanResultCallback scanResultCb; + ScanFilterCfgCallback scanFilterCfgCb; + ScanFilterParamCallback scanFilterParamCb; + ScanFilterStatusCallback scanFilterStatusCb; + ScanParameterSetCompletedCallback scanParamSetCb; +} BtGattCallbacks; + +/* + * @brief Initialize the Bluetooth protocol stack + * @param[in] void + * @return 0-success, other-fail + */ +int InitBtStack(void); + +/* + * @brief Bluetooth protocol stack enable + * @param[in] void + * @return 0-success, other-fail + */ +int EnableBtStack(void); + +/* + * @brief Bluetooth protocol stack disable + * @param[in] void + * @return 0-success, other-fail + */ +int DisableBtStack(void); + +/* + * @brief set this device's name for friendly + * @param[in] device name + * @param[in] length + * @return 0-success, other-fail + */ +int SetDeviceName(const char *name, unsigned int len); + +/* + * @brief set advertising data + * @param[in] specified by upper layer + * @param[in] adv data or scan response + * @return 0-success, other-fail + */ +int BleSetAdvData(int advId, const BleConfigAdvData *data); + +/* + * @brief start ble advertising + * @param[in] specified by upper layer + * @param[in] ble advertising param list + * @return 0-success, other-fail + */ +int BleStartAdv(int advId, const BleAdvParams *param); + +/* + * @brief stop ble advertising + * @param[in] specified by upper layer + * @return 0-success, other-fail + */ +int BleStopAdv(int advId); + +/* + * @Update the parameters as per spec, user manual specified values and restart multi ADV + * @param[in] specified by upper layer + * @param[in] ble advertising param list + * @return 0-success, other-fail + */ +int BleUpdateAdv(int advId, const BleAdvParams *param); + +/* + * @brief set security IO capability + * @param[in] BleIoCapMode + * @return 0-success, other-fail + */ +int BleSetSecurityIoCap(BleIoCapMode mode); + +/* + * @brief set security authority + * @param[in] BleAuthReqMode + * @return 0-success, other-fail + */ +int BleSetSecurityAuthReq(BleAuthReqMode mode); + +/* + * @brief The device accept or reject the connection initiator. + * @param[in] initiator's address + * @param[in] 0-reject, 1-accept + * @return 0-success, other-fail + */ +int BleGattSecurityRsp(BdAddr bdAddr, bool accept); + +/* + * @brief read bt mac address + * @param[in] mac addr + * @param[in] addr length + * @return 0-success, other-fail + */ +int ReadBtMacAddr(unsigned char *mac, unsigned int len); + +/* + * @brief Setup scan filter params + * @param[in] BleAdvScanFilterParam + * @return 0-success, other-fail + */ +int BleScanFilterParamSetup(BleAdvScanFilterParam *param); + +/* + * @brief Configure a scan filter condition + * @param[in] BleAdvScanFilterCondition + * @return 0-success, other-fail + */ +int BleScanFilterAddRemove(BleAdvScanFilterCondition *param); + +/* + * @brief Clear all scan filter conditions for specific filter index + * @param[in] client Id + * @param[in] filter index + * @return 0-success, other-fail + */ +int BleScanFilterClear(int clientId, int filterIndex); + +/* + * @brief Enable / disable scan filter feature + * @param[in] client Id + * @param[in] 0-disable, 1-enable + * @return 0-success, other-fail + */ +int BleScanFilterEnable(int clientId, bool enable); + +/* + * @brief Set BLE scan parameters + * @param[in] client Id + * @param[in] BleScanParams, include scanInterval,scanWindow and so on. + * @return 0-success, other-fail + */ +int BleSetScanParameters(int clientId, BleScanParams *param); + +/* + * @brief Start Ble scan + * @return 0-success, other-fail + */ +int BleStartScan(void); + +/* + * @brief Stop Ble scan + * @return 0-success, other-fail + */ +int BleStopScan(void); + +/* + * @brief Callback invoked for gatt common function + * @param[in] Callback funcs + * @return 0-success, other-fail + */ +int BleGattRegisterCallbacks(BtGattCallbacks *func); + +/* + * @brief Start advertising include set adv data. + * This API will not described in the development manual, only for Hilink. + * @return 0-success, other-fail + */ +int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam); +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt_server.h b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt_server.h new file mode 100755 index 0000000..07ddbba --- /dev/null +++ b/application/samples/wifi/ohos_connect/hilink_adapt/include/ohos_bt_gatt_server.h @@ -0,0 +1,281 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. + * Description: GATT server interfaces + */ + +#ifndef OHOS_BT_GATT_SERVER_H +#define OHOS_BT_GATT_SERVER_H + +#include "ohos_bt_def.h" + +typedef enum { + OHOS_BLE_SEC_NONE = 0x00, + OHOS_BLE_SEC_ENCRYPT, + OHOS_BLE_SEC_ENCRYPT_NO_MITM, + OHOS_BLE_SEC_ENCRYPT_MITM +} BleSecAct; + +typedef struct { + int connectId; /* connection index */ + int status; /* read/write character status, GattStatus */ + int attrHandle; /* attribute handle */ + int valueLen; + char *value; /* response data from host */ +} GattsSendRspParam; + +typedef struct { + int connectId; /* connection index */ + int attrHandle; /* attribute handle */ + int confirm; /* true(indication)-the client shall respond a conformation, false(notification)-send a notification */ + int valueLen; /* response data from host */ + char *value; +} GattsSendIndParam; + +typedef struct { + int connId; /* connect index */ + int transId; /* BtTransportId */ + BdAddr *bdAddr; + int attrHandle; /* The handle of the attribute to be read */ + int offset; /* The offset of the first octet to be read */ + bool isLong; /* If isLong is true, then this request is part of a Long Read procedure */ +} BtReqReadCbPara; + +typedef struct { + int connId; /* connect index */ + int transId; /* BtTransportId */ + BdAddr *bdAddr; + int attrHandle; /* The handle of the attribute to be written */ + int offset; /* The offset of the first octet to be written */ + int length; + bool needRsp; /* if the remote device requires a response */ + bool isPrep; /* if this write operation should be queued for later execution */ + unsigned char *value; +} BtReqWriteCbPara; + +/* Callback invoked in response to register_server */ +typedef void (*RegisterServerCallback)(int status, int serverId, BtUuid *appUuid); + +/* Callback indicating that a remote device has connected */ +typedef void (*ConnectServerCallback)(int connId, int serverId, const BdAddr *bdAddr); + +/* Callback indicating that a remote device has disconnected */ +typedef void (*DisconnectServerCallback)(int connId, int serverId, const BdAddr *bdAddr); + +/* Callback invoked in response to add service */ +typedef void (*ServiceAddCallback)(int status, int serverId, BtUuid *uuid, int srvcHandle); + +/* Callback indicating that an included service has been added to a service */ +typedef void (*IncludeServiceAddCallback)(int status, int serverId, int srvcHandle, int includeSrvcHandle); + +/* Callback invoked when a characteristic has been added to a service */ +typedef void (*CharacteristicAddCallback)(int status, int serverId, BtUuid *uuid, + int srvcHandle, int characteristicHandle); + +/* Callback invoked when a descriptor has been added to a characteristic */ +typedef void (*DescriptorAddCallback)(int status, int serverId, BtUuid *uuid, + int srvcHandle, int descriptorHandle); + +/* Callback invoked in response to start_service */ +typedef void (*ServiceStartCallback)(int status, int serverId, int srvcHandle); + +/* Callback invoked in response to stop_service */ +typedef void (*ServiceStopCallback)(int status, int serverId, int srvcHandle); + +/* Callback triggered when a service has been deleted */ +typedef void (*ServiceDeleteCallback)(int status, int serverId, int srvcHandle); + +/* Callback invoked when a remote device has requested to read a characteristicor descriptor. + * The application must respond by calling send_response + */ +typedef void (*RequestReadCallback)(BtReqReadCbPara readCbPara); + +/* Callback invoked when a remote device has requested to write to a characteristic or descriptor. */ +typedef void (*RequestWriteCallback)(BtReqWriteCbPara writeCbPara); + +/* Callback triggered in response to send_response if the remote device sends a confirmation */ +typedef void (*ResponseConfirmationCallback)(int status, int handle); + +/* Callback confirming that a notification or indication has been sent to a remote device */ +typedef void (*IndicationSentCallback)(int connId, int status); + +/* Callback invoked when the MTU for a given connection changes */ +typedef void (*MtuChangeCallback)(int connId, int mtu); + +typedef struct { + RegisterServerCallback registerServerCb; + ConnectServerCallback connectServerCb; + DisconnectServerCallback disconnectServerCb; + ServiceAddCallback serviceAddCb; + IncludeServiceAddCallback includeServiceAddCb; + CharacteristicAddCallback characteristicAddCb; + DescriptorAddCallback descriptorAddCb; + ServiceStartCallback serviceStartCb; + ServiceStopCallback serviceStopCb; + ServiceDeleteCallback serviceDeleteCb; + RequestReadCallback requestReadCb; + RequestWriteCallback requestWriteCb; + ResponseConfirmationCallback responseConfirmationCb; + IndicationSentCallback indicationSentCb; + MtuChangeCallback mtuChangeCb; +} BtGattServerCallbacks; + +typedef int (*BleGattServiceRead)(unsigned char *buff, unsigned int *len); + +typedef int (*BleGattServiceWrite)(unsigned char *buff, unsigned int len); + +typedef int (*BleGattServiceIndicate)(unsigned char *buff, unsigned int len); + +typedef struct { + BleGattServiceRead read; + BleGattServiceWrite write; + BleGattServiceIndicate indicate; +} BleGattOperateFunc; + +typedef struct { + BleAttribType attrType; + unsigned int permission; /* e.g. (OHOS_GATT_PERMISSION_READ | OHOS_GATT_PERMISSION_WRITE) */ + UuidType uuidType; + unsigned char uuid[OHOS_BLE_UUID_MAX_LEN]; + unsigned char *value; + unsigned char valLen; + /* e.g. (OHOS_GATT_CHARACTER_PROPERTY_BIT_BROADCAST | OHOS_GATT_CHARACTER_PROPERTY_BIT_READ) */ + unsigned char properties; + BleGattOperateFunc func; +} BleGattAttr; + +typedef struct { + unsigned int attrNum; + BleGattAttr *attrList; +} BleGattService; + +/* + * @brief gatt server application register, callback return serverId + * @param[in] specified by upper layer + * @return 0-success, other-fail + */ +int BleGattsRegister(BtUuid appUuid); + +/* + * @brief gatt server deregister + * @param[in] server interface Id + * @return 0-success, other-fail + */ +int BleGattsUnRegister(int serverId); + +/* + * @brief Cancel connection with remote device + * @param[in] server interface id + * @param[in] remote address + * @param[in] connection index. + * @return 0-success, other-fail + */ +int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId); + +/* + * @brief add service + * @param[in] server interface id + * @param[in] service uuid and uuid length + * @param[in] is primary or secondary service. + * @param[in] service characther attribute number. + * @return 0-success, other-fail + */ +int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number); + +/* + * @brief add characteristic + * @param[in] server interface id + * @param[in] service handle + * @param[in] characteristic uuid and uuid length + * @param[in] e.g. (OHOS_GATT_CHARACTER_PROPERTY_BIT_BROADCAST | OHOS_GATT_CHARACTER_PROPERTY_BIT_READ) + * @param[in] e.g. (OHOS_GATT_PERMISSION_READ | OHOS_GATT_PERMISSION_WRITE) + * @return 0-success, other-fail + */ +int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, + int properties, int permissions); + +/* + * @brief add descriptor + * @param[in] server interface id + * @param[in] service handle + * @param[in] descriptor uuid and uuid length + * @param[in] e.g. (OHOS_GATT_PERMISSION_READ | OHOS_GATT_PERMISSION_WRITE) + * @return 0-success, other-fail + */ +int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions); + +/* + * @brief start service + * @param[in] server interface id + * @param[in] service handle + * @return 0-success, other-fail + */ +int BleGattsStartService(int serverId, int srvcHandle); + +/* + * @brief start service + * @param[in] server interface id + * @param[in] service handle + * @return 0-success, other-fail + */ +int BleGattsStopService(int serverId, int srvcHandle); + +/* + * @brief remove a service from the list of provided services + * @param[in] server interface id + * @param[in] service handle + * @return 0-success, other-fail + */ +int BleGattsDeleteService(int serverId, int srvcHandle); + +/* + * @brief remove all services from the list of provided services + * @param[in] server interface id + * @return 0-success, other-fail + */ +int BleGattsClearServices(int serverId); + +/* + * @brief Send a response to a read or write request to a remote device. + * @param[in] server interface id + * @param[in] response param + * @return 0-success, other-fail + */ +int BleGattsSendResponse(int serverId, GattsSendRspParam *param); + +/* + * @brief Send a notification or indication that a local characteristic has been updated + * @param[in] server interface id + * @param[in] indication param + * @return 0-success, other-fail + */ +int BleGattsSendIndication(int serverId, GattsSendIndParam *param); + +/* + * @brief Set the encryption level of the data transmission channel during connection + * @param[in] remote address + * @param[in] BleSecAct + * @return 0-success, other-fail + */ +int BleGattsSetEncryption(BdAddr bdAddr, BleSecAct secAct); + +/* + * @brief Callback invoked for gatt server function + * @param[in] Callback funcs + * @return 0-success, other-fail + */ +int BleGattsRegisterCallbacks(BtGattServerCallbacks *func); + +/* + * @brief Start sevice include add service/characteristic/Descriptor option. + * This API will not described in the development manual, only for Hilink. + * @return 0-success, other-fail + */ +int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo); + +/* + * @brief Stop service. + * This API will not described in the development manual, only for Hilink. + * @return 0-success, other-fail + */ +int BleGattsStopServiceEx(int srvcHandle); +#endif diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/product/device_profile.h b/application/samples/wifi/ohos_connect/hilink_adapt/product/device_profile.h index b18db4e..c58cd06 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/product/device_profile.h +++ b/application/samples/wifi/ohos_connect/hilink_adapt/product/device_profile.h @@ -51,4 +51,4 @@ extern "C" { #endif #endif -#endif /* DEVICE_PROFILE_H */ +#endif /* DEVICE_PROFILE_H */ \ No newline at end of file diff --git a/application/samples/wifi/ohos_connect/hilink_adapt/product/hilink_device.c b/application/samples/wifi/ohos_connect/hilink_adapt/product/hilink_device.c index f231907..1dc2efe 100755 --- a/application/samples/wifi/ohos_connect/hilink_adapt/product/hilink_device.c +++ b/application/samples/wifi/ohos_connect/hilink_adapt/product/hilink_device.c @@ -4,16 +4,21 @@ */ #include "hilink_device.h" #include +#include + #include "hilink.h" #include "securec.h" #include "hilink_sal_defines.h" #include "cJSON.h" -#include +#include "hsf.h" #include "ble_cfg_net_api.h" #include "cmsis_os2.h" #include "device_profile.h" -#include "hsf.h" +#include "hilink_network_adapter.h" +#include "hilink_device.h" +#ifdef CONFIG_SUPPORT_HILINK_INDIE_UPGRADE #include "hilink_entry.h" +#endif extern void handle_device_online(void); extern void handle_device_unbind(void); @@ -108,7 +113,7 @@ int HILINK_GetDevInfo(HILINK_DevInfo *devinfo) } HILINK_SAL_DEBUG("HILINK_GetDevInfo manuName: [%s]\r\n", devinfo->manuName); #ifdef CONFIG_SUPPORT_HILINK_INDIE_UPGRADE - err = sprintf_s(devinfo->fwv, sizeof(devinfo->fwv), "%s_%s", FIRMWARE_VER, SOFTWARE_VER); + err = sprintf_s(devinfo->fwv, sizeof(devinfo->fwv), "%s_%s_%s", "103","1.312", FIRMWARE_VER); if (err <= 0) { HILINK_SAL_ERROR("sprintf_s err:%d\r\n", err); return -1; @@ -589,7 +594,7 @@ void HILINK_NotifyDevStatus(int status) case HILINK_M2M_CLOUD_OFFLINE: /* 设备与云端连接断开,请在此处添加实现 */ #if defined(SUPPORT_MINIMALIST_NETCFG) || defined(SUPPORT_BLE_ANCILLAY_NETCFG) - BLE_CfgNetAdvUpdate(NULL); + BLE_CfgNetAdvUpdate(NULL); BLE_CfgNetAdvCtrl(0); (void)BLE_CfgNetAdvCtrl(0xFFFFFFFF); #endif diff --git a/application/samples/wifi/sta_sample/sta_sample.c b/application/samples/wifi/sta_sample/sta_sample.c deleted file mode 100755 index a8249ed..0000000 --- a/application/samples/wifi/sta_sample/sta_sample.c +++ /dev/null @@ -1,279 +0,0 @@ -/** - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - * - * Description: Application core main function for standard \n - * - * History: \n - * 2022-07-27, Create file. \n - */ - -#include "lwip/netifapi.h" -#include "wifi_hotspot.h" -#include "wifi_hotspot_config.h" -#include "td_base.h" -#include "td_type.h" -#include "stdlib.h" -#include "uart.h" -#include "cmsis_os2.h" -#include "app_init.h" -#include "soc_osal.h" - -#define WIFI_IFNAME_MAX_SIZE 16 -#define WIFI_MAX_SSID_LEN 33 -#define WIFI_SCAN_AP_LIMIT 64 -#define WIFI_MAC_LEN 6 -#define WIFI_STA_SAMPLE_LOG "[WIFI_STA_SAMPLE]" -#define WIFI_NOT_AVALLIABLE 0 -#define WIFI_AVALIABE 1 -#define WIFI_GET_IP_MAX_COUNT 300 - -#define WIFI_TASK_PRIO (osPriority_t)(13) -#define WIFI_TASK_DURATION_MS 2000 -#define WIFI_TASK_STACK_SIZE 0x1000 - -static td_void wifi_scan_state_changed(td_s32 state, td_s32 size); -static td_void wifi_connection_changed(td_s32 state, const wifi_linked_info_stru *info, td_s32 reason_code); - -wifi_event_stru wifi_event_cb = { - .wifi_event_connection_changed = wifi_connection_changed, - .wifi_event_scan_state_changed = wifi_scan_state_changed, -}; - -enum { - WIFI_STA_SAMPLE_INIT = 0, /* 0:初始态 */ - WIFI_STA_SAMPLE_SCANING, /* 1:扫描中 */ - WIFI_STA_SAMPLE_SCAN_DONE, /* 2:扫描完成 */ - WIFI_STA_SAMPLE_FOUND_TARGET, /* 3:匹配到目标AP */ - WIFI_STA_SAMPLE_CONNECTING, /* 4:连接中 */ - WIFI_STA_SAMPLE_CONNECT_DONE, /* 5:关联成功 */ - WIFI_STA_SAMPLE_GET_IP, /* 6:获取IP */ -} wifi_state_enum; - -static td_u8 g_wifi_state = WIFI_STA_SAMPLE_INIT; - -/***************************************************************************** - STA 扫描事件回调函数 -*****************************************************************************/ -static td_void wifi_scan_state_changed(td_s32 state, td_s32 size) -{ - UNUSED(state); - UNUSED(size); - PRINT("%s::Scan done!.\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_SCAN_DONE; - return; -} - -/***************************************************************************** - STA 关联事件回调函数 -*****************************************************************************/ -static td_void wifi_connection_changed(td_s32 state, const wifi_linked_info_stru *info, td_s32 reason_code) -{ - UNUSED(info); - UNUSED(reason_code); - - if (state == WIFI_NOT_AVALLIABLE) { - PRINT("%s::Connect fail!. try agin !\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_INIT; - } else { - PRINT("%s::Connect succ!.\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_CONNECT_DONE; - } -} - -/***************************************************************************** - STA 匹配目标AP -*****************************************************************************/ -td_s32 example_get_match_network(wifi_sta_config_stru *expected_bss) -{ - td_s32 ret; - td_u32 num = 64; /* 64:扫描到的Wi-Fi网络数量 */ - td_char expected_ssid[] = "my_softAP"; - td_char key[] = "my_password"; /* 待连接的网络接入密码 */ - td_bool find_ap = TD_FALSE; - td_u8 bss_index; - /* 获取扫描结果 */ - td_u32 scan_len = sizeof(wifi_scan_info_stru) * WIFI_SCAN_AP_LIMIT; - wifi_scan_info_stru *result = osal_kmalloc(scan_len, OSAL_GFP_ATOMIC); - if (result == TD_NULL) { - return -1; - } - memset_s(result, scan_len, 0, scan_len); - ret = wifi_sta_get_scan_info(result, &num); - if (ret != 0) { - osal_kfree(result); - return -1; - } - /* 筛选扫描到的Wi-Fi网络,选择待连接的网络 */ - for (bss_index = 0; bss_index < num; bss_index ++) { - if (strlen(expected_ssid) == strlen(result[bss_index].ssid)) { - if (memcmp(expected_ssid, result[bss_index].ssid, strlen(expected_ssid)) == 0) { - find_ap = TD_TRUE; - break; - } - } - } - /* 未找到待连接AP,可以继续尝试扫描或者退出 */ - if (find_ap == TD_FALSE) { - osal_kfree(result); - return -1; - } - /* 找到网络后复制网络信息和接入密码 */ - if (memcpy_s(expected_bss->ssid, WIFI_MAX_SSID_LEN, expected_ssid, strlen(expected_ssid)) != 0) { - osal_kfree(result); - return -1; - } - if (memcpy_s(expected_bss->bssid, WIFI_MAC_LEN, result[bss_index].bssid, WIFI_MAC_LEN) != 0) { - osal_kfree(result); - return -1; - } - expected_bss->security_type = result[bss_index].security_type; - if (memcpy_s(expected_bss->pre_shared_key, WIFI_MAX_SSID_LEN, key, strlen(key)) != 0) { - osal_kfree(result); - return -1; - } - expected_bss->ip_type = 1; /* 1:IP类型为动态DHCP获取 */ - osal_kfree(result); - return 0; -} - -/***************************************************************************** - STA 关联状态查询 -*****************************************************************************/ -td_bool example_check_connect_status(td_void) -{ - td_u8 index; - wifi_linked_info_stru wifi_status; - /* 获取网络连接状态,共查询5次,每次间隔500ms */ - for (index = 0; index < 5; index ++) { - (void)osDelay(50); /* 50: 延时500ms */ - memset_s(&wifi_status, sizeof(wifi_linked_info_stru), 0, sizeof(wifi_linked_info_stru)); - if (wifi_sta_get_ap_info(&wifi_status) != 0) { - continue; - } - if (wifi_status.conn_state == 1) { - return 0; /* 连接成功退出循环 */ - } - } - return -1; -} - -/***************************************************************************** - STA DHCP状态查询 -*****************************************************************************/ -td_bool example_check_dhcp_status(struct netif *netif_p, td_u32 *wait_count) -{ - if ((ip_addr_isany(&(netif_p->ip_addr)) == 0) && (*wait_count <= WIFI_GET_IP_MAX_COUNT)) { - /* DHCP成功 */ - PRINT("%s::STA DHCP success.\r\n", WIFI_STA_SAMPLE_LOG); - return 0; - } - - if (*wait_count > WIFI_GET_IP_MAX_COUNT) { - PRINT("%s::STA DHCP timeout, try again !.\r\n", WIFI_STA_SAMPLE_LOG); - *wait_count = 0; - g_wifi_state = WIFI_STA_SAMPLE_INIT; - } - return -1; -} - -td_s32 example_sta_function(td_void) -{ - td_char ifname[WIFI_IFNAME_MAX_SIZE + 1] = "wlan0"; /* 创建的STA接口名 */ - wifi_sta_config_stru expected_bss = {0}; /* 连接请求信息 */ - struct netif *netif_p = TD_NULL; - td_u32 wait_count = 0; - - /* 创建STA接口 */ - if (wifi_sta_enable() != 0) { - return -1; - } - PRINT("%s::STA enable succ.\r\n", WIFI_STA_SAMPLE_LOG); - - do { - (void)osDelay(1); /* 1: 等待10ms后判断状态 */ - if (g_wifi_state == WIFI_STA_SAMPLE_INIT) { - PRINT("%s::Scan start!\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_SCANING; - /* 启动STA扫描 */ - if (wifi_sta_scan() != 0) { - g_wifi_state = WIFI_STA_SAMPLE_INIT; - continue; - } - } else if (g_wifi_state == WIFI_STA_SAMPLE_SCAN_DONE) { - /* 获取待连接的网络 */ - if (example_get_match_network(&expected_bss) != 0) { - PRINT("%s::Do not find AP, try again !\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_INIT; - continue; - } - g_wifi_state = WIFI_STA_SAMPLE_FOUND_TARGET; - } else if (g_wifi_state == WIFI_STA_SAMPLE_FOUND_TARGET) { - PRINT("%s::Connect start.\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_CONNECTING; - /* 启动连接 */ - if (wifi_sta_connect(&expected_bss) != 0) { - g_wifi_state = WIFI_STA_SAMPLE_INIT; - continue; - } - } else if (g_wifi_state == WIFI_STA_SAMPLE_CONNECT_DONE) { - PRINT("%s::DHCP start.\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_GET_IP; - netif_p = netifapi_netif_find(ifname); - if (netif_p == TD_NULL || netifapi_dhcp_start(netif_p) != 0) { - PRINT("%s::find netif or start DHCP fail, try again !\r\n", WIFI_STA_SAMPLE_LOG); - g_wifi_state = WIFI_STA_SAMPLE_INIT; - continue; - } - } else if (g_wifi_state == WIFI_STA_SAMPLE_GET_IP) { - if (example_check_dhcp_status(netif_p, &wait_count) == 0) { - break; - } - wait_count++; - } - } while (1); - - return 0; -} - -int sta_sample_init(void *param) -{ - param = param; - - /* 注册事件回调 */ - if (wifi_register_event_cb(&wifi_event_cb) != 0) { - PRINT("%s::wifi_event_cb register fail.\r\n", WIFI_STA_SAMPLE_LOG); - return -1; - } - PRINT("%s::wifi_event_cb register succ.\r\n", WIFI_STA_SAMPLE_LOG); - - /* 等待wifi初始化完成 */ - while (wifi_is_wifi_inited() == 0) { - (void)osDelay(10); /* 1: 等待100ms后判断状态 */ - } - PRINT("%s::wifi init succ.\r\n", WIFI_STA_SAMPLE_LOG); - - if (example_sta_function() != 0) { - PRINT("%s::example_sta_function fail.\r\n", WIFI_STA_SAMPLE_LOG); - return -1; - } - return 0; -} - -static void sta_sample_entry(void) -{ - osThreadAttr_t attr; - attr.name = "sta_sample_task"; - attr.attr_bits = 0U; - attr.cb_mem = NULL; - attr.cb_size = 0U; - attr.stack_mem = NULL; - attr.stack_size = WIFI_TASK_STACK_SIZE; - attr.priority = WIFI_TASK_PRIO; - if (osThreadNew((osThreadFunc_t)sta_sample_init, NULL, &attr) == NULL) { - PRINT("%s::Create sta_sample_task fail.\r\n", WIFI_STA_SAMPLE_LOG); - } - PRINT("%s::Create sta_sample_task succ.\r\n", WIFI_STA_SAMPLE_LOG); -} - -/* Run the sta_sample_task. */ -app_run(sta_sample_entry); \ No newline at end of file diff --git a/application/ws63/hsf/CMakeLists.txt b/application/ws63/hsf/CMakeLists.txt deleted file mode 100755 index ecba4a9..0000000 --- a/application/ws63/hsf/CMakeLists.txt +++ /dev/null @@ -1,145 +0,0 @@ -#=============================================================================== -# @brief cmake file -# Copyright (c) ShangHai High-flying Electronics Technology Co.,Ltd 2022-2022. All rights reserved. -#=============================================================================== -set(COMPONENT_NAME "hsf") - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/hfsys.c -) - -set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set(PRIVATE_HEADER -) - -set(PRIVATE_DEFINES - CONFIG_SUPPORT_WIFI_APSTA -) - -set(PUBLIC_DEFINES -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS #当前组件需要对外提供的编译选项 - #-Wno-error=maybe-uninitialized #变量未初始化 - #-Wno-error=pointer-sign #传递参数类型不匹配 - #-Wno-error=char-subscripts #使用char类作为数组下标,char有符号 - #-Wno-error=unused-label #未使用的标签,比如用goto - #-Wno-error=strict-prototypes #函数的声明或定义没有参数 - #-Wno-unused-parameter #未使用的函数参数 - #-Wno-unused-variable #未使用的变量 - #-Wno-unused-function #声明但未使用函数 - #-Wno-unused-but-set-variable #设置了但未使用的变量 - #-Wsign-compare #有符号与无符号比较 - #-Wno-error=pointer-arith - #-Wno-error=sign-compare - #-Wno-error=jump-misses-init - #-Wno-error=incompatible-pointer-types - #-Wno-error=logical-op - #-Wno-error=empty-body -) - -set(COMPONENT_CCFLAGS #当前组件内部生效的编译选项 - -Wno-error=maybe-uninitialized #变量未初始化 - -Wno-error=pointer-sign #传递参数类型不匹配 - -Wno-error=char-subscripts #使用char类作为数组下标,char有符号 - -Wno-error=unused-label #未使用的标签,比如用goto - -Wno-error=strict-prototypes #函数的声明或定义没有参数 - -Wno-unused-parameter #未使用的函数参数 - -Wno-unused-variable #未使用的变量 - -Wno-unused-function #声明但未使用函数 - -Wno-unused-but-set-variable #设置了但未使用的变量 - -Wsign-compare #有符号与无符号比较 - -Wno-error=pointer-arith - -Wno-error=sign-compare - -Wno-error=jump-misses-init - -Wno-error=incompatible-pointer-types - -Wno-error=logical-op - -Wno-error=empty-body -) - -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - true -) - -build_component() - - - - - - -set(COMPONENT_NAME "app_main") - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/app_main.c -) - -set(PUBLIC_HEADER -) - -set(PRIVATE_HEADER -) - -set(PRIVATE_DEFINES - CONFIG_SUPPORT_WIFI_APSTA -) - -set(PUBLIC_DEFINES -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS #当前组件需要对外提供的编译选项 - #-Wno-error=maybe-uninitialized #变量未初始化 - #-Wno-error=pointer-sign #传递参数类型不匹配 - #-Wno-error=char-subscripts #使用char类作为数组下标,char有符号 - #-Wno-error=unused-label #未使用的标签,比如用goto - #-Wno-error=strict-prototypes #函数的声明或定义没有参数 - #-Wno-unused-parameter #未使用的函数参数 - #-Wno-unused-variable #未使用的变量 - #-Wno-unused-function #声明但未使用函数 - #-Wno-unused-but-set-variable #设置了但未使用的变量 - #-Wsign-compare #有符号与无符号比较 - #-Wno-error=pointer-arith - #-Wno-error=sign-compare - #-Wno-error=jump-misses-init - #-Wno-error=incompatible-pointer-types - #-Wno-error=logical-op - #-Wno-error=empty-body -) - -set(COMPONENT_CCFLAGS #当前组件内部生效的编译选项 - -Wno-error=maybe-uninitialized #变量未初始化 - -Wno-error=pointer-sign #传递参数类型不匹配 - -Wno-error=char-subscripts #使用char类作为数组下标,char有符号 - -Wno-error=unused-label #未使用的标签,比如用goto - -Wno-error=strict-prototypes #函数的声明或定义没有参数 - -Wno-unused-parameter #未使用的函数参数 - -Wno-unused-variable #未使用的变量 - -Wno-unused-function #声明但未使用函数 - -Wno-unused-but-set-variable #设置了但未使用的变量 - -Wsign-compare #有符号与无符号比较 - -Wno-error=pointer-arith - -Wno-error=sign-compare - -Wno-error=jump-misses-init - -Wno-error=incompatible-pointer-types - -Wno-error=logical-op - -Wno-error=empty-body -) - -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - true -) - -build_component() diff --git a/application/ws63/hsf/assis_thread.h b/application/ws63/hsf/assis_thread.h deleted file mode 100755 index d32daf3..0000000 --- a/application/ws63/hsf/assis_thread.h +++ /dev/null @@ -1,66 +0,0 @@ -/* assis_thread.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _ASSIS_THREAD_H_ -#define _ASSIS_THREAD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#define ASSIS_PORT 48899 -#define ASSIS_PBUF_SIZE 200 - - -/** - * @brief start assis thread. - * - * @param[in] port: assis thread listen udp port - * @return[out] HF_SUCCESS-successfully, other value is failed - */ -int HSF_IAPI start_assis(uint16_t port); - -/** - * @brief check whether or not in assis AT cmd mode. - * - * @param[in] None - * @return[out] 0-not in, 1-in assis AT cmd mode - * @see None. - * @note None. - */ -int HSF_IAPI assis_is_in_cmd(void); - -/** - * @brief get assis AT cmd source IP address. - * - * @param[in] None - * @return[out] IP address in number format - * @see None. - * @note None. - */ -uint32_t HSF_IAPI assis_get_peer_ip(void); - -/** - * @brief send response to AT commands from assis thread. - * - * @param[in] rsp: the response - * len: the length of response - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_IAPI assis_cmd_response(char *rsp, int len); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfat.h b/application/ws63/hsf/hfat.h deleted file mode 100755 index b38aac8..0000000 --- a/application/ws63/hsf/hfat.h +++ /dev/null @@ -1,162 +0,0 @@ - /* hfat.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_AT_H_ -#define _HF_AT_H_ - -#include "hsf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define HFAT_MAX_CMD_DATA_LEN (1024) -#define HFAT_REPLY_FLAG_NOSEND_TAIL (0x00000001) -#define HFUART_TEST_WAIT_TIME 400 -//#define HFAT_DELETE_PARTIAL_CMD - -typedef int (*at_cmd_reply_func)(const char*,int len,int timeouts,int flags); -typedef int (*at_cmd_read_func)(char*buf,int len,int timeouts,int flags); - -typedef struct _at_session -{ - at_cmd_reply_func pfreply; - at_cmd_read_func pfread; - int sid; - char *rsp; - int rsp_len; - int cmd_id; -}at_session_t,*pat_session_t; - -typedef pat_session_t at_session_handle; - -typedef struct _at_cmd -{ - const char * name; - int (*func)(pat_session_t,int, char** ,char *,int); // the main func , or init - const char * doc; - int (*callhook)(pat_session_t,int, char** ,char *,int); -} hfat_cmd_t,*phfat_cmd_t; - -typedef struct _at_cmd_category -{ - const char *name; - phfat_cmd_t item; -}hfat_cmd_category,*phfat_cmd_category; - - -enum session_id_e -{ - AT_SESSION_UART0=0, - AT_SESSION_UART1=1, - AT_SESSION_ASSIST_SOCKET, - AT_SESSION_API, -}; - -enum ENCMDOPCODE -{ - OPCODE_NONE, - OPCODE_EQUA, - OPCODE_WFLASH, - OPCODE_QUERY -}; - -enum ENCMDCODE -{ - CMD_ERR =-1, - CMD_NONE = 0, -}; -enum -{ - UART0_TEST_NONE=0, - UART0_TEST_START, - UART0_TEST_SUCCESS -}; - -#define HFAT_TABLE_INDEX_USER 0 -#define HFAT_TABLE_INDEX_UTILS 1 -#define HFAT_TABLE_INDEX_SOCKA 2 -#define HFAT_TABLE_INDEX_SOCKB 3 -#define HFAT_TABLE_INDEX_WIFI 4 -#define HFAT_TABLE_INDEX_NETWORK 5 -#define HFAT_TABLE_INDEX_WIFITEST 6 - -extern hfat_cmd_category hf_at_cmd_tables[]; -extern const hfat_cmd_t user_define_at_cmds_table[]; -int setbaudrate(int baud,int uart_no); -int setparity(int parity,int uart_no); - -int HSF_IAPI hfat_init(void); - -int HSF_IAPI hfat_assis_send_cmd(char *cmd_line,int cmd_len); - -int HSF_IAPI hfat_pars_uart_cmd(hfuart_handle_t uart, char *cmd_line, int len); - -int HSF_IAPI hfat_uart_recv(char *data, uint32_t bytes, uint32_t timeouts); - -int HSF_IAPI hfat_uart_send(char *data, uint32_t bytes); - -void HSF_IAPI print_hex(char *rep, unsigned char h); - -void HSF_IAPI cmd_reply(char *reply); - -int HSF_IAPI strtowords(char *str,char *words[],int size,char *separators); - - -/** - * @brief enable/disable uart at command. - * - * @param[in] enable: 1-enable, 0-disable - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfat_enable_uart_session(char enable); - -/** - * @brief set at command buffer size. - * - * @param[in] size: range is [1-4096], in bytes, default is 100 - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfat_set_atcmd_buf_size(int size); - - /** - * @brief parse at command. - * - * @param[in] cmd_line: a pointer to a buffer containing the AT command - * cmd_len: the length, in bytes, of the data pointed to by the cmd_line parameter - * rsp: a pointer to a buffer to receive AT command response data - * len: the size of the rsp parameter - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note cannot be called in ISR. - */ -int HSF_API hfat_send_cmd(char *cmd_line,int cmd_len,char *rsp,int len); - -/** - * @brief parse at command response. - * - * @param[in] str: a pointer to a buffer containing the AT command response data - * words: a pointer to a pointer buffer - * size: the count of words parameter - * @return[out] the count of words - * @see None. - * @note None. - */ -int HSF_API hfat_get_words(char *str,char *words[],int size); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfconfig.h b/application/ws63/hsf/hfconfig.h deleted file mode 100755 index 21de214..0000000 --- a/application/ws63/hsf/hfconfig.h +++ /dev/null @@ -1,704 +0,0 @@ -/* hfconfig.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_CONFIG_H_ -#define _HF_CONFIG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "hsf.h" - -#define CONFIG_HAVE_SETTIMEOFDAY 1 -#define CONFIG_HAVE_GETTIMEOFDAY 1 -//#define CONFIG_NO_STRUCT_TIMEZONE -#define SECRET_BUF_SIZE 3500 -#define DEFAULT_NTP_SERVER "cn.ntp.org.cn" - - -#define UPDATEFLAG 2 -#define BLE_CONKEYLEN 16 -#define HILINK_SN_MAX_SIZE 36 - -#pragma pack(push) -#pragma pack(1) - -typedef struct -{ - int8_t updateflag; //update flag - int8_t validflag; //valid flag - int8_t tmode_mode; - int8_t wmode_mode; - - //STA, 140 bytes - uint8_t sta_ssid[33]; - uint8_t sta_key[65]; - int8_t wsauth; - int8_t wsencry; - uint8_t wslko; - uint8_t pmk_av; - uint8_t sta_padding[6]; - uint8_t pmk[32]; - - //AP, 144 bytes - int8_t wap_mode; - int8_t wap_channel; - int8_t waauth; - int8_t waencry; - uint8_t walk_led; - uint8_t max_sta_num; - uint8_t ap_enable_hide; - uint8_t ap_ssid[33]; - uint8_t ap_key[65]; - uint8_t ap_pmk_av; - uint8_t ap_pmk[32]; - uint8_t ap_padding[6]; - - //UART, 20 bytes - int8_t baudrate; - int8_t data_bits; - int8_t stop_bits; - int8_t parity; - int8_t ctsrts; - - int8_t uart1_baudrate; - int8_t uart1_data_bits; - int8_t uart1_stop_bits; - int8_t uart1_parity; - int8_t uart1_debug; - int8_t uartfable; - int8_t fuartte_mode; - uint16_t uarttm; - uint16_t uartbuf; - uint8_t uart_padding[4]; - - //NETP, 108 bytes - int8_t protocol; - int8_t app_mode; - uint8_t maxsocket; - char cipadd[101]; - uint16_t pro_port; - uint16_t tcpto; - - //SOCKB, 112 bytes - uint16_t sockb_port; - uint16_t sockb_tcpto; - int8_t sockb_pro; - char sockb_cipadd[101]; - int8_t tcpdis; - int8_t tcpdisb; - - uint16_t udp_localporta; - uint16_t udp_localportb; - - //NETWORK, 108 bytes - char wann_ipaddr[16]; - char wann_mask[16]; - char wann_gateway[16]; - char lann_ipaddr[16]; - char lann_mask[16]; - uint8_t wann_mode; - uint8_t network_padding[2]; - uint8_t domain_name[21]; - uint32_t dns_addr; - - //UTILS, 124 bytes - int8_t echo; - int8_t rlden; - uint8_t debug_level; - char wel_msg[11]; - uint8_t event_onoff; - uint8_t noise_filter; - uint8_t wifi_switch; - uint8_t sta_dtim; - uint8_t utils_padding[40]; - uint8_t dis_power_saving; - int8_t modechange; - uint8_t ps_interval; - uint8_t mid[21]; - uint8_t aswd[21]; - uint8_t cmdpw[21]; - - //HTTPD, 36 bytes - char user_name[16]; - char user_password[16]; - int8_t web_switch; - uint8_t web_language; - uint8_t web_encode_format; - uint8_t httpd_padding; - - //DHCPD, 4 bytes - int8_t dhcpsw; - uint8_t dhcpd_addr_start; - uint8_t dhcpd_addr_end; - uint8_t dhcpd_padding; - - //UPDATE, 124 bytes - char update_url[101]; - char update_file[21]; - uint8_t update_padding[2]; - - //NTP, 8 bytes - uint8_t ntp_time; - uint8_t ntp_enable; - uint8_t ntp_padding; - int8_t time_zone; - uint32_t ntpserver; - - //SMTLK, 16 bytes - uint32_t smtlk_sign; - uint8_t smtlk_mode; - uint8_t smtlk_protocol; - uint8_t smtlk_rtype; - uint8_t smtlk_ak_random; - uint8_t connect_flag; - uint8_t sta_channel; - uint8_t sta_bssid[6]; - - //SMARTAPLINK, 44 bytes - uint8_t smartaplink_enable; - uint8_t smartaplink_padding; - uint8_t smartaplink_prefix[21]; - uint8_t smartaplink_key[21]; - - //NETPID, 24 bytes - uint8_t netpa_iden; - char netpa_id[11]; - uint8_t netpb_iden; - char netpb_id[11]; - - //NETPREG, 264 bytes - uint8_t netpa_regen; - uint8_t netpa_regtype; - uint8_t netpa_reg_padding; - char netpa_regdata[129]; - uint8_t netpb_regen; - uint8_t netpb_regtype; - uint8_t netpb_reg_padding; - char netpb_regdata[129]; - - //HEART, 124 bytes - uint16_t heart_netp_time; - uint16_t heart_sockb_time; - uint16_t heart_uart_time; - char heart_netp_data[39]; - char heart_sockb_data[39]; - char heart_uart_data[39]; - uint8_t heart_padding; - - //HTTP, 236 bytes - uint8_t http_type; - uint8_t http_version; - uint8_t http_connect_type; - uint8_t http_recv_time; - char http_url[51]; - char http_header[181]; - - //MQTT, 224 bytes - char mqtt_username[33]; - char mqtt_password[33]; - char mqtt_clientid[33]; - char mqtt_pub_topic[61]; - char mqtt_sub_topic[61]; - uint8_t mqtt_qos; - uint16_t mqtt_heart_time; - - //BLE, 188 bytes - uint16_t conn_min; - uint16_t conn_max; - uint16_t conn_latency; - uint16_t supervisionTO; - - uint16_t adver_min; - uint16_t adver_max; - - uint8_t ble_name[27]; //BLE广播名 - uint8_t ble_dms_name[27]; //BLE配网名 - uint8_t ble_adver_data[27]; - - uint8_t ble_adver_data_len; - uint8_t ble_switch; - uint8_t ble_uuid_server; - uint8_t dms_type; - uint8_t ble_padding; - - uint8_t uuid_ntf_server[17]; - uint8_t uuid_ntf_read[17]; - uint8_t uuid_ntf_write[17]; - uint8_t uuid_ind_server[17]; - uint8_t uuid_ind_read[17]; - uint8_t uuid_ind_write[17]; - - uint8_t adver_type; - uint8_t adver_channel; - uint8_t ble_ind; - uint8_t smartconfiglink; - - uint8_t ble_conenable; - uint8_t ble_conkey[BLE_CONKEYLEN]; - uint8_t ble_contimeout; - uint8_t netpc_iden; - char netpc_id[11]; - uint8_t netpc_idflag; - - uint8_t ble_padding2[17]; - - uint8_t mqtt_tls; - uint8_t mqtt_padding[3]; - - char iot_productkey[12]; - char iot_devicename[48]; - char iot_devicesecret[48]; - char iot_pubtopic[96]; - char iot_subtopic[96]; - char iot_mode; - char iot_padding[3]; - - uint8_t product_mode; - - int8_t ctsrts_pin; - - char instance_flag; - char instance_id[32]; - - char ntp_domain_server[33]; - int8_t smk_find; - - uint32_t mcu_ota_size; - uint8_t scan_ch14; - - uint32_t module_reset_reason; - - uint8_t radar_type; //雷达工作类型(0 is disable) - uint8_t radar_led; //雷达灯工作类型(0 is off) - - uint8_t smtlk_type; - char hilink_sn[HILINK_SN_MAX_SIZE]; - uint8_t prot_type; - uint8_t product; - uint8_t uart1_debug_rx_invalid; - uint8_t reserved1[51+512-HILINK_SN_MAX_SIZE-1]; - - uint8_t validflag_magic; - int8_t validflag_end; //valid flag -}HF_CONFIG_FILE; //sizeof Must have 16 byte alignment - -typedef struct -{ - uint32_t magic_code; - uint32_t crc32; - uint32_t ver; - uint32_t ota_flag; - uint32_t run_mode; - uint32_t upgrade_fw_addr; - uint8_t flash_test; - uint8_t reserved2; - uint8_t xmodem_upgrade_fw_flag; - uint8_t debug; - uint8_t rf_init; - uint8_t run_default_sw; - uint8_t run_rf_test_app; - uint8_t boot_wait_flag; - int8_t rf_table[48]; - uint8_t reserved[48]; -}HF_BOOT_CONFIG; - -#pragma pack(pop) - -extern int g_module_id; -extern HF_CONFIG_FILE g_hf_config_file; - -enum ENWAUTH -{ - WAUTH_OPEN = 0x00, - WAUTH_SHARED, - WAUTH_WPAPSK, - WAUTH_WPA2PSK, - WAUTH_WPAPSKWPA2PSK -}; - -enum ENWENCRY -{ - WENCRY_NONE = 0x00, - WENCRY_WEP_A, - WENCRY_WEP_H, - WENCRY_TKIP, - WENCRY_AES, - WENCRY_TKIPAES, - WENCRY_WEP -}; - -enum ENNETSETAPP -{ - NETSETAPP_SERVER = 0x00, - NETSETAPP_CLIENT -}; - -enum ENNETSETPRO -{ - NETSETPRO_TCP = 0x00, - NETSETPRO_UDP, - NETSETPRO_HTTPC, - NETSETPRO_MQTT, - NETSETPRO_ALIIOT, - NETSETPRO_IGMP, - NETSETPRO_TCP_TLS, - NETSETPRO_HTTPSC -}; - -enum ENSOCKBPRO -{ - SOCKBPRO_NONE = 0x00, - SOCKBPRO_TCP, - SOCKBPRO_UDP, - SOCKBPRO_UDPS, - SOCKBPRO_IGMP -}; - -typedef enum ENBAUDRATE -{ - BAUDRATE_50 = 0x00, - BAUDRATE_75, - BAUDRATE_110, - BAUDRATE_134, - BAUDRATE_150, - BAUDRATE_200, - BAUDRATE_300, - BAUDRATE_600, - BAUDRATE_1200, - BAUDRATE_1800, - BAUDRATE_2400, - BAUDRATE_4800, - BAUDRATE_9600, - BAUDRATE_19200, - BAUDRATE_38400, - BAUDRATE_57600, - BAUDRATE_115200, - BAUDRATE_230400, - BAUDRATE_380400, - BAUDRATE_460800, - BAUDRATE_921600, - BAUDRATE_56000, - BAUDRATE_1000000, - BAUDRATE_1500000, - BAUDRATE_2000000, - BAUDRATE_2500000, - BAUDRATE_3000000, - BAUDRATE_3500000, - BAUDRATE_4000000 -}ENBAUDRATE_E; - -typedef enum ENCOMBITS -{ - COMBITS_5 = 0x00, - COMBITS_6, - COMBITS_7, - COMBITS_8 -}ENCOMBITS_E; - -typedef enum ENCOMPARITY -{ - COMPARITY_NONE = 0x00, - COMPARITY_ODD, - COMPARITY_EVEN, - COMPARITY_MARK, - COMPARITY_SPACE -}ENCOMPARITY_E; - -typedef enum ENCOMSTOPBITS -{ - - COMSTOPBITS_1 = 0x01, - COMSTOPBITS_1P5, - COMSTOPBITS_2 -}ENCOMSTOPBITS_E; - -typedef enum ENCOMUARTCTL -{ - COMUARTFC = 0x00, - COMUARTNFC -}ENCOMUARTCTL_E; - -typedef enum ENCOMUARTCTLPIN -{ - COMUARTFCPIN_DEF = 0x00, - COMUARTFCPIN_REV -}ENCOMUARTCTLPIN_E; - -enum ENCOMWANNMODE -{ - COMWANNDHCP = 0x00, - COMWANNSTATIC -}; - -enum ENUARTFABLE -{ - HFUARTFDISABLE = 0x00, - HFUARTFENABLE, - HFUARTHFFORMAT, -}; - -enum ENUARTFMODE -{ - M2M_UARTTE_FAST = 0x00, - M2M_UARTTE_NORMAL -}; - -enum CONFIG_WAMOD -{ - CONFIG_WAMOD_11B = 0x00, - CONFIG_WAMOD_11BG, - CONFIG_WAMOD_11BGN -}; - -enum CONFIG_WMODE -{ - CONFIG_WMODE_AP = 0x00, - CONFIG_WMODE_STA, - CONFIG_WMODE_APSTA -}; - -enum ENWORKTMODE -{ - M2M_STATE_RUN_THROUGH = 0x00, - M2M_STATE_RUN_CMD, - M2M_STATE_RUN_GPIO, - M2M_STATE_RUN_PWM -}; - -enum CONFIG_PSLP -{ - CONFIG_PSLP_NORMAL = 0x00, - CONFIG_PSLP_STANDBY, - CONFIG_PSLP_DEEPSLEEP -}; - -enum CONFIG_PRLDEN -{ - CONFIG_PRLDEN_DISABLE = 0x00, - CONFIG_PRLDEN_ENABLE -}; - -enum CONFIG_WADHCP -{ - CONFIG_WADHCP_DISABLE = 0x00, - CONFIG_WADHCP_ENABLE -}; - -enum CONFIG_WEBLANGUAGE -{ - CONFIG_WEBLAN_EN = 0x00, - CONFIG_WEBLAN_CN -}; - -enum CONFIG_DISPS -{ - CONFIG_EN_PS = 0x00, - CONFIG_DIS_PS -}; - -enum CONFIG_BLE -{ - CONFIG_BLE_ON = 0x00, - CONFIG_BLE_OFF -}; - -enum CONFIG_BLE_IND //ble link light -{ - CONFIG_BLE_IND_OFF = 0x00, - CONFIG_BLE_IND_ON -}; - -enum CONFIG_REG_TYPE -{ - CONFIG_REG_TYPE_LINK = 0x00, - CONFIG_REG_TYPE_DATA, - CONFIG_REG_TYPE_BOTH -}; - -typedef enum -{ - SMTLK_BLE_NARMAL =0, - SMTLK_BLE_ADD_LOCAL_CONTROL =1, - SMTLK_BLE_FAST_CONNECT =2, - SMTLK_SOFTAP =3 -}config_type_t; - -enum -{ - SMTLK_BLE_NOMAL =1, - SMTLK_BLE_DOUBLE_CONTROL=12, - SMTLK_BLE_FAST=17 -}; - -enum CONFIG_FACTORYTEST -{ - CONFIG_FACTORYTEST_OFF = 0x00, - CONFIG_FACTORYTEST_ON = 0x01 -}; - -void HSF_IAPI hfconfig_init(void); - -int HSF_IAPI hfconfig_is_valid(void); - -void HSF_IAPI hfconfig_dump(unsigned char *data, int len); - -int HSF_IAPI hfconfig_protect_check(void); - -int HSF_IAPI hfconfig_fseting_save_ex(HF_CONFIG_FILE *file); - -int HSF_IAPI hfconfig_fseting_save(void); - -void HSF_IAPI hfconfig_file_reload(void); - -void HSF_IAPI hfconfig_enable_save(int enable); - -void HSF_IAPI hfconfig_file_save(void); - - - - -int HSF_IAPI hfboot_config_set_ota_ready(uint32_t ota_file_addr); - -int HSF_IAPI hfboot_config_set_ota_flags(uint32_t flags); - -int HSF_IAPI hfboot_config_set_ota_xmodem(uint8_t flag); - -int HSF_IAPI hfboot_config_set_run_default_sw(uint8_t flag); - -uint8_t HSF_IAPI hfboot_config_get_run_default_sw(void); - -int HSF_IAPI hfboot_config_set_flash_test(uint8_t flag); - -int HSF_IAPI hfboot_config_get_flash_test(void); - -void HSF_IAPI hfboot_update_run_mode(uint32_t mode); - -void HSF_IAPI hfboot_set_rf_test_mode(uint8_t mode); - -uint8_t HSF_IAPI hfboot_get_rf_test_mode(void); - -void HSF_IAPI hfboot_set_boot_wait_flag(uint8_t flag); - -uint8_t HSF_IAPI hfboot_get_boot_wait_flag(void); - -int HSF_IAPI hfboot_config_set_rf_table(int8_t table[48]); - -int HSF_IAPI hfboot_config_get_rf_table(int8_t table[48]); - -void HSF_IAPI hfboot_update_run_mode(uint32_t mode); - -void HSF_IAPI hfboot_set_debug(uint8_t on); - - - - - -int HSF_IAPI hfconfig_uart_baud_en2num(int *num,int baudrate); - -int HSF_IAPI hfconfig_uart_baud_num2en(int num, int *en); -uint8_t HSF_API hfproduct_is_run(void); -void HSF_API hfproduct_run_set(uint8_t mode); -int HSF_API hf_get_customer_run_mode(void); -int HSF_API hf_set_customer_run_mode(int mode); -uint8_t hf_hilink_main_is_runing(void); -void hf_set_hilink_main_runing(void); - - -/** - * @brief check High-flying config data is valid. - * - * @param[in] None - * @return[out] 0-invalid, 1-valid - * @see None. - * @note None. - */ -int HSF_API hfconfig_file_check_is_valid(void); - - - -/** - * @brief read High-flying config data. - * - * @param[in] offset: the offset of config data - * data: a pointer to data - * len: the length, in bytes, of the data pointed to store data - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfconfig_file_data_read(int offset, unsigned char *data, int len); - - /** - * @brief write High-flying config data. - * - * @param[in] offset: the offset of config data - * data: a pointer to data - * len: the length, in bytes, of the data pointed to write - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfconfig_file_data_write(int offset, unsigned char *data, int len); - -/** - * @brief read hilink sn. - * - * @param[in] NULL - * @return[out] return hilink sn string - * @see None. - * @note None. - */ -char *hfget_hilink_sn(void); - -/** - * @brief write hilink sn. - * - * @param[in] set hilink sn to flash - * @return[out] 0 set success other fail - * @see None. - * @note None. - */ -int hfset_hilink_sn(char *sn); - -/** - * @brief set hilink smtlk mode. - * - * @param[in] set hilink smtlk mode to flash - * SMTLK_BLE_NARMAL ble常规配网 - * SMTLK_BLE_ADD_LOCAL_CONTROL ble双联双控 - * SMTLK_BLE_FAST_CONNECT ble极简配网 - * SMTLK_SOFTAP softap配网 - * @return[out] NULL - * @see None. - * @note None. - */ -void hfset_hilink_mode(int type); - -/** - * @brief get hilink smtlk mode. - * @param[in] NULL - * @return[out] hilink mode - * SMTLK_BLE_NARMAL ble常规配网 - * SMTLK_BLE_ADD_LOCAL_CONTROL ble双联双控 - * SMTLK_BLE_FAST_CONNECT ble极简配网 - * SMTLK_SOFTAP softap配网 - * @see None. - * @note None. - */ -int hfget_hilink_mode(void); - - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfcrypto.h b/application/ws63/hsf/hfcrypto.h deleted file mode 100755 index 8f60455..0000000 --- a/application/ws63/hsf/hfcrypto.h +++ /dev/null @@ -1,230 +0,0 @@ -/* hfcrypto.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_CRYPTO_H_ -#define _HF_CRYPTO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @brief encrypt data with aes (ecb mode/128bit key). - * - * @param[in] key: the key of AES - * data: the data want to encrypt - * data_len: the length of data - * @return[out] the length of encrypted data - * @see None. - * @note None. - */ -int HSF_API hfcrypto_aes_ecb_encrypt(const unsigned char *key, unsigned char *data, int data_len); - -/** - * @brief decrypt data with aes (ecb mode/128bit key). - * - * @param[in] key: the key of AES - * data: the data want to decrypt - * data_len: the length of data - * @return[out] the length of decrypted data - * @see None. - * @note None. - */ -int HSF_API hfcrypto_aes_ecb_decrypt(const unsigned char *key, unsigned char *data, int data_len); - -/** - * @brief encrypt data with aes (cbc mode/128bit key). - * - * @param[in] key: the key of AES - * iv: the initialization vector of AES - * data: the data want to encrypt - * data_len: the length of data - * @return[out] the length of encrypted data - * @see None. - * @note None. - */ -int HSF_API hfcrypto_aes_cbc_encrypt(const unsigned char *key, const unsigned char *iv, unsigned char *data, int data_len); - -/** - * @brief decrypt data with aes (cbc mode/128bit key). - * - * @param[in] key: the key of AES - * iv: the initialization vector of AES - * data: the data want to decrypt - * data_len: the length of data - * @return[out] the length of decrypted data - * @see None. - * @note None. - */ -int HSF_API hfcrypto_aes_cbc_decrypt(const unsigned char *key, const unsigned char *iv, unsigned char *data, int data_len); - -/** - * @brief calculate the MD5 of the data. - * - * @param[in] data: the data want to calculate MD5 - * len: the length of data, in bytes - * digest: store MD5, must > 16 bytes - * @return[out] the length of MD5, in bytes - * @see None. - * @note None. - */ -int HSF_API hfcrypto_md5(const unsigned char *data, int len, unsigned char *digest); - -/** - * @brief encode data as base64. - * - * @param[in] src: input byte array - * srclength: size of input byte array - * target: output byte array - * targsize: size of output byte array - * @return[out] returns the number of data bytes stored at the target, or -1 on error. - * @see None. - * @note encode data as base64, converts characters, three at a time, - * starting at src into four base64 characters in the target area - * until the entire input buffer is encoded. - */ -int HSF_API hfcrypto_base64_encode(char *src, uint32_t srclength, char *target, uint32_t targsize); - -/** - * @brief decode Base64 data. - * - * @param[in] src: input byte array - * target: output byte array - * targsize: size of output byte array - * @return[out] returns the number of data bytes stored at the target, or -1 on error. - * @see None. - * @note decode Base64 data, skips all whitespace anywhere. converts - * characters, four at a time, starting at (or after) src from Base64 - * numbers into three 8 bit bytes in the target area.. - */ -int HSF_API hfcrypto_base64_decode(char *src, char *target, uint32_t targsize); - -/** - * @brief rsa public key operation (1024bit key). - * - * @param[in] key: the key of RSA - * data: the data want to decrypt - * data_len: the length of data - * @return[out] the length of encrypted data - * @see None. - * @note None. - */ -// int HSF_API hfcrypto_rsa_public(const unsigned char *key, unsigned char *data, int data_len); - -/** - * @brief HMAC-SHA1 algorithm. - * - * @param[in] key: the key of HMAC-SHA1 - * key_len: the length of key - * data: the data want to calculate HMAC-SHA1 - * data_len: the length of data - * mac: the hash (20 bytes) - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfcrypto_hmac_sha1(const unsigned char *key, int key_len, const unsigned char *data, int data_len, unsigned char *mac); - - - -/** - * @brief AES CBC模式解密 - * - * @param input 文本输入 - * @param input_len 输入文本长度 - * @param output 文本输出 - * @param output_len 文本输出最大长度 - * @param key 秘钥 - * @param key_len 秘钥长度 - * @param iv 初始化向量 - * @param iv_len 初始化向量长度 - * @return uint8_t 返回是否解密成功,0:不成功,1:成功 - */ -uint8_t aes_cbc_decipher(uint8_t *input, uint32_t input_len, - uint8_t *output, uint32_t output_len, - uint8_t *key, uint32_t key_len, - uint8_t *iv, uint32_t iv_len); - - - -#if 1 - -#define Nb 4 //加解密数据块大小,固定为4 -// GF(2^8) 多项式 -#define BPOLY 0x1B //x^4 + x^3 + x^1 + x^0= 从右边开始算,bit0、bit1、bit3、bit4、为1,bit2、bit5、bit6、bit7为0,即00011011=0x1B - -//加密类型对应的密匙长度,单位bit -typedef enum { - AES128 = 128, - AES192 = 192, - AES256 = 256, -} AESType_t; - -//加解密模式 -typedef enum { - AES_MODE_ECB = 0, // 电子密码本模式 - AES_MODE_CBC = 1, // 密码分组链接模式 -} AESMode_t; - -typedef struct { - int Nk; //用户不需要填充,密钥长度,单位字节, AES128:Nk=16、AES192:Nk=24、AES256:Nr=32 - int Nr; //用户不需要填充,加密的轮数 AES128:Nr=10、AES192:Nr=12、AES256:Nr=14 - AESType_t type;//用户需填充,关联AESType_t - AESMode_t mode;//用户需填充,关联AESMode_t - const void *key;//用户需填充,密匙 - const void *pIV;//用户需填充,初始化向量, 当mode=AES_MODE_CBC时需要设置,指向unsigned char IV[4*Nb]; - //AES拓展密匙, 空间大小 AES128:4*Nb*(10+1):4*Nb*(12+1)、AES256:4*Nb*(14+1) - unsigned char expandKey[4*Nb*(14+1)];//用户不需要填充,[4*Nb*(Nr+1)]、这里按最大的AES256进行初始化 -} AESInfo_t; - - -/***************************************************************************** -* 函数名: AESInit -* 功能描述: 初始化 -* 输入参数: aesInfoP -- 用户需要填充 -* 输出参数: 无。 -* 返回值: 无。 -*****************************************************************************/ -void AESInit(AESInfo_t *aesInfoP); - - - -/***************************************************************************** -* 函数名: AESEncrypt -* 功能描述: 加密数据 -* 输入参数: aesInfoP -- 包含key、加密方式等初始化信息 -* pPlainText -- 要加密的明文数据,其长度为dataLen字节。 -* dataLen -- 明文数据长度,以字节为单位 -* 输出参数: pCipherText -- 加密后的数据 -* 返回值: 解密后的数据长度。 -*****************************************************************************/ -unsigned int AESEncrypt(AESInfo_t *aesInfoP, const unsigned char *pPlainText, unsigned char *pCipherText, unsigned int dataLen); - - - -/***************************************************************************** -* 函数名: AESDecrypt -* 功能描述: 解密数据 -* 输入参数: aesInfoP -- 包含key、加密方式等初始化信息 -* pCipherText -- 要解密的密文 -* dataLen -- 密文数据长度,以字节为单位,必须是整倍数,AES128:16倍数、AES192:24倍数、AES256:32倍数。 -* 输出参数: pPlainText -- 解密出来的明文 -* 返回值: 返回解密后的数据长度。 -*****************************************************************************/ -unsigned int AESDecrypt(AESInfo_t *aesInfoP, unsigned char *pPlainText, const unsigned char *pCipherText, unsigned int dataLen); - -#endif - - -#ifdef __cplusplus -} - -#endif -#endif - diff --git a/application/ws63/hsf/hfflash.h b/application/ws63/hsf/hfflash.h deleted file mode 100755 index ec5cdf2..0000000 --- a/application/ws63/hsf/hfflash.h +++ /dev/null @@ -1,103 +0,0 @@ -/* hfflash.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_FLASH_H_ -#define _HF_FLASH_H_ - -#include "hsf.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -int HSF_IAPI hfflash_init(void); - -unsigned int HSF_IAPI hfflash_size(void); - -int HSF_IAPI flash_write(unsigned int addr, unsigned char *data, int len, int no_used); - -int HSF_IAPI flash_erase_page(unsigned int addr, int pages); - -int HSF_IAPI flash_erase_write(unsigned int addr, unsigned char *data, int len, int no_used); - -int HSF_IAPI flash_read(unsigned int addr, unsigned char *data, int len, int no_used); - -int HSF_IAPI flash_copy(unsigned int dstaddr, unsigned int srcaddr, int len); - -int HSF_IAPI flash_valid_addr(unsigned int addr); - -int HSF_IAPI flash_enable(int enable); - -uint32_t HSF_IAPI hfget_flash_jedec_id(void); - -void HSF_IAPI hfset_flash_jedec_id(uint32_t JedecId); - - -#define hfflash_write flash_write -#define hfflash_erase_page flash_erase_page -#define hfflash_erase_write flash_erase_write -#define hfflash_read flash_read -#define hfflash_copy flash_copy -#define hfflash_enable flash_enable - - -#define HFFLASH_PAGE_SIZE (4*1024) - -/** - * @brief get the size of uflash, in bytes. - * - * @param[in] None - * @return[out] the size of uflash, in bytes - * @see None. - * @note None. - */ -int HSF_API hfuflash_size(void); - -/** - * @brief erase uflash. - * - * @param[in] addr: the address of flash, start from 0 - * pages: the number of pages to be erased, must <= 8, one page is 4096 bytes - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfuflash_erase_page(uint32_t addr, int pages); - -/** - * @brief write data to uflash. - * - * @param[in] addr: the address of flash, start from 0 - * data: a pointer to data - * len: the len of data - * @return[out] the length of write success - * @see None. - * @note None. - */ -int HSF_API hfuflash_write(uint32_t addr, char *data, int len); - -/** - * @brief read data from uflash. - * - * @param[in] addr: the address of flash, start from 0 - * data: a pointer to data - * len: the len of data - * @return[out] the length of read success - * @see None. - * @note None. - */ -int HSF_API hfuflash_read(uint32_t addr, char *data, int len); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfflashlayout.h b/application/ws63/hsf/hfflashlayout.h deleted file mode 100755 index ff3dd76..0000000 --- a/application/ws63/hsf/hfflashlayout.h +++ /dev/null @@ -1,64 +0,0 @@ -/* hfflashlayout.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_FLASH_LAYOUT_H_ -#define _HF_FLASH_LAYOUT_H_ - - -#define CONFIG_FLASH_SIZE_4MB -#define CONFIG_FLASH_SIZE (1024*1024*4) - -#define BOOT_ADDRESS 0x00002000 //BOOT -#define BOOT_SIZE (64*1024) - - - - - -#define SOFTWARE_CODE_ADDRESS 0x00030000 //CODE区 -#define MAX_SOFTWARE_CODE_SIZE (1720*1024) - -#define SOFTWARE_HILINK_CODE_ADDRESS 0x001DE000 //HILINK CODE区 -#define MAX_SOFTWARE_HILINK_CODE_SIZE (512*1024) - -#define UPGRADE_ADDRESS 0x0025E000 //OTA区 -#define MAX_UPGRADE_FILE_SIZE (1536*1024) - -#define HILINK_FILE_SYS 0x003F3000 //HILINK文件系统区 -#define HILINK_FILE_SYS_SIZE 0x00008000 - - - -#define UFLASH_ADDRESS 0x003DE000 //UFLASH区 -#define HFUFLASH_SIZE (56*1024) - -#define BOOT_CONFIG 0x003EC000 //HF_BOOT配置区 -#define PRODUCT_PARA_ADDR 0x003ED000 //JSON配置MAC区 - - -#define USERPAGE 0x003EE000 //AT参数存储区 -#define USERPAGE_BACKUP 0x003F2000 //AT参数备份区 -#define F_SETTING_ADDRESS 0x003F0000 //AT参数出厂值区 - -#define SECU_FLASH_ADDR 0x003F1000 //MAC存储区 -#define SECU_FLASH_BACKUP_ADDR 0x003EF000 //MAC备份区 - - - -#define UFLASH1_ADDRESS 0 -#define HFUFLASH1_SIZE (0) - - -#define HILINK_CRASH_INFO 0x003FB000 //程序崩溃信息区 -#define HILINK_CRASH_INFO_SIZE 0x00001000 - -#define HILINK_NV_DATA 0x003FC000 //HILINK NV区 -#define HILINK_NV_DATA_SIZE 0x00004000 - -#endif - diff --git a/application/ws63/hsf/hfgpio.h b/application/ws63/hsf/hfgpio.h deleted file mode 100755 index 2096d32..0000000 --- a/application/ws63/hsf/hfgpio.h +++ /dev/null @@ -1,434 +0,0 @@ - /* hfgpio.h - * - * Copyright (C) 2023 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_GPIO_H_ -#define _HF_GPIO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef void (*hfgpio_interrupt_func)(uint32_t irq, uint32_t fid); - -#define HFM_PIN_NUMBER (32+1) - -#define HFM_TYPE_LPT262 0 -#define HFM_TYPE_LPT263 1 -#define HFM_TYPE_LPT162 2 - - -#define HFM_MAX_FUNC_CODE (HFM_PIN_NUMBER*3) - -enum HF_GPIO_FUNC_E -{ - //////fix///////////////////// - HFGPIO_F_JTAG_TCK=0, - HFGPIO_F_JTAG_TDO=1, - HFGPIO_F_JTAG_TDI, - HFGPIO_F_JTAG_TMS, - HFGPIO_F_USBDP, - HFGPIO_F_USBDM, - HFGPIO_F_UART0_TX, - HFGPIO_F_UART0_RTS, - HFGPIO_F_UART0_RX, - HFGPIO_F_UART0_CTS, - HFGPIO_F_SPI_MISO, - HFGPIO_F_SPI_CLK, - HFGPIO_F_SPI_CS, - HFGPIO_F_SPI_MOSI, - HFGPIO_F_UART1_TX, - HFGPIO_F_UART1_RTS, - HFGPIO_F_UART1_RX, - HFGPIO_F_UART1_CTS, - //////////////////////////////// - HFGPIO_F_NLINK, - HFGPIO_F_NREADY, - HFGPIO_F_NRELOAD, - HFGPIO_F_SLEEP_RQ, - HFGPIO_F_SLEEP_ON, - HFGPIO_F_WPS, - - HFGPIO_F_RESERVE1, - HFGPIO_F_RESERVE2, - HFGPIO_F_RESERVE3, - HFGPIO_F_RESERVE4, - HFGPIO_F_RESERVE5, - HFGPIO_F_USER_DEFINE -}; - -#define F_GPI (0x00010000) -#define F_GPO (0x00020000) -//GND -#define F_GND (0x00040000) -//vcc -#define F_VCC (0x00100000) -#define F_NC (0x00200000) -//use to system reset -#define F_RST (0x00400000) -//use to interrupt input pin -#define F_IT (0x00800000|F_GPI) - -#define F_GPIO (F_GPI|F_GPO) - -#define F_PWM (0x01000000) -#define F_PWM0 F_PWM -#define F_PWM1 F_PWM -#define F_PWM2 F_PWM -#define F_PWM3 F_PWM -#define F_PWM4 F_PWM - -#define F_ADC (0x02000000) - -#define HFM_NOPIN (0) -#define HFM_PIN1 (F_NC|1) -#define HFM_PIN2 (F_VCC|2) -#define HFM_PIN3 (F_VCC|3) -#define HFM_PIN4 (F_GPIO|F_IT|4) -#define HFM_PIN5 (F_GPIO|F_IT|5) -#define HFM_PIN6 (F_GPIO|F_IT|6) -#define HFM_PIN7 (F_GPIO|F_IT|7) -#define HFM_PIN8 (F_GPIO|F_IT|8) -#define HFM_PIN9 (F_GPIO|F_IT|9) -#define HFM_PIN10 (F_GPIO|F_IT|10) -#define HFM_PIN11 (F_GPIO|F_IT|11) -#define HFM_PIN12 (F_GPIO|F_IT|12) -#define HFM_PIN13 (F_GPIO|F_IT|13) -#define HFM_PIN14 (F_GPIO|F_IT|14) -#define HFM_PIN15 (F_GPIO|F_IT|15) -#define HFM_PIN16 (F_GPIO|F_IT|16) -#define HFM_PIN17 (F_VCC|17) -#define HFM_PIN18 (F_NC|18) -#define HFM_PIN19 (F_NC|19) -#define HFM_PIN20 (F_NC|20) -#define HFM_PIN21 (F_GND|21) -#define HFM_PIN22 (F_NC|22) -#define HFM_PIN23 (F_NC|23) -#define HFM_PIN24 (F_GPIO|F_IT|24) -#define HFM_PIN25 (F_GPIO|F_IT|25) -#define HFM_PIN26 (F_GPIO|F_IT|26) -#define HFM_PIN27 (F_GPIO|F_IT|27) -#define HFM_PIN28 (F_GPIO|F_IT|28) -#define HFM_PIN29 (F_GPIO|F_IT|29) -#define HFM_PIN30 (F_NC|30) -#define HFM_PIN31 (F_NC|31) -#define HFM_PIN32 (F_NC|32) - - -#define LPT26x_GPIO0 HFM_PIN4 -#define LPT26x_GPIO1 HFM_PIN5 -#define LPT26x_GPIO2 HFM_PIN6 -#define LPT26x_GPIO3 HFM_PIN7 -#define LPT26x_GPIO4 HFM_PIN8 -#define LPT26x_GPIO5 HFM_PIN9 -#define LPT26x_GPIO6 HFM_PIN10 -#define LPT26x_GPIO7 HFM_PIN11 -#define LPT26x_GPIO8 HFM_PIN12 -#define LPT26x_GPIO9 HFM_PIN13 -#define LPT26x_GPIO10 HFM_PIN14 -#define LPT26x_GPIO11 HFM_PIN15 -#define LPT26x_GPIO12 HFM_PIN16 -#define LPT26x_GPIO13 HFM_PIN24 -#define LPT26x_GPIO14 HFM_PIN25 -#define LPT26x_GPIO15 HFM_PIN26 -#define LPT26x_GPIO16 HFM_PIN27 -#define LPT26x_GPIO17 HFM_PIN28 -#define LPT26x_GPIO18 HFM_PIN29 - - - - - -#define HF_M_PINNO(_pin) ((_pin)&0xFF) - -#define HFM_VALID_PINNO(_pinno) ((_pinno)>0&&(_pinno)<=HFM_PIN_NUMBER) - -#define HF_M_PIN(_no) HFM_PIN##_no - -/* Default pin configuration (no attribute). */ -#define HFPIO_DEFAULT (0u << 0) -#define HFPIO_PULLUP (1u << 2) -#define HFPIO_PULLDOWN (1u << 3) - -/* Low level interrupt is active */ -#define HFPIO_IT_LOW_LEVEL (1u<<4) -/* High level interrupt is active */ -#define HFPIO_IT_HIGH_LEVEL (1u<<5) -/* Falling edge interrupt is active */ -#define HFPIO_IT_FALL_EDGE (1u<<6) -/* Rising edge interrupt is active */ -#define HFPIO_IT_RISE_EDGE (1u<<7) -/*Interrupt Edge detection is active.*/ -#define HFPIO_IT_EDGE (1u<<8) - -#define HFPIO_TYPE_Pos 27 -/* PIO Type Mask */ -#define HFPIO_TYPE_Msk (0x7u << HFPIO_TYPE_Pos) - -/* The pin is an input. */ -#define HFM_IO_TYPE_INPUT (0x01 << HFPIO_TYPE_Pos) -/* The pin is an output and has a default level of 0.*/ -#define HFM_IO_OUTPUT_0 (0x02 << HFPIO_TYPE_Pos) -/* The pin is an output and has a default level of 1.*/ -#define HFM_IO_OUTPUT_1 (0x04 << HFPIO_TYPE_Pos) -#define HFPIO_DS (0x8u << HFPIO_TYPE_Pos) - - -void HSF_IAPI hfgpio_init(void); - -int HSF_IAPI hfgpio_get_pid(int gpio); - -int HSF_IAPI hfgpio_get_chip_pin(int fid); - -int HSF_IAPI hfgpio_configure_pin(int pid,int flags); - -int HSF_IAPI hfgpio_pin_is_high(int pid); - -int HSF_IAPI hfgpio_fpin_add_feature(int fid,int flags); - -int HSF_IAPI hfgpio_fpin_clear_feature(int fid,int flags); - -void HSF_IAPI hfgpio_gpio_test_enable(int enable); - -void HSF_IAPI hfgpio_set_nlink_pin(int val); - -void HSF_IAPI hfgpio_set_nready_pin(int val); - -int HSF_IAPI hfgpio_reload_pin_is_low(void); - -#define hfgpio_set_out_high(pid) hfgpio_configure_pin(pid,HFPIO_DEFAULT|HFM_IO_OUTPUT_1) - -#define hfgpio_set_out_low(pid) hfgpio_configure_pin(pid,HFPIO_DEFAULT|HFM_IO_OUTPUT_0) - - -/** - * @brief check the validity of hf_gpio_fid_to_pid_map_table. - * - * @param[in] type: the module type, as follows - * ========================================== - * | HFM_TYPE_LPT262 | - * |----------------------------------------| - * | HFM_TYPE_LPT263 | - * |----------------------------------------| - * | HFM_TYPE_LPT162 | - * ========================================== - * @return[out] HF_SUCCESS-successfully, other value is have multiple functions in the same pin - * @see None. - * @note None. - */ -int HSF_API hfgpio_fmap_check(int type); - -/** - * @brief set the configure parameters of pin by the function id. - * - * @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * flags: the flag of pin, as follows, can be used together, such as: HFPIO_DEFAULT|HFM_IO_TYPE_INPUT - * ========================================== - * | HFPIO_DEFAULT | - * |----------------------------------------| - * | HFM_IO_TYPE_INPUT | - * |----------------------------------------| - * | HFM_IO_OUTPUT_0 | - * |----------------------------------------| - * | HFM_IO_OUTPUT_1 | - * ========================================== - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal, HF_E_ACCES-not allowed - * @see None. - * @note None. - */ -int HSF_API hfgpio_configure_fpin(int fid, int flags); - -/** - * @brief get the configure parameters of pin by the function id. - * - * @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] the configure parameters of pin - * @see None. - * @note None. - */ -int HSF_API hfgpio_fconfigure_get(int fid); - -/** - * @brief set the pin to high level by the function id. - * - * @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal - * @see None. - * @note None. - */ -#define hfgpio_fset_out_high(fid) hfgpio_configure_fpin(fid,HFPIO_DEFAULT|HFM_IO_OUTPUT_1) - -/** - * @brief set the pin to low level by the function id. - * - * @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal - * @see None. - * @note None. - */ -#define hfgpio_fset_out_low(fid) hfgpio_configure_fpin(fid,HFPIO_DEFAULT|HFM_IO_OUTPUT_0) - -/** - * @brief configure the interrupt of pin by the function id. - * -* @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * flags: the interrupt type, as follows - * ========================================== - * | HFPIO_IT_LOW_LEVEL | - * |----------------------------------------| - * | HFPIO_IT_HIGH_LEVEL | - * |----------------------------------------| - * | HFPIO_IT_FALL_EDGE | - * |----------------------------------------| - * | HFPIO_IT_RISE_EDGE | - * ========================================== - * handle: a function pointer, called back when trigger - * enable: enable or disable to trigger - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal, HF_E_ACCES-not allowed - * @see None. - * @note None. Timers cannot be used during interrupts - */ -int HSF_API hfgpio_configure_fpin_interrupt(int fid, uint32_t flags, hfgpio_interrupt_func handle, int enable); - -/** - * @brief enable interrupt of pin by the function id. - * -* @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal - * @see None. - * @note None. Timers cannot be used during interrupts - */ -int HSF_API hfgpio_fenable_interrupt(int fid); - -/** - * @brief disable interrupt of pin by the function id. - * -* @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed, HF_E_INVAL-illegal - * @see None. - * @note None. Timers cannot be used during interrupts - */ -int HSF_API hfgpio_fdisable_interrupt(int fid); - -/** - * @brief disable interrupt of all pins by the function id. - * -* @param[in] fid:None - * @return[out] HF_SUCCESS-successfully, HF_FAIL-failed - * @see None. - * @note None. Timers cannot be used during interrupts - */ -int HSF_API hfgpio_disabel_all_interrupt(void); - -/** - * @brief check the level of the pin to be high by the function id. - * -* @param[in] fid: the function id define by table 'hf_gpio_fid_to_pid_map_table' - * @return[out] >=1 high level, <=0 low level or illegal - * @see None. - * @note effective in output mode and input mode. - */ -int HSF_API hfgpio_fpin_is_high(int fid); - -/** - * @brief check whether or not in GPIO test mode . - * - * @param[in] None - * @return[out] 0-not in test mode, 1-in test mode - * @see None. - * @note None. - */ -int HSF_API hfgpio_gpio_test_is_running(void); - -/** - * @brief stop PWM. - * - * @param[in] fid: the function id of gpio - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfgpio_pwm_disable(int fid); - -/** - * @brief start PWM. - * - * @param[in] fid: the function id of gpio - * freq: the frequency of PWM, the range is [100-800000] - * hrate: the duty cycle of PWM, the range is [0-100], 0 means low, 100 means high - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note the same PWM channel cannot be used at the same time. - */ -int HSF_API hfgpio_pwm_enable(int fid, int freq, int hrate); - -/** - * @brief start PWM. - * - * @param[in] fid: the function id of gpio - * freq: the frequency of PWM, max is 20000000 - * percent: high level ratio, accurate 0.0001 - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note the same PWM channel cannot be used at the same time. - */ -int HSF_API hfgpio_pwm_enable_ex(int fid, int freq, float percent); - -/** - * @brief start ADC. - * - * @param[in] fid: the function id of gpio - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfgpio_adc_enable(int fid); - -/** - * @brief get ADC value. - * - * @param[in] fid: the function id of gpio - * @return[out] - <0-failed - >=0-the value of ADC, [0-3200] indicate [0V-3.2V] - * @see None. - * @note None. - */ -int HSF_API hfgpio_adc_get_value(int fid); - -/** - * @brief init infrared function. - * - * @param[in] fid: the function id of gpio - * @see None. - * @note None. - */ -void HSF_API hf_ir_init(int fid); -/** - * @brief infrared enable. - * - * @param[in] fid: the function id of gpio - * @see None. - * @note None. - */ -void HSF_API hf_ir_enable(void); -/** - * @brief infrared disable. - * - * @param[in] fid: the function id of gpio - * @see None. - * @note None. - */ -void HSF_API hf_ir_disable(void); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfmd5.h b/application/ws63/hsf/hfmd5.h deleted file mode 100755 index c62130e..0000000 --- a/application/ws63/hsf/hfmd5.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __MD5_H__ -#define __MD5_H__ - -typedef struct -{ - unsigned int count[2]; - unsigned int state[4]; - unsigned char buffer[64]; -}IOT_MD5_CTX; - - -#define F(x,y,z) ((x & y) | (~x & z)) -#define G(x,y,z) ((x & z) | (y & ~z)) -#define H(x,y,z) (x^y^z) -#define I(x,y,z) (y ^ (x | ~z)) -#define ROTATE_LEFT(x,n) ((x << n) | (x >> (32-n))) -#define FF(a,b,c,d,x,s,ac) \ -{ \ - a += F(b,c,d) + x + ac; \ - a = ROTATE_LEFT(a,s); \ - a += b; \ -} -#define GG(a,b,c,d,x,s,ac) \ -{ \ - a += G(b,c,d) + x + ac; \ - a = ROTATE_LEFT(a,s); \ - a += b; \ -} -#define HH(a,b,c,d,x,s,ac) \ -{ \ - a += H(b,c,d) + x + ac; \ - a = ROTATE_LEFT(a,s); \ - a += b; \ -} -#define II(a,b,c,d,x,s,ac) \ -{ \ - a += I(b,c,d) + x + ac; \ - a = ROTATE_LEFT(a,s); \ - a += b; \ -} -void IOT_MD5Init(IOT_MD5_CTX *context); -void IOT_MD5Update(IOT_MD5_CTX *context,unsigned char *input,unsigned int inputlen); -void IOT_MD5Final(IOT_MD5_CTX *context,unsigned char digest[16]); -void IOT_MD5Transform(unsigned int state[4],unsigned char block[64]); -void IOT_MD5Encode(unsigned char *output,unsigned int *input,unsigned int len); -void IOT_MD5Decode(unsigned int *output,unsigned char *input,unsigned int len); -void IOT_MD5_format2str(unsigned char *encrypt, unsigned char *buffer); -#endif diff --git a/application/ws63/hsf/hfnet.h b/application/ws63/hsf/hfnet.h deleted file mode 100755 index 4d435f3..0000000 --- a/application/ws63/hsf/hfnet.h +++ /dev/null @@ -1,99 +0,0 @@ - -#ifndef _HF_NET_H_ -#define _HF_NET_H_ - -#include "lwip/sockets.h" - - -#define HFUART0 (hfuart_handle_t)(1) -#define HFUART1 (hfuart_handle_t)(2) - - -#define ASSIS_PORT 48899 - - -typedef enum -{ - HFNET_SOCKETA_DATA_READY=0, - HFNET_SOCKETA_CONNECTED=1, - HFNET_SOCKETA_DISCONNECTED, - HFNET_SOCKETB_DATA_READY, - HFNET_SOCKETB_CONNECTED, - HFNET_SOCKETB_DISCONNECTED, - HFNET_UART0_DATA_READY, - HFNET_UART1_DATA_READY, - HFNET_ASSIS_DATA_READY -}hfnet_event_id_t; - - -typedef struct _hfnet_stat -{ - int hfnet_init_down; - - int socketa_send_bytes; - int socketa_recv_bytes; - int socketa_connect_times; - - int uart_send_bytes; - int uart_recv_bytes; - - int socketb_send_bytes; - int socketb_recv_bytes; - int socketb_connect_times; - - int uart_buffer_full_times; - int uart_irq_num; - int uart_thread_run; - - int uart1_buffer_full_times; - int uart1_irq_num; - int uart1_thread_run; - - int socketa_buffer_full_times; - int drop_arp_packet; - int drop_udp_broadcast_packet; -}hfnet_stat; - -extern hfnet_stat g_hfnet_stat; - - -typedef int (*hfnet_callback_t)( uint32_t event,void *data,uint32_t len,uint32_t buf_len); - -int hfnet_start_uart(uint32_t uxpriority, hfnet_callback_t p_callback); - - -int HSF_API hfnet_start_assis(uint16_t port); - -int HSF_API hfnet_get_mac_address(char *mac_str); - -int HSF_API hfnet_get_wan_ip(uint32_t * ip, uint32_t *mask, uint32_t *gw); -struct netif *hf_get_sta_netif(void); -int hfwifi_sta_is_connected(void); - -int HSF_API hfnet_wifi_is_active(void); - -int HSF_IAPI hfnet_send_assis_event(uint32_t event,void *data,uint32_t len,uint32_t buf_len); - -/** - * @brief get ip address by domain name. - * - * @param[in] name: domain name - * addr: a pointer for using to store addr - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfnet_gethostbyname(const char *name, ip_addr_t *addr); - -/** - * @brief check string is ip address. - * - * @param[in] ipaddr: ip string - * @return[out] 1-ip address, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfnet_is_ipaddress(const char * ipaddr); - -#endif - diff --git a/application/ws63/hsf/hfntp.h b/application/ws63/hsf/hfntp.h deleted file mode 100755 index 97cb99c..0000000 --- a/application/ws63/hsf/hfntp.h +++ /dev/null @@ -1,38 +0,0 @@ - /* hfntp.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_NTP_H_ -#define _HF_NTP_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - - -#define DEFAULT_NTP_SERVER "cn.ntp.org.cn" - - -/** - * @brief get UTC time from NTP server. - * - * @param[in] addr: NTP server address, support domain name - * port: NTP server port, such as "123" - * timeout: recv response timeout, in milliseconds - * @return[out] >0 UTC time from 1970-01-01 00:00, <0 is failed - * @see None. - * @note None. - */ -int HSF_API hfntp_get_time(const char *addr, unsigned short port, int timeout); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfproduct.h b/application/ws63/hsf/hfproduct.h deleted file mode 100755 index aac3984..0000000 --- a/application/ws63/hsf/hfproduct.h +++ /dev/null @@ -1,34 +0,0 @@ -/* hfproduct.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_PRODUCT_H_ -#define _HF_PRODUCT_H_ - -#include "hsf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _product_cmd -{ - const char * name; - void (*callhook)(int, char *); -} hfproduct_cmd_t,*phfproduct_cmd_t; - - -void HSF_IAPI hfproduct_init(void); -void HSF_IAPI hfproduct_read_mac(void); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfsecret.h b/application/ws63/hsf/hfsecret.h deleted file mode 100755 index 756a9c6..0000000 --- a/application/ws63/hsf/hfsecret.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _HF_SECRET_H__ -#define _HF_SECRET_H__ - -#include "hsf.h" -#define KEY_LEN 8 -#define MAC_LEN 6 - -void HSF_IAPI hfwifi_init(void); - -#define SECRET_MASSAGE_SIZE 256 - -#endif diff --git a/application/ws63/hsf/hfsys.h b/application/ws63/hsf/hfsys.h deleted file mode 100755 index 53ec983..0000000 --- a/application/ws63/hsf/hfsys.h +++ /dev/null @@ -1,120 +0,0 @@ - -#ifndef _HF_SYS_H_ -#define _HF_SYS_H_ - - - -#define MOD_ERROR_START(x) ((x << 16) | 0) - -/* Create Module index */ -#define MOD_GENERIC 0 -/** HTTPD module index */ -#define MOD_HTTPDE 1 -/** HTTP-CLIENT module index */ -#define MOD_HTTPC 2 -/** WPS module index */ -#define MOD_WPS 3 -/** WLAN module index */ -#define MOD_WLAN 4 -/** USB module index */ -#define MOD_USB 5 - -#define MOD_USER_DEFINE (0x80) - - -/* Globally unique success code */ -#define HF_SUCCESS 0 - - - -#define HFSYS_RESET_REASON_NORMAL (0) - -#define HFSYS_RESET_REASON_OTA (0x00000100) - - -enum hf_errno { - /* First Generic Error codes */ - HF_GEN_E_BASE = MOD_ERROR_START(MOD_GENERIC), - HF_FAIL, - HF_E_PERM, /* Operation not permitted */ - HF_E_NOENT, /* No such file or directory */ - HF_E_SRCH, /* No such process */ - HF_E_INTR, /* Interrupted system call */ - HF_E_IO, /* I/O error */ - HF_E_NXIO, /* No such device or address */ - HF_E_2BIG, /* Argument list too long */ - HF_E_NOEXEC, /* Exec format error */ - HF_E_BADF, /* Bad file number */ - HF_E_CHILD, /* No child processes */ - HF_E_AGAIN, /* Try again */ - HF_E_NOMEM, /* Out of memory */ - HF_E_ACCES, /* Permission denied */ - HF_E_FAULT, /* Bad address */ - HF_E_NOTBLK, /* Block device required */ - HF_E_BUSY, /* Device or resource busy */ - HF_E_EXIST, /* File exists */ - HF_E_XDEV, /* Cross-device link */ - HF_E_NODEV, /* No such device */ - HF_E_NOTDIR, /* Not a directory */ - HF_E_ISDIR, /* Is a directory */ - HF_E_INVAL, /* Invalid argument */ - HF_E_NFILE, /* File table overflow */ - HF_E_MFILE, /* Too many open files */ - HF_E_NOTTY, /* Not a typewriter */ - HF_E_TXTBSY, /* Text file busy */ - HF_E_FBIG, /* File too large */ - HF_E_NOSPC, /* No space left on device */ - HF_E_SPIPE, /* Illegal seek */ - HF_E_ROFS, /* Read-only file system */ - HF_E_MLINK, /* Too many links */ - HF_E_PIPE, /* Broken pipe */ - HF_E_DOM, /* Math argument out of domain of func */ - HF_E_RANGE, /* Math result not representable */ - HF_E_DEADLK, /*Resource deadlock would occur*/ -}; - - - - -enum HFSYS_RUN_MODE_E -{ - HFSYS_STATE_RUN_THROUGH=0, - HFSYS_STATE_RUN_CMD=1, - HFSYS_STATE_RUN_GPIO, - HFSYS_STATE_RUN_PWM, - HFSYS_STATE_MAX_VALUE -}; - - - - -void HSF_API hfsys_reset(void); - -uint32_t HSF_API hfsys_get_time(void); - -int HSF_API hfsys_switch_run_mode(int mode); - -int HSF_API hfsys_get_run_mode(void); - -void HSF_API *hfmem_malloc(int size); -void HSF_API hfmem_free(void *pv); -uint32_t HSF_API hfsys_get_memory(void); - - -int HSF_API hfwifi_read_sta_mac_address(uint8_t *mac); -int HSF_IAPI hfwifi_write_sta_mac_address(uint8_t *mac, char *key); - -uint32_t HSF_API hfsys_get_reset_reason(void); - -void HSF_API hfsys_set_reset_reason(uint32_t reason); - -int HSF_API hfwifi_read_sle_mac_address(uint8_t *mac); - -int HSF_API hfwifi_write_sle_mac_address(uint8_t *mac); - -int HSF_API hfwifi_read_ap_mac_address(uint8_t *mac); - -unsigned int HSF_API hfsys_random(void); - -void HSF_API hfsys_set_time(uint32_t t); -#endif diff --git a/application/ws63/hsf/hfthread.h b/application/ws63/hsf/hfthread.h deleted file mode 100755 index 91e4035..0000000 --- a/application/ws63/hsf/hfthread.h +++ /dev/null @@ -1,125 +0,0 @@ - -#include "hsf.h" - -#define HFTHREAD_PRIORITIES_LOW (15) -#define HFTHREAD_PRIORITIES_MID (13) -#define HFTHREAD_PRIORITIES_NORMAL (10) -#define HFTHREAD_PRIORITIES_HIGH (8) -#define HFTHREAD_MAX_PRIORITIES (1) - - -typedef void (*PHFTHREAD_START_ROUTINE)( void * arg); - -typedef void* hfthread_sem_t; - -int hfthread_create(PHFTHREAD_START_ROUTINE routine, char * name, uint16_t stack_depth, void *parameters, uint32_t uxpriority, uint32_t *created_thread, uint32_t *stack_buffer); - -int hfsys_init(void); - -void HSF_API hfthread_delay(uint32_t ms); -void HSF_API hfthread_destroy(uint32_t task_id); - - -#define msleep(ms) hfthread_delay(ms) - - -typedef void* hfthread_mutex_t; - -#define NULL_MUTEX (hfthread_mutex_t)0 - -/** - * @brief create a mutex, not allow in ISR. - * - * @param[in] mutex: a pointer to mutex handle - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfthread_mutext_new(hfthread_mutex_t *pmutex); - -/** - * @brief free a mutex, not allow in ISR. - * - * @param[in] pmutex: the specified mutex handle - * @return[out] None - * @see None. - * @note None. - */ -void HSF_API hfthread_mutext_free(hfthread_mutex_t mutex); - -/** - * @brief releases ownership of the specified mutex object, not allow in ISR. - * - * @param[in] mutex: the specified mutex handle - * @return[out] None - * @see None. - * @note None. - */ -void HSF_API hfthread_mutext_unlock(hfthread_mutex_t mutex); - -/** - * @brief waits until the specified mutex is in the signaled state, not allow in ISR. - * - * @param[in] mutex: the specified mutex handle - * timeout: timeout interval in millisecond, value >= 10, 0xFFFFFFFF mean the function will return only when the mutex is signaled - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfthread_mutext_wait(hfthread_mutex_t mutex, uint32_t timeout); - -/** - * @brief try to wait a mutex, not allow in ISR. - * - * @param[in] mutex: the specified mutex handle - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfthread_mutext_trylock(hfthread_mutex_t mutex); - -#define hfthread_mutext_lock(_mu) hfthread_mutext_wait(_mu,0xFFFFFFFF) - - -/** - * @brief create a semaphore, not allow in ISR. - * - * @param[in] sem: a pointer to semaphore handle - * cnt: the count of the semaphore, maximum is 255 - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfthread_sem_new(hfthread_sem_t *sem,uint8_t cnt); - -/** - * @brief free a semaphore, not allow in ISR. - * - * @param[in] sem: the specified semaphore handle - * @return[out] None - * @see None. - * @note None. - */ -void HSF_API hfthread_sem_free(hfthread_sem_t sem); - -/** - * @brief increases the count of the specified semaphore object by 1. - * - * @param[in] sem: the specified semaphore handle - * @return[out] None - * @see None. - * @note None. - */ -void HSF_API hfthread_sem_signal(hfthread_sem_t sem); - -/** - * @brief wait until the specified mutex is in the signaled state or the time-out interval elapses, not allow in ISR. - * - * @param[in] sem: the specified semaphore handle - * timeout: timeout interval in millisecond, value >= 10, 0xFFFFFFFF mean the function will return only when the semaphore is signaled - * @return[out] 1-the state of the specified object is signaled, 0-the time-out interval elapsed, and the object's state is nonsignaled - * @see None. - * @note None. - */ -int HSF_API hfthread_sem_wait(hfthread_sem_t sem, uint32_t timeout); - diff --git a/application/ws63/hsf/hftime.h b/application/ws63/hsf/hftime.h deleted file mode 100755 index 527347f..0000000 --- a/application/ws63/hsf/hftime.h +++ /dev/null @@ -1,46 +0,0 @@ -/* hftime.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_TIME_H_ -#define _HF_TIME_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include -#include "hsf.h" - - -#ifdef CONFIG_NO_STRUCT_TIMEZONE -struct timezone -{ - int tz_minuteswest; - int tz_dsttime; -}; -#endif - -time_t time(time_t *timer); - - -#if !CONFIG_HAVE_SETTIMEOFDAY -int settimeofday(const struct timeval * tv, const struct timezone *tz); -#endif - -#if !CONFIG_HAVE_GETTIMEOFDAY -int gettimeofday(struct timeval * tv, struct timezone * tz); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfuart.h b/application/ws63/hsf/hfuart.h index a998c75..2cba501 100755 --- a/application/ws63/hsf/hfuart.h +++ b/application/ws63/hsf/hfuart.h @@ -57,6 +57,11 @@ typedef struct _HFUART }HFUART,*PHFUART; + +#define DATA_UART (hfuart_handle_t)(1) +#define DEBUG_UART (hfuart_handle_t)(2) + + void HSF_API HF_Debug(int debug_level, const char *format , ... ); #define hfdbg_error(...) HF_Debug(DEBUG_ERROR,"[ %d error %s %d]",hfsys_get_time(),__FUNCTION__,__LINE__); \ diff --git a/application/ws63/hsf/hfupdate.h b/application/ws63/hsf/hfupdate.h deleted file mode 100755 index 238a56c..0000000 --- a/application/ws63/hsf/hfupdate.h +++ /dev/null @@ -1,137 +0,0 @@ -/* hfupdate.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HF_UPDATE_H_ -#define _HF_UPDATE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define HF_CONFIG_OTA_FLAG_REDAY (0x0A0A55A0) -#define HF_CONFIG_OTA_FLAG_OK (0x0505AA50) -#define HF_BOOT_CONFIG_MAGIC_CODE (0x48464254) -#define HF_CONFIG_OTA_FLAG_FAIL (0x5A5A5A00) - -#define HF_BOOT_RUN_MODE_NORMAL (0) -#define HF_BOOT_RUN_MODE_AUTO_UPGRADE (0xA5010202) -#define HF_BOOT_RUN_MODE_DEBUG (0xA5010203) - - -typedef enum HFUPDATE_TYPE -{ - HFUPDATE_SW=0, - HFUPDATE_CONFIG=1, - HFUPDATE_WIFIFW, - HFUPDATE_WEB, -}HFUPDATE_TYPE_E; - -typedef enum http_download_type{ - HTTP_DOWNLOAD_TYPE_TMP = 1, //下载到buff - HTTP_DOWNLOAD_TYPE_FLASH = 2, //下载到FLASH - HTTP_DOWNLOAD_LOCATION_UPGRADE = 4, //upgrade分区 - HTTP_DOWNLOAD_LOCATION_FLASH_UPGRADE = HTTP_DOWNLOAD_TYPE_FLASH|HTTP_DOWNLOAD_LOCATION_UPGRADE, //FLASH中upgrade分区 - HTTP_DOWNLOAD_LOCATION_WEB = 8, //web分区 - HTTP_DOWNLOAD_LOCATION_FLASH_WEB = HTTP_DOWNLOAD_TYPE_FLASH|HTTP_DOWNLOAD_LOCATION_WEB, //FLASH中web分区 -}http_download_type_t; - -int HSF_IAPI hfupdate_auto_upgrade(uint32_t flags); - -int HSF_IAPI http_download_enable_range(char enable); - -int HSF_IAPI hfupdate_auto_upgrade_start(void); - -int HSF_IAPI check_webpage_file_ok(char *addr, char *version); - - -/** - * @brief start OTA to update application. - * - * @param[in] type: update type, now only support 'HFUPDATE_SW' & 'HFUPDATE_WEB' - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note this function will need time to erase flash. - */ -int HSF_API hfupdate_start(HFUPDATE_TYPE_E type); - -/** - * @brief write update file. - * - * @param[in] type: update type, now only support 'HFUPDATE_SW' & 'HFUPDATE_WEB' - * offset: offset address, start from 0 - * data: a pointer to data - * len: the len of data - * @return[out] the length of write success - * @see None. - * @note this function will need some time to erase flash. - */ -int HSF_API hfupdate_write_file(HFUPDATE_TYPE_E type, uint32_t offset, uint8_t *data, int len); - -/** - * @brief complete update. - * - * @param[in] type: update type, now only support 'HFUPDATE_SW' & 'HFUPDATE_WEB' - * file_total_len: the len of file - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note return -1 means file type error, return -2 means file crc error. - */ -int HSF_API hfupdate_complete(HFUPDATE_TYPE_E type, uint32_t file_total_len); - -/** - * @brief download OTA file use http. - * - * @param[in] purl: http url - * @return[out] HF_SUCCESS-successfully, other value is failed - * @see None. - * @note None. - */ -int HSF_API hfupdate_fw_as_http(const char *purl); - -/** - * @brief get bootloader version. - * - * @param[in] version: the buffer to store bootloader version - * @return[out] the crc32 of bootloader, 0 is failed - * @see None. - * @note None. - */ -unsigned int HSF_API hfupdate_read_boot_ver(char *version); - -/** - * @brief check whether or not in updating - * - * @param[in] None - * @return[out] 0-not in updating, 1-in updating - * @see None. - * @note None. - */ -int HSF_API hfupdate_auto_upgrade_is_running(void); - -/** - * @desc: - * @params: start_range is 0,file_len is NULL when DISABLE_HTTP_DOWNLOAD_RANGE - * @param[in] purl: http url - * @param[in] p_data: a buffer or a FLASH address to store update file - * @param[in] len: the len of p_data FLASH - * @param[in] type: the HTTP Download data to LOCATION - * @param[in] start_range: Download from Start position - * @return[out] < 0 error numb , > 0 down file length - */ -int HSF_API http_download_file(const char *purl, char *p_data, uint32_t len, http_download_type_t type, int start_range, int *file_len); - - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/application/ws63/hsf/hfwifi.h b/application/ws63/hsf/hfwifi.h deleted file mode 100755 index 05f2efd..0000000 --- a/application/ws63/hsf/hfwifi.h +++ /dev/null @@ -1,84 +0,0 @@ - -/* hfupdate.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - - -#ifndef _HF_WIFI_H_ -#define _HF_WIFI_H_ - -#define DEBUG_WIFI DEBUG_LEVEL_LOW - -#define AUTH_TYPE_OPEN 0 -#define AUTH_TYPE_SHARED 1 -#define AUTH_TYPE_WPAPSK 2 -#define AUTH_TYPE_WPA2PSK 3 -#define AUTH_TYPE_WPAPSKWPA2PSK 4 -#define AUTH_TYPE_WPAENT 5 -#define AUTH_TYPE_WPA3SAE 6 -#define AUTH_TYPE_WPA2PSKWPA3SAE 7 - -#define ENC_TYPE_NONE 0 -#define ENC_TYPE_WEP 1 -#define ENC_TYPE_TKIP 2 -#define ENC_TYPE_AES 3 -#define ENC_TYPE_TKIPAES 4 -#define ENC_TYPE_CCMP 5 - -#define ENC_TYPE_INVALID 255 - -#define WIFI_MODE_AP 0 -#define WIFI_MODE_STA 1 -#define WIFI_MODE_APSTA 2 -#define WIFI_MODE_NOSTART 0xFF - -#define WIFI_STATE_UNINIT 0 -#define WIFI_STATE_START 1 -#define WIFI_STATE_STOPPING 2 -#define WIFI_STATE_STOPPED 3 - -#define MAX_WIFI_SCAN_RESULT 50 - - - typedef struct - { - char ssid[65]; - uint8_t mac[20]; - char enc[25]; - char channl; - int sco; - int rssi; - }ScanResult_t; - - typedef struct _WIFI_SCAN_RESULT_ITEM - { - uint8_t auth; - uint8_t encry; - uint8_t channel; - uint8_t rssi; - char ssid[32+1]; - uint8_t mac[6]; - int rssi_dbm; - int sco; - }WIFI_SCAN_RESULT_ITEM,*PWIFI_SCAN_RESULT_ITEM; - - enum - { - HFWIFI_SCAN_EXIT=0, - HFWIFI_SCANING=1 - }; - typedef int (*hfwifi_scan_callback_ex_t)(PWIFI_SCAN_RESULT_ITEM,void*); - void wifi_auto_connect(void* arg); - void product_wifi_thread(void* arg); - int HSF_API hfwifi_transform_rssi(int rssi_dbm); - int HSF_API hfwifi_scan_ex(hfwifi_scan_callback_ex_t p_callback, void *ctx, unsigned char ch, unsigned char scan_time); - int HSF_API hfwifi_sta_get_current_rssi(int *dBm); - int HSF_API hf_get_wifi_state(void); - void HSF_API hf_set_wifi_state(int state); - - -#endif diff --git a/application/ws63/hsf/hsf.h b/application/ws63/hsf/hsf.h deleted file mode 100755 index a3d3b73..0000000 --- a/application/ws63/hsf/hsf.h +++ /dev/null @@ -1,103 +0,0 @@ -/* hsf.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _HSF_H_ -#define _HSF_H_ - -#define HSF_API -#define HSF_IAPI HSF_API -#define USER_FUNC - - -#include -#include -#include -#include - -#ifndef BYTE -// typedef unsigned char BOOL; -typedef unsigned char BYTE; -typedef short SHORT; -typedef unsigned short WORD; -typedef unsigned short WCHAR; -typedef int INT; -typedef unsigned int UINT; -typedef long LONG; -typedef unsigned long DWORD; -#endif - -#ifndef TRUE - #define TRUE 1 -#endif -#ifndef FALSE - #define FALSE 0 -#endif - -#define HF_SUCCESS 0 - -#ifdef __cplusplus -#define EXTERNC extern "C" -#else -#define EXTERNC extern -#include -//typedef unsigned char bool; -// #define true 1 -// #define false 0 -#endif - - -#ifndef NULL - #if defined(__cplusplus) - #define NULL 0 - #else - #define NULL ((void *) 0) - #endif -#endif - - -// #define _HSF_ - -#ifndef WEAK -#define WEAK __attribute__ ((weak)) -#endif - -#define FUNC_IN_RAM __attribute__((section(".tcm_code"))) -// #include "hferrno.h" -#include "hfconfig.h" -#include "hfuart.h" -#include "hfat.h" -#include "hfsys.h" -#include "hfflash.h" -#include "hfthread.h" -#include "hfflashlayout.h" -#include "hfproduct.h" -#include "hfnet.h" -// #include "hf_debug.h" -#include "hfupdate.h" -#include "hfcrypto.h" -#include "hfgpio.h" -#include "hfwifi.h" -#include "hfnet.h" -#include "hfntp.h" - -#include "debug_print.h" -#define DEBUG_NTP DEBUG_LEVEL_LOW - -extern const char *HILINK_GetSdkVersion(void); - -#define GLOBAL_VER HILINK_GetSdkVersion() - -#ifdef CONFIG_FLASH_SIZE_4MB - #define GLOBAL_LVER " (2025-04-11 14:00 4M)" -#elif defined CONFIG_FLASH_SIZE_8MB - #define GLOBAL_LVER "06 (2024-09-20 17:00 8M)" -#endif - - -#endif - diff --git a/application/ws63/hsf/httpclient.h b/application/ws63/hsf/httpclient.h deleted file mode 100755 index 005d5a7..0000000 --- a/application/ws63/hsf/httpclient.h +++ /dev/null @@ -1,623 +0,0 @@ -/*! \file httpc.h - * \brief HTTP Client Module - * - * The HTTP Client module implements the functionality to perform HTTP - * operations like GET and POST on a remote web server. The HTTP client handles - * chunked encoding making it transparent to the user. It also supports - * persistent connections with the web server. Multiple HTTP requests can thus - * be channelled through the same persistent connection with the server. - * - * \section httpc_usage Usage - * - * The typical HTTP Client usage scenario is as follows: - * - * -# Initiate a connection with the remote Web Server using the - * http_open_session() call. - * -# Prepare the request with a call to http_prepare_req. The mandatory - * fields are filled depending on the members set in httpc_req_t. If some - * default fields are to be set, this is set by enabling the - * corresponding flag bits passed to http_prepare_req. If more custom - * headers are to be added please add them using the call add_header. - * -# Send one or more HTTP requests to the server using the - * http_prepare_req and http_send_request pair together. . The \ref - * httpc_req_t structure should be populated with the desired fields for - * each call if changed - * -# An optional call to http_get_response_hdr() can be made if the application - * wishes to determine certain characteristics of the HTTP response. - * -# Mutiple calls to http_read_content() are made for reading the response of - * the remote Web Server. - * -# Once all the HTTP requests have been made, the connection with the remote - * server is terminated using the http_close_session() call. - * - */ - -/* - * Copyright 2008-2012, Marvell International Ltd. - * All Rights Reserved. - */ - -#ifndef _HTTPC_H_ -#define _HTTPC_H_ -#include - -#include -#include - -// #define CONFIG_ENABLE_TLS - -// #ifdef CONFIG_ENABLE_TLS -typedef void* tls_handle_t; -typedef void tls_init_config_t; -// #endif /* CONFIG_ENABLE_TLS */ - -#ifdef __cplusplus -extern "C"{ -#endif - -typedef int http_session_t; - -/* Request methods */ -typedef enum { - HTTP_OPTIONS, /* request to server for communication options */ - HTTP_GET, /* retrieve information */ - HTTP_HEAD, /* get meta-info */ - HTTP_POST, /* request to accept new sub-ordinate of resource */ - HTTP_PUT, /* modify or create new resource referred to by URI */ - HTTP_DELETE, /* delete the resource */ - HTTP_TRACE, /* echo */ - HTTP_CONNECT, /* do we need this ? */ -} http_method_t; - -typedef enum { - HTTP_VER_1_0, - HTTP_VER_1_1, -} http_ver_t; - - -/* - * The OR of zero or more flags below is passed to the function - * \ref http_prepare_req. If the a flag is passed the corresponding HTTP - * header field is added to the HTTP header. The values added will be - * default ones. - */ -typedef enum { - HDR_ADD_DEFAULT_USER_AGENT = 0x0001, - /* Note: This flag is not necessary to set up persistent - * connections in HTTP 1.1. However, if you want the server to - * respond with persistent connection timeout values you may need - * to add this flag. These timeout values are used to find out how - * long a persistent connection will be kept alive by the - * server. */ - HDR_ADD_CONN_KEEP_ALIVE = 0x0002, - HDR_ADD_CONN_CLOSE = 0x0004, - HDR_ADD_TYPE_CHUNKED = 0x0008, -} http_hdr_field_sel_t; - - -#define STANDARD_HDR_FLAGS \ - (HDR_ADD_DEFAULT_USER_AGENT) - -/* - * Note 1: A resource is a part of the string immediately after the - * hostname[:portno] part of the URL. In the URL, - * [http://]hostname[:portno][/path/to/resource], - * "/path/to/resource" part is called as a resource. It starts with the - * character '/'. - */ -/** The HTTP Client's Request structure - * - * \par - * The application should fill up this structure and pass it to the - * http_prepare_req() function while making an HTTP request. More name-value - * fields can be added to HTTP header using http_add_header(). - */ -typedef struct { - /** The Type of HTTP Request */ - http_method_t type; - /** The target resource for the HTTP Request. A complete URL is also - * accepted. - */ - const char *resource; - /** The HTTP Protocol Version */ - http_ver_t version; - const char *content; - /** The length of the data pointed to by \a content above. This is - * don't-care if the content is set to NULL - */ - int content_len; -} httpc_req_t; - -typedef struct { - const char *protocol; - http_ver_t version; - int status_code; - const char *reason_phrase; /* verbose string describing status code */ - const char *server; - time_t modify_time; /* time when the resource was last modified */ - const char *content_type; - const char *content_encoding; - bool keep_alive_ack; - int keep_alive_timeout; /* Server timeout */ - int keep_alive_max; /* Max time for which a persistent - connection will be open, irrespective of - connection activity */ - bool chunked; - uint32_t content_length; /* This will be 0 if chunked == TRUE */ -} http_resp_t; - -typedef struct { - char *name; - char *value; -} http_header_pair_t; - -typedef struct { - const char *scheme; - const char *hostname; - unsigned portno; - const char *resource; -} parsed_url_t; - -/** HTTPC Error Codes **/ - -enum wm_httpc_errno { - WM_E_HTTPC_ERRNO_START = MOD_ERROR_START(MOD_HTTPC), - /* TCP connection failed (maybe due to unreachable server) */ - WM_E_HTTPC_TCP_CONNECT_FAIL, - /* HTTP File not found */ - WM_E_HTTPC_FILE_NOT_FOUND, - /* HTTP Bad Request */ - WM_E_HTTPC_BAD_REQUEST, - /* TLS not enabled */ - WM_E_HTTPC_TLS_NOT_ENABLED, -}; - - -/* Status codes */ -#define HTTP_RESP_INFORMATIONAL(x) (x >=100 && < 200) -#define HTTP_RESP_SUCCESS(x) (x >= 200 && x < 300) -#define HTTP_RESP_REDIR(x) (x >= 300 && x < 400) -#define HTTP_RESP_CLIENT_ERR(x) (x >= 400 && x < 500) -#define HTTP_RESP_SERVER_ERR(x) (x >= 500 && x < 600) - -/* - * These macros are not of any use to the HTTP client itself. They are used - * by the users of the HTTP client. This list may be extended if required - */ -#define HTTP_OK 200 -#define HTTP_CREATED 201 -#define HTTP_ACCEPTED 202 -#define HTTP_FOUND 302 -#define HTTP_NOT_MODIFIED 304 - -#define HTTP_BAD_REQUEST 400 -#define HTTP_NOT_AUTH 401 -#define HTTP_FORBIDDEN 403 -#define HTTP_NOT_FOUND 404 - -/** - * If the given URL has a scheme field, and it is https then the http - * client will auto-switch to SSL mode, irrespective of the TLS_ENABLE - * flag below. - */ -typedef enum { - /** Pass this flag when you want the connection to be SSL based */ - TLS_ENABLE = 0x01, -} http_open_flags_t; - -/** - * Start an HTTP session. - * - * @par - * This function starts a new HTTP session. It will create a socket and - * then connect to the server. - * - * @param[in,out] handle Pointer to a handle for the session. Will be - * assigned by the callee. - * @param[in] hostname Host name or IP address. The hostname should be in - * the format [http://]hostname[:portno][/path/to/resource]. The fields - * between the square brackets above are optional. The part specifying - * the resource will be ignored. The resource detail is expected by the \a - * http_send_request API to be called later after calling current function. - * @param[in] flags This is OR of the flags mentioned in enum - * \ref http_open_flags_t. Please look at the declaration of the enum for - * more information. - * @param[in] cfg This is a pointer of the type - * \ref tls_init_config_t. This will be passed verbatim to the tls - * layer. Please look at the wm-tls.h for the structure members. \b If TLS - * (secure connection) is not needed please pass NULL. - * @param[in] retry_cnt On some systems with constrained network resources, - * only a limited sockets can be active at any given time. If the socket - * creation fails, http_open_session will wait for some time and try to create - * the socket again for retry_cnt number of times. If 0 is passed then it will - * try default number of times depending on the platform. 0 is the recommended - * option. - * - * @return WM_SUCCESS on success - * @return -WM_E_INVAL if any of the arguments were invalid - * @return -WM_FAIL if the function was unable to initiate an HTTP session with - * the server. - */ -int http_open_session(http_session_t * handle, const char *hostname, - int flags, const tls_init_config_t *cfg, - int retry_cnt); - -#define hfhttp_open_session http_open_session - -/** - * Prepare the HTTP header. - * - * This function will prepare an HTTP request before sending out an HTTP - * request using the function \ref http_send_request. Calling this function is - * mandatory before calling \ref http_send_request. - * - * @pre \ref http_open_session - * - * @param[in] handle Handle returned from the call to \a http_open_session - * @param[in] req Allocated and initialized \ref httpc_req_t structure. - * @param[in] field_flags Bitwise OR of flags of enum \ref - * http_hdr_field_sel_t as required by the caller. - * - * @note The field_flags parameter is a way to request the http client to - * use default field values for standard fields. If the corresponding bits - * are not set then the respective fields are not added. The user can add - * any custom fields including the standard ones using the API - * \ref http_add_header - * - * @return Standard wmsdk return codes. - */ -int http_prepare_req(http_session_t handle, const httpc_req_t *req, - http_hdr_field_sel_t field_flags); - -#define hfhttp_prepare_req http_prepare_req - -/** - * Add custom http headers to the partial generated header. - * - * This function allows the caller to add custom headers to the partial - * http header generated by earlier call to \ref http_prepare_req. - * - * @note This function is optional and needs to be called only if custom - * headers (or standard headers with non-default values) are to be added. - * - * @pre \ref http_prepare_req - * - * @param[in] handle Handle returned from the call to \a http_open_session - * @param[in] name The name of the field. e.g User-Agent or - * If-Modified-Since - * @param[in] value Value associated with the name given above. - * - * @return Standard wmsdk value. - */ -int http_add_header(http_session_t handle, const char *name, - const char *value); - -#define hfhttp_add_header http_add_header - -/** - * Perform an HTTP request. - * - * @par - * This function will peform an HTTP request. - * - * @note If this function fails and the caller decides to abandon this - * session altogether it needs to call http_close_session() - * explicitly. Failure to do this will cause undefined behaviour. - * - * @pre \a http_prepare_req mandatory. \a http_add_header optional. - * - * @param[in] handle Handle returned from the call to \a http_open_session - * @param[in] req The \httpc_req_t structure filled up with appropriate - * parameters as sent earlier to \ref http_prepare_req - * - * @return WM_SUCCESS on success - * @return -WM_E_IO if failed to send data to network - * @return -WM_E_INVAL for an invalid arguments. - */ -int http_send_request(http_session_t handle, const httpc_req_t * req); - -#define hfhttp_send_request http_send_request -/** - * Get the HTTP response header - * - * @par - * This function parses the response header received from the server and - * populates the \a http_resp_t structure and returns the pointer to this - * structure. The structure \a http_resp_t is allocated by the callee. - * - * @par - * The caller is expected to analyse this information to find out the - * result of the earlier request sent through http_send_request(). If the - * earlier request was HTTP_GET then the caller will need to call - * http_read_content() to read the data sent by the server. - * - * @note Calling this function is \b optional. If the caller does not want to - * read/analyse the header and knows beforehand what to expect, s/he can - * directly call http_read_content(). The function \a http_read_content - * will internally read the HTTP response header. However, the function - * \a http_read_content will return an error if the HTTP status code - * returned is not 200. If you need to read content in cases where the - * return status code is other than 200 you need to call \ref - * http_get_response_hdr first. - * - * @note If this function fails and the caller decides to abandon this - * session altogether it needs to call http_close_session() - * explicitly. Failure to do this will cause undefined behaviour. - * - * @pre \a http_send_request is called before this call. - * - * @param[in] handle Handle returned from the call to \a http_new_session - * @param[in,out] resp Pointer to a pointer of type \a http_resp_t. The - * structure will be allocted by the callee. - * - * @return WM_SUCCESS on success - * @return -WM_FAIL on error - */ -int http_get_response_hdr(http_session_t handle, http_resp_t ** resp); -#define hfhttp_get_response_hdr http_get_response_hdr -/** - * Get a particular HTTP response header value. - * - * @par - * This function parses the response header received from the server and - * returns the value corresponding to a given name. - * - * @par - * The caller is not expected to call \ref http_get_response_hdr before - * this. However, calling \ref http_get_response_hdr is recommended so that - * the user gets to know the exact status of the HTTP operation before he - * tries to extract any field not present in structure \ref http_resp_t. - * - * @note Calling this function is \b optional. If the caller does not want to - * read/analyse the header and knows beforehand what to expect, s/he can - * directly call http_read_content(). The function \a http_read_content - * will internally read the HTTP response header. However, the function - * \a http_read_content will return an error if the HTTP status code - * returned is not 200. If you need to read content in cases where the - * return status code is other than 200 you need to call \ref - * http_get_response_hdr or the current function first. - * - * @note If this function fails and the caller decides to abandon this - * session altogether it needs to call http_close_session() - * explicitly. Failure to do this will cause undefined behaviour. - * - * @pre \a http_send_request is called before this call. Calling \ref - * http_get_response_hdr is \b not mandatory but recommended. - * - * @param[in] handle Handle returned from the call to \a http_new_session - * @param[in] header_name The name of the field whose value you wish to - * know - * @param[in,out] value A pointer which will point to the value - * corresponding to the name passed as second parameter. - * - * @return WM_SUCCESS on success - * @return -WM_FAIL on error - */ - -int http_get_response_hdr_value(http_session_t handle, - const char *header_name, char **value); - -#define hfhttp_get_response_hdr_value http_get_response_hdr_value -/** - * Get requested number of HTTP response header name-value pairs. - * - * @par - * This function parses the response header received from the server and - * returns requested number of HTTP response header name-value pairs. - * - * @par - * The caller is not expected to call \ref http_get_response_hdr before - * this. However, calling \ref http_get_response_hdr is recommended so that - * the user gets to know the exact status of the HTTP operation before he - * tries to extract any field not present in structure \ref http_resp_t. - * - * @note Calling this function is \b optional. If the caller does not want to - * read/analyse the header and knows beforehand what to expect, s/he can - * directly call http_read_content(). The function \a http_read_content - * will internally read the HTTP response header. However, the function - * \a http_read_content will return an error if the HTTP status code - * returned is not 200. If you need to read content in cases where the - * return status code is other than 200 you need to call \ref - * http_get_response_hdr or the current function first. - * - * @note If this function fails and the caller decides to abandon this - * session altogether it needs to call http_close_session() - * explicitly. Failure to do this will cause undefined behaviour. - * - * @pre \a http_send_request is called before this call. Calling \ref - * http_get_response_hdr is \b not mandatory but recommended. - * - * @param[in] handle Handle returned from the call to \a http_new_session - * @param[in,out] arr A pointer that points to an array of the - * structure to hold the response header name-value pairs. - * This array needs to be pre-allocated and its pointer is to be passed, - * this pointer shall point to the array of requested number of - * response header name-value pairs. - * @param[in,out] count An interger pointer that points to the number of - * response header name-value pairs that the user wants. - * This has to be passed by the user and it is later updated to the - * actual number of response header name-value pairs that were filled - * in the array mentioned above. - * @return WM_SUCCESS on success - * @return -WM_FAIL on error - */ - -int http_get_response_hdr_all(http_session_t handle, http_header_pair_t *arr, - int *count); - -#define hfhttp_get_response_hdr_all http_get_response_hdr_all -/** - * Read data content from the stream. - * - *@par - * This function will read the data sent by the server. - * - * @par - * The data transfer from the server to the client may be chunked. This - * fact will be reported in the response structure \ref http_resp_t returned - * in a previous call to http_get_response_hdr(). Notwithstanding this - * information, chunked data handling is transparent to the - * caller. Irrespective of the transfer type, this function should be called - * repeatedly till the return value of the function is zero. - * - * @note If this function fails and the caller decides to abandon this - * session altogether it needs to call http_close_session() - * explicitly. Failure to do this will cause undefined behaviour. - * - * @param[in] handle Handle returned from the call to http_new_session() - * @param[in, out] buf Caller allocated buffer of size max_len - * @param[in] Size of the buffer. The data read will be less than or equal - * to this size, depending on the size of the resource. - * - * @return On success, the number of bytes read is returned. Return value - * of zero is \a not an error case and should be treated as a signal that - * server is done with sending the data. - * @return -WM_FAIL if this function is called again after the previous call - * retuned 0 or for any other error. - */ - -int http_read_content(http_session_t handle, void *buf, uint32_t max_len); -#define hfhttp_read_content http_read_content -/** - * Parse the given string into URL subcomponents. - * - * The hostname string syntax is: - *[scheme://]hostname[:port][/path_to_resource?query_string#fragment_id] - * The fields between the square brackets above are optional. - * - * @note Buffer management: To free the caller of the task of - * allocating multiple buffers of magic size to store each of the - * subcomponents we use the following strategy. This function takes a tmp - * buffer, allocted (static or dynamic) by the caller to store the - * subcomponents. The caller needs to allocate this buffer with size equal - * to (strlen(URL) + 10). When this function returns, the pointers in the - * parsed_url structure will point to appropriate address in this - * buffer. The caller may free this buffer after usage of the - * sub-components is complete. Freeing before that will cause undefined behavior. - * - * @param[in] URL Pointer to the string containing the URL. This function - * will not modify this argument. - * @param[in] tmp_buf A buffer where the strings will be stored after - * parsing. Needs to be allocated by the caller and should be of size - * atleast 10 greater than size of the URL string passed as first - * argument. - * @param[in] tmp_buf_len Size of the caller allocated, temporary buffer - * sent as second argument. - * @param[in, out] Pointer to an allocated structure. The member pointers - * will point to the appropriate address in the temporary buffer holding - * the NULL terminated string corresponding to the subcomponent. - * - */ -int http_parse_URL(const char *URL, char *tmp_buf, int tmp_buf_len, - parsed_url_t * parsed_url); - -#define hfhttp_parse_URL http_parse_URL -/** - * HTTP lowlevel read - * - * This API is present to serve clients which want to handle the - * HTTP stream directly. This is useful for handling websockets for e.g. - * - * @warning This is not for general users of HTTP client API. Normal HTTP - * transactions do not need this API. - * - * @note Once this API used no other API from the HTTP API set, except \a - * http_close_session, can be used. This is because once this API is used - * the HTTP client loses track of the stream and only the caller using the - * API can know the state of the stream. - * - * @param[in] handle Handle returned from the call to http_new_session() - * @param[in, out] buf Pointer to an allocated buffer of size equal to or - * more than the value of the third parameter maxlen - * @param[in] maxlen The maximum number of bytes to be read from the - * network. Note that the actual read bytes can be less than this. - * - * @return Number of bytes read. -WM_E_INVAL is returned in case of invalid - * parameters. Standard libc error codes are returned in case when there - * other problems. - */ - -int http_lowlevel_read(http_session_t handle, void *buf, unsigned maxlen); - -/** - * HTTP lowlevel write - * - * This API is present to serve clients which want to handle the - * HTTP stream directly. This is useful for handling websockets for e.g. - * - * @warning This is not for general users of HTTP client API. Normal HTTP - * transactions do not need this API. - * - * @note Once this API used no other API from the HTTP API set, except \a - * http_close_session, can be used. This is because once this API is used - * the HTTP client loses track of the stream and only the caller using the - * API can know the state of the stream. - * - * @param[in] handle Handle returned from the call to http_new_session() - * @param[in, out] buf Pointer to a buffer which has the data to be written - * out. - * @param[in] maxlen The number of bytes to be written to the - * network. - * - * @return Number of bytes written. -WM_E_INVAL is returned in case of - * invalid parameters. Standard libc error codes are returned in case when - * there other problems. - */ - -int http_lowlevel_write(http_session_t handle, const void *buf, unsigned len); - -/** - * HTTP write chunked - * - * This API is used for chunked transfer encoding - * - * @note To end the chunked data transfer, this function should be called with - * len=0, buf may be NULL - * - * @param[in] handle Handle retrieved from the call to http_open_session - * @param[in] data Pointer to the buffer to be posted - * @param[in] len The number of bytes to be posted - * @return WM_SUCCESS is returned on success. -WM_E_INVAL is returned in case - * of invalid parameters. -WM_FAIL is returned if session is invalid. - * Standard libc error codes are returned when there are other problems. - */ - -int httpc_write_chunked(http_session_t handle, const char *data, int len); - -/** - * Close the session. - * - * @par - * This function will close the session represented by the given - * handle. The socket associated with this session will be closed and thus - * the TCP connection with the server will be terminated. No requests on - * this same session will succeed after this function is called. - * - * @note The response structure \ref http_resp_t returned earlier from - * http_get_response_hdr() will be invalid after this call. - * - * @param[in] handle Handle returned from the previous call to - * http_new_session(). The handle will be set to NULL by the callee thus - * effectively blocking futher requests on the same session handle. - * - */ -void http_close_session(http_session_t * handle); - -#define hfhttp_close_session http_close_session - -int http_check_data_ready(http_session_t handle,uint32_t timeous); -int hfhttp_sock_check(http_session_t handle,uint32_t timeous); -void hfhttp_set_init_state(http_session_t handle); - -#define hfhttp_check_data_ready http_check_data_ready - -int http_read_content_timeout(http_session_t handle, void *buf, uint32_t max_len,uint32_t timeouts); -#define hfhttp_read_content_timeout http_read_content_timeout - -int http_read_content_length(http_session_t handle); -#define hfhttp_read_content_length http_read_content_length - -#ifdef __cplusplus -} -#endif - -#endif /* _HTTPC_H_ */ diff --git a/application/ws63/hsf/ringbuf.h b/application/ws63/hsf/ringbuf.h deleted file mode 100755 index 9cf5c3b..0000000 --- a/application/ws63/hsf/ringbuf.h +++ /dev/null @@ -1,143 +0,0 @@ -/** \addtogroup lib - * @{ */ - -/** - * \defgroup ringbuf Ring buffer library - * @{ - * - * The ring buffer library implements ring (circular) buffer where - * bytes can be read and written independently. A ring buffer is - * particularly useful in device drivers where data can come in - * through interrupts. - * - */ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Header file for the ring buffer library - * \author - * Adam Dunkels - */ - -#ifndef __RINGBUF_H__ -#define __RINGBUF_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \brief Structure that holds the state of a ring buffer. - * - * This structure holds the state of a ring buffer. The - * actual buffer needs to be defined separately. This - * struct is an opaque structure with no user-visible - * elements. - * - */ -struct ringbuf { - uint8_t *data; - uint16_t mask; - - /* XXX these must be 8-bit quantities to avoid race conditions. */ - uint16_t put_ptr, get_ptr; -}; - -/** - * \brief Initialize a ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \param a A pointer to an array to hold the data in the buffer - * \param size_power_of_two The size of the ring buffer, which must be a power of two - * - * This function initiates a ring buffer. The data in the - * buffer is stored in an external array, to which a - * pointer must be supplied. The size of the ring buffer - * must be a power of two and cannot be larger than 128 - * bytes. - * - */ -void ringbuf_init(struct ringbuf *r, uint8_t *a, - uint16_t size_power_of_two); - -/** - * \brief Insert a byte into the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \param c The byte to be written to the buffer - * \return Non-zero if there data could be written, or zero if the buffer was full. - * - * This function inserts a byte into the ring buffer. It - * is safe to call this function from an interrupt - * handler. - * - */ -int ringbuf_put(struct ringbuf *r, uint8_t c); - - -/** - * \brief Get a byte from the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The data from the buffer, or -1 if the buffer was empty - * - * This function removes a byte from the ring buffer. It - * is safe to call this function from an interrupt - * handler. - * - */ -int ringbuf_get(struct ringbuf *r); - -/** - * \brief Get the size of a ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The size of the buffer. - */ -int ringbuf_size(struct ringbuf *r); - -/** - * \brief Get the number of elements currently in the ring buffer - * \param r A pointer to a struct ringbuf to hold the state of the ring buffer - * \return The number of elements in the buffer. - */ -int ringbuf_elements(struct ringbuf *r); - -int -ringbuf_gets(struct ringbuf *r,uint8_t *data,int size); - -#ifdef __cplusplus -} -#endif - - -#endif /* __RINGBUF_H__ */ diff --git a/application/ws63/hsf/xmodem.h b/application/ws63/hsf/xmodem.h deleted file mode 100755 index 02c059c..0000000 --- a/application/ws63/hsf/xmodem.h +++ /dev/null @@ -1,32 +0,0 @@ - /* xmodem.h - * - * Copyright (C) 2017 ShangHai High-flying Electronics Technology Co.,Ltd. - * - * This file is part of HSF. - * - */ - -#ifndef _XMODEM_H_ -#define _XMODEM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef int (*xmodem_send_callback_t)(unsigned char *data, int len); - -typedef int (*xmodem_recv_callback_t)(unsigned char *data, int len, int timeout); - -typedef int (*xmodem_setfile_callback_t)(unsigned char *data, int len, unsigned int offset); - - -int xmodem_receive_process(int wait, xmodem_send_callback_t send, xmodem_recv_callback_t recv, xmodem_setfile_callback_t write); - - -#ifdef __cplusplus -} -#endif - -#endif/* _XMODEM_H_ */ - diff --git a/application/ws63/user_main/app_main.c b/application/ws63/user_main/app_main.c index 6ce2e83..61f4313 100755 --- a/application/ws63/user_main/app_main.c +++ b/application/ws63/user_main/app_main.c @@ -183,10 +183,16 @@ static int USER_FUNC uart_recv_callback(uint32_t event,char *data,uint32_t len,u return len; } + + void user_app_init(void) { u_printf("user app init\r\n"); } +void hfwifi_product_callback(HFWIFI_STATE state) +{ + u_printf("wifi state:%d\r\n",state); +} #define APPVER "1.0.0" int hf_atcmd_appver(pat_session_t s,int argc,char *argv[],char *rsp,int len) { @@ -197,15 +203,6 @@ int hf_atcmd_appver(pat_session_t s,int argc,char *argv[],char *rsp,int len) } return -3; } - -#ifdef CONFIG_SPOTLIGHT_UT - extern int hf_atcmd_pwm(pat_session_t s, int argc, char *argv[], char *rsp, int len); - extern int hf_atcmd_pwm_query(pat_session_t s, int argc, char *argv[], char *rsp, int len); - extern int hf_atcmd_light(pat_session_t s, int argc, char *argv[], char *rsp, int len); - extern int hf_atcmd_light_query(pat_session_t s, int argc, char *argv[], char *rsp, int len); - extern int hf_atcmd_reset(pat_session_t s, int argc, char *argv[], char *rsp, int len); - extern int hf_atcmd_reset_factory(pat_session_t s, int argc, char *argv[], char *rsp, int len); -#endif const hfat_cmd_t user_define_at_cmds_table[]= { {"APPVER", hf_atcmd_appver, "AT+APPVER: get version. \r\n",NULL}, @@ -214,15 +211,7 @@ const hfat_cmd_t user_define_at_cmds_table[]= {"MCUVER", hf_atcmd_mcuver, "AT+MCUVER: get mcu version. \r\n",NULL}, {"OTAWAITTIME", hf_atcmd_ota_wait_time, "AT+OTAWAITTIME: set/get uart send mcu ota time\r\n", NULL}, #endif -#ifdef CONFIG_SPOTLIGHT_UT - {"RESET", hf_atcmd_reset, "AT+RESET: reset. \r\n",NULL}, - {"FACTORY", hf_atcmd_reset_factory, "AT+FACTORY: factory. \r\n",NULL}, - {"UTPWM", hf_atcmd_pwm, "AT+PWM=,: Set PWM duty cycle (0-1000)\r\n", NULL}, - {"UTLIGHT", hf_atcmd_light, "AT+LIGHT=,: Set brightness(0-1000) and CCT(2700-6000)\r\n", NULL}, - {"UTPWMQ", NULL, "AT+PWMQ=,: Set PWM duty cycle (0-1000)\r\n", hf_atcmd_pwm_query}, - {"UTLIGHTQ", NULL, "AT+LIGHTQ=,: Set brightness(0-1000) and CCT(2700-6000)\r\n", hf_atcmd_light_query}, -#endif - {NULL, NULL, NULL, NULL} //the last item must be null + {NULL, NULL, NULL, NULL} //the last item must be null }; int USER_FUNC user_app_main(void) diff --git a/application/ws63/user_main/spotlight/device_module.c b/application/ws63/user_main/spotlight/device_module.c old mode 100644 new mode 100755 diff --git a/application/ws63/user_main/spotlight/factory_test.c b/application/ws63/user_main/spotlight/factory_test.c old mode 100644 new mode 100755 diff --git a/application/ws63/user_main/spotlight/factory_test.h b/application/ws63/user_main/spotlight/factory_test.h old mode 100644 new mode 100755 diff --git a/application/ws63/user_main/spotlight/spotlight.h b/application/ws63/user_main/spotlight/spotlight.h old mode 100644 new mode 100755 diff --git a/application/ws63/user_main/spotlight/spotlight_main.c b/application/ws63/user_main/spotlight/spotlight_main.c old mode 100644 new mode 100755 diff --git a/application/ws63/user_main/spotlight/spotlight_ut.c b/application/ws63/user_main/spotlight/spotlight_ut.c old mode 100644 new mode 100755 diff --git a/bootloader/flashboot_ws63/startup/main.c b/bootloader/flashboot_ws63/startup/main.c index b52f167..fad6168 100755 --- a/bootloader/flashboot_ws63/startup/main.c +++ b/bootloader/flashboot_ws63/startup/main.c @@ -26,6 +26,7 @@ #include "upg_porting.h" #include "upg_common.h" #include "upg_alloc.h" +#include "upg_config.h" #include "soc_porting.h" #include "drv_flashboot_cipher.h" #ifdef CONFIG_MIDDLEWARE_SUPPORT_UPG_AB @@ -56,10 +57,11 @@ const sfc_flash_config_t sfc_cfg = { .mapping_addr = 0x200000, .mapping_size = 0x800000, }; -#if 1 //ADD LYL 2024 1122 -------- +#if 1 //ADD 2024 1122 -------- #define USERPAGE 0x003F2000 //AT参数存储区 #define BLE_CONKEYLEN 16 +#define HILINK_SN_MAX_SIZE 36 #pragma pack(push) #pragma pack(1) @@ -307,13 +309,22 @@ typedef struct uint32_t mcu_ota_size; uint8_t scan_ch14; - uint32_t module_reset_reason; - uint8_t reserved1[60+512-4]; + + uint8_t radar_type; //雷达工作类型(0 is disable) + uint8_t radar_led; //雷达灯工作类型(0 is off) + + uint8_t smtlk_type; + char hilink_sn[HILINK_SN_MAX_SIZE]; + uint8_t prot_type; + uint8_t product; + uint8_t uart1_debug_rx_invalid; + uint8_t reserved1[51+512-HILINK_SN_MAX_SIZE-1]; uint8_t validflag_magic; int8_t validflag_end; //valid flag -}HF_CONFIG_FILE; +}HF_CONFIG_FILE; //sizeof Must have 16 byte alignment + #pragma pack(pop) HF_CONFIG_FILE g_hf_config_file_boot = {0}; @@ -365,9 +376,10 @@ static void boot_flash_init(void) uint32_t ret = sfc_flash_init(); if (ret != ERRCODE_SUCC) { + serial_cancel_mute(); boot_msg1("Flash Init Fail! ret = ", ret); + serial_set_mute(); } else { - uapi_sfc_reg_read(USERPAGE, (unsigned char *)&g_hf_config_file_boot, sizeof(HF_CONFIG_FILE)); boot_msg0("Flash Init Succ!"); } hf_boot_msg1("BootLoader debug_level = ", g_hf_config_file_boot.debug_level); @@ -416,8 +428,9 @@ static void ws63_flashboot_recovery(void) if (!flashboot_need_recovery()) { return; } + serial_cancel_mute(); uapi_watchdog_kick(); - boot_msg0("Flashboot backup is working!"); + boot_msg0("Flashboot backup working!"); partition_information_t src_img_info = {0}; partition_information_t dst_img_info = {0}; errcode_t ret; @@ -430,15 +443,16 @@ static void ws63_flashboot_recovery(void) ret = uapi_sfc_reg_erase(dst_img_info.part_info.addr_info.addr, dst_img_info.part_info.addr_info.size); if (ret != ERRCODE_SUCC) { - boot_msg1("flashboot recovery erase failed!! ret = ", ret); + boot_msg1("Recovery erase failed!! ret = ", ret); } ret = uapi_sfc_reg_write(dst_img_info.part_info.addr_info.addr, (uint8_t *)(uintptr_t)(src_img_info.part_info.addr_info.addr + FLASH_START), src_img_info.part_info.addr_info.size); if (ret != ERRCODE_SUCC) { - boot_msg1("flashboot recovery write failed!! ret = ", ret); + boot_msg1("Recovery write failed!! ret = ", ret); } - boot_msg0("Flashboot fix ok!"); + boot_msg0("Recovery ok!"); + serial_set_mute(); } #define UPG_FIX_RETRY_CNT_REG RESET_COUNT_REG @@ -480,6 +494,7 @@ static void ws63_try_fix_app(void) /* 尝试ota修复运行区镜像 */ static void ws63_try_fix_app(void) { + errcode_t ret; uint8_t try_cnt = ws63_get_try_fix_cnt(); /* 连续验签失败次数小于阈值不做处理 */ if (try_cnt < VERIFY_RETRY_CNT_THRES) { @@ -493,20 +508,35 @@ static void ws63_try_fix_app(void) } ws63_set_try_fix_cnt(try_cnt + 1); - /* 重置升级标记 */ - errcode_t ret = uapi_upg_reset_upgrade_flag(); +#if (UPG_CFG_VERIFICATION_SUPPORT == YES) + /* 升级包校验 */ + upg_package_header_t *pkg_header = NULL; + ret = upg_get_package_header(&pkg_header); + if (ret != ERRCODE_SUCC || pkg_header == NULL) { + boot_msg1("get_pkg_header fail, ret = ", ret); + return; + } + ret = uapi_upg_verify_file((const upg_package_header_t *)pkg_header); if (ret != ERRCODE_SUCC) { - boot_msg1("reset_upgrade_flag fail, ret = ", ret); + boot_msg1("upg_verify fail, ret = ", ret); + return; + } +#endif + + /* 重置升级标记 */ + ret = uapi_upg_reset_upgrade_flag(); + if (ret != ERRCODE_SUCC) { + boot_msg1("reset upgrade flag fail, ret=", ret); return; } /* 请求升级 */ ret = uapi_upg_request_upgrade(false); if (ret != ERRCODE_SUCC) { - boot_msg0("request_upgrade fail, fota_pkt_not_exit."); + boot_msg1("request upgrade fail, ret=", ret); return; } - boot_msg0("fota_pkt exit, try_fota_fix_app."); + boot_msg0("Try fota fix app."); } #endif @@ -543,6 +573,7 @@ static void ws63_upg_check(void) return; #endif if (ws63_upg_need_upgrade()) { + serial_cancel_mute(); boot_msg0("need upgrade"); errcode_t ret = uapi_upg_start(); // 1, 没有升级包、或者升级标记区结果已经设置的情况不需要重启 @@ -557,6 +588,7 @@ static void ws63_upg_check(void) boot_msg0("--------------------------"); boot_msg0("upgrade success, reset now"); } + serial_set_mute(); reset(); } } @@ -609,10 +641,10 @@ static void dump_io_level(void) if (poc_coex.bits.rg_poc_sel == POC_SEL_SW_MODE) { sw_level = (poc_coex.bits.rg_poc_value == POC_VALUE_3V3) ? LEVEL_3V3 : LEVEL_1V8; chip_level = (poc_coex.bits.ms1c == POC_VALUE_3V3) ? LEVEL_3V3 : LEVEL_1V8; - boot_msg2("io level work in sw mode, level[sw:chip]:", sw_level, chip_level); + boot_msg2("sw mode, level[sw:chip]:", sw_level, chip_level); } else { chip_level = (poc_coex.bits.ms1c == POC_VALUE_3V3) ? LEVEL_3V3 : LEVEL_1V8; - boot_msg1("io level work in hw mode, level[chip]:", chip_level); + boot_msg1("hw mode, level[chip]:", chip_level); } } @@ -1041,23 +1073,24 @@ static uint32_t ws63_flashboot_init(void) uart_param_stru uart_param = FLASHBOOT_UART_DEFAULT_PARAM; uapi_tcxo_init(); hiburn_uart_init(uart_param, HIBURN_CODELOADER_UART); + serial_set_mute(); boot_msg0("Flashboot Uart Init Succ!"); uapi_partition_init(); pmp_enable(); malloc_port_init(); - boot_flash_init(); - boot_msg0("Flashboot Uart Init Succ!"); boot_msg0("Flashboot Malloc Init Succ!"); + boot_flash_init(); err = sfc_port_fix_sr(); if (err != ERRCODE_SUCC) { + serial_cancel_mute(); boot_msg1("SFC fix SR ret =", err); + serial_set_mute(); } dump_io_level(); #if FASTBOOT_PWM read_device_data(); pwm_init(BRIGHTNESS_PIN, CCT_PIN); #endif - print_str("flashboot version : %s\r\n", SDK_VERSION); return 0; } @@ -1068,13 +1101,13 @@ static errcode_t ws63_verify_app(uint32_t addr) ret = verify_image_head(APP_BOOT_TYPE, (uint32_t)(uintptr_t)flashboot_key_area->ext_pulic_key_area, addr); if (ret != ERRCODE_SUCC) { - boot_msg1("flashboot verify_image_app_head failed!! ret = ", ret); + boot_msg1("verify app head failed! ret=", ret); return ret; } ret = verify_image_body(addr, addr + APP_IMAGE_HEADER_LEN); if (ret != ERRCODE_SUCC) { - boot_msg1("verify_image_app_body failed!! ret = ", ret); + boot_msg1("verify app body failed!! ret=", ret); return ret; } return ERRCODE_SUCC; @@ -1084,6 +1117,9 @@ static void ws63_verify_app_handle(uint32_t addr) { errcode_t ret = ws63_verify_app(addr); if (ret != ERRCODE_SUCC) { + serial_cancel_mute(); + boot_msg0("VE"); + serial_set_mute(); ws63_try_fix_app(); reset(); } @@ -1105,7 +1141,9 @@ static void ws63_flash_encrypt_config(uint32_t image_addr, uint32_t image_size) } if (start_addr % FLASH_ENCRY_ADDR_ALINE != 0 || end_addr % FLASH_ENCRY_ADDR_ALINE != 0) { - boot_msg2("app_image start or end addr err, must 256byte alignment ", image_addr, end_addr); + serial_cancel_mute(); + boot_msg2("Addr not 256byte alignment ", image_addr, end_addr); + serial_set_mute(); reset(); } boot_msg0("flash_encrypt enable."); @@ -1117,18 +1155,24 @@ static void ws63_flash_encrypt_config(uint32_t image_addr, uint32_t image_size) flash_key.oneway = TD_TRUE; ret = drv_rom_cipher_config_odrk1(flash_key); if (ret != ERRCODE_SUCC) { - boot_msg1("fapc_set_config drv_rom_cipher_config_odrk1 err = ", (uint32_t)ret); + serial_cancel_mute(); + boot_msg1("Encrypt odrk1 err=", (uint32_t)ret); + serial_set_mute(); reset(); } ret = drv_rom_cipher_fapc_config(0, start_addr, end_addr, img_info->iv, IV_LEN); if (ret != ERRCODE_SUCC) { - boot_msg1("fapc_set_config drv_rom_cipher_fapc_config err = ", (uint32_t)ret); + serial_cancel_mute(); + boot_msg1("Encrypt fapc err=", (uint32_t)ret); + serial_set_mute(); reset(); } ret = drv_rom_cipher_fapc_bypass_config(1, end_addr, FLASH_MAX_END, TD_TRUE); if (ret != ERRCODE_SUCC) { - boot_msg1("fapc_set_config drv_rom_cipher_fapc_bypass_config err = ", (uint32_t)ret); + serial_cancel_mute(); + boot_msg1("Encrypt bypass err=", (uint32_t)ret); + serial_set_mute(); reset(); } } @@ -1174,7 +1218,9 @@ void start_fastboot(void) ws63_upg_check(); // 升级模式判断 err = uapi_partition_get_info(PARTITION_APP_IMAGE, &img_info); if (err != ERRCODE_SUCC) { - boot_msg0("Flashboot get app partition failed!, boot abort!"); + serial_cancel_mute(); + boot_msg0("Get app partition failed!"); + serial_set_mute(); reset(); } image_addr = img_info.part_info.addr_info.addr + FLASH_START; diff --git a/build/config/target_config/ws63/build_nvbin.py b/build/config/target_config/ws63/build_nvbin.py deleted file mode 100755 index f8bf444..0000000 --- a/build/config/target_config/ws63/build_nvbin.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# @brief Build nvbin -# Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -# ============================================================================ - -import os -import sys -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..", "..", "..")) -sys.path.append(os.path.join(g_root, 'build', 'script', 'nv')) -from nv_binary import nv_begin - - -if __name__ == '__main__': - #配置文件路径 - nv_config_json = os.path.join(g_root, "build", "config", "target_config", "ws63", "nv_bin_cfg", "mk_nv_bin_cfg.json") - #输出路径 - nv_output_path = os.path.join(g_root, "output", "ws63", "acore", "nv_bin") - - if not os.path.exists(nv_output_path): - os.makedirs(nv_output_path) - - targets = ["acore"] - if len(sys.argv) >= 2: - target_name = sys.argv[1] - if target_name == 'ws63-liteos-perf': - nv_config_json = os.path.join(g_root, "build", "config", "target_config", "ws63", "nv_bin_cfg", - "mk_nv_bin_cfg_perf.json") - nv_begin(nv_config_json, targets, 1, True) diff --git a/build/config/target_config/ws63/build_ws63_update.py b/build/config/target_config/ws63/build_ws63_update.py deleted file mode 100755 index ffff6c8..0000000 --- a/build/config/target_config/ws63/build_ws63_update.py +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# @brief Build Update Pkg File -# Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -# ============================================================================ - -import os -import sys -import argparse -import shutil -import subprocess - -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..", "..", "..")) -sys.path.append(os.path.join(g_root, 'build', 'script')) -from build_upg_pkg import begin - -sys.path.append(os.path.join(g_root, "build", "config")) -sys.path.remove(os.path.join(g_root, 'build', 'config', "target_config", "ws63")) -from enviroment import TargetEnvironment - -from utils.indie_upgrade_utils import check_indie_upg_match - -class upg_base_info: - def __init__(self): - self.root_path = g_root - # 升级包结构配置文件 - self.fota_format_path = os.path.join(self.root_path, "build", "config", "target_config", "ws63", "fota") - # 产品升级配置文件 - self.fota_cfg = os.path.join(self.root_path, "build", "config", "target_config", "ws63", "fota", "fota.cfg") - # 产品镜像输出路径 - self.output = os.path.join(self.root_path, "output", "ws63") - # 产品升级镜像包输出路径 - self.upg_output = os.path.join(self.output, "upgrade") - # 产品签名加密前原始镜像 - self.upg_pkt = os.path.join(self.upg_output, "ota_pktbin") - self.upg_pkt_zip = os.path.join(self.upg_output, "ota_pktbin.zip") - # 产品升级制作临时文件输出路径 - self.temp_dir = os.path.join(self.upg_output, "temp_dir") - - # 产品镜像路径 - self.flashboot = os.path.join(self.root_path, "output", "ws63", "acore","boot_bin", "flashboot_sign.bin") - self.app_bin = os.path.join(self.output, "acore", "ws63-liteos-app", "ws63-liteos-app-sign.bin") - self.app_iot_bin = os.path.join(self.output, "acore", "ws63-liteos-app-iot", "ws63-liteos-app-iot-sign.bin") - self.app_iot_check = os.path.join(self.output, "acore", "ws63-liteos-app-iot", "ws63-liteos-app-iot-check.json") - self.hilink_bin = os.path.join(self.output, "acore", "ws63-liteos-hilink", "ws63-liteos-hilink-sign.bin") - self.hilink_check = os.path.join(self.output, "acore", "ws63-liteos-hilink", "ws63-liteos-hilink-check.json") - self.test_bin = os.path.join(self.output, "acore", "ws63-liteos-testsuite", "ws63-liteos-testsuite-sign.bin") - self.nv_bin = os.path.join(self.output, "acore", "nv_bin", "ws63_all_nv.bin") - - # 签名加密前原始镜像 - self.src_boot = os.path.join(self.root_path, "output", "ws63", "acore", "boot_bin", "flashboot.bin") - self.src_app = os.path.join(self.output, "acore", "ws63-liteos-app", "ws63-liteos-app.bin") - self.src_test = os.path.join(self.output, "acore", "ws63-liteos-testsuite", "ws63-liteos-testsuite.bin") - - # 差分升级时,以下路径配置为上一个版本的镜像路径 - self.flashboot_old_bin = os.path.join(self.output, "acore", "old_version", "flashboot_sign.bin") - self.app_old_bin = os.path.join(self.output, "acore", "old_version", "ws63-liteos-app-sign.bin") - self.app_iot_old_bin = os.path.join(self.output, "acore", "old_version", "ws63-liteos-app-iot-sign.bin") - self.hilink_old_bin = os.path.join(self.output, "acore", "old_version", "ws63-liteos-hilink-sign.bin") - self.test_old_bin = os.path.join(self.output, "acore", "old_version", "ws63-liteos-testsuite-sign.bin") - self.nv_old_bin = os.path.join(self.output, "acore", "old_version", "ws63_all_nv.bin") - -def check_bin_match(input_param, info): - if 'app_iot' not in input_param: - return True - - target_env = TargetEnvironment("ws63-liteos-app-iot") - defines = target_env.get('defines') - if "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" not in defines: - return True - - if not check_indie_upg_match(info.hilink_check, info.app_iot_check): - print("indie upg hilink and app not match") - return False - - print("check indie upg hilink and app match succ") - return True - -def get_new_image(input_param, info): - image_list = [] - if 'app' in input_param: - image_list.append("=".join([info.app_bin, "application"])) - if 'app_iot' in input_param: - image_list.append("=".join([info.app_iot_bin, "application"])) - target_env = TargetEnvironment("ws63-liteos-app-iot") - defines = target_env.get('defines') - if "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" in defines: - image_list.append("=".join([info.hilink_bin, "hilink"])) - if 'hilink' in input_param: - image_list.append("=".join([info.hilink_bin, "hilink"])) - if 'test' in input_param: - image_list.append("=".join([info.test_bin, "application"])) - if 'boot' in input_param: - image_list.append("=".join([info.flashboot, "flashboot"])) - if 'nv' in input_param: - image_list.append("=".join([info.nv_bin, "nv"])) - - new_image = "|".join(image_list) - return new_image - - -def get_old_image(input_param, info): - image_list = [] - if 'app' in input_param: - image_list.append("=".join([info.app_old_bin, "application"])) - if 'app_iot' in input_param: - image_list.append("=".join([info.app_iot_old_bin, "application"])) - target_env = TargetEnvironment("ws63-liteos-app-iot") - defines = target_env.get('defines') - if "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" in defines: - image_list.append("=".join([info.hilink_old_bin, "hilink"])) - if 'hilink' in input_param: - image_list.append("=".join([info.hilink_old_bin, "hilink"])) - if 'test' in input_param: - image_list.append("=".join([info.test_old_bin, "application"])) - if 'boot' in input_param: - image_list.append("=".join([info.flashboot_old_bin, "flashboot"])) - if 'nv' in input_param: - image_list.append("=".join([info.nv_old_bin, "nv"])) - - old_image = "|".join(image_list) - return old_image - -def get_parameters(): - parser = argparse.ArgumentParser() - - parser.add_argument('--pkt', type=str, default = 'app', - help='需要生成的镜像,包括: app,boot,nv') - - config, unknown = parser.parse_known_args() - return config - -# 打包签名加密前的原镜像 -def make_pkt(info, input_param): - if os.path.exists(info.upg_pkt): - shutil.rmtree(info.upg_pkt) - os.makedirs(info.upg_pkt, exist_ok=True) - shutil.copy(info.fota_cfg, info.upg_pkt) - if 'app' in input_param: - shutil.copy(info.src_app, info.upg_pkt) - if 'test' in input_param: - shutil.copy(info.src_test, info.upg_pkt) - if 'boot' in input_param: - shutil.copy(info.src_boot, info.upg_pkt) - if 'nv' in input_param: - shutil.copy(info.nv_bin, info.upg_pkt) - if os.path.exists(info.upg_pkt_zip): - os.remove(info.upg_pkt_zip) - cmd = ' '.join(['tar -cf %s -C %s .' % (info.upg_pkt_zip, info.upg_pkt)]) - ret = subprocess.run(cmd, shell=True) - if ret.returncode: - print("make_pkt shell cmd", cmd, ", err: ", ret.returncode) - -if __name__ == '__main__': - info = upg_base_info() - conf = get_parameters() - input_param = conf.pkt.split(",") - if "boot" not in input_param: - input_param.append("boot") - - if not check_bin_match(input_param, info): - sys.exit(1) - - conf.app_name = "update" - conf.upg_format_path = info.fota_format_path - conf.base = info.fota_cfg - conf.temp_dir = info.temp_dir - conf.new_images = get_new_image(input_param, info) - conf.old_images = get_old_image(input_param, info) - conf.output_dir = info.upg_output - conf.type = 0 - begin(conf) - make_pkt(info, input_param) diff --git a/build/config/target_config/ws63/config.py b/build/config/target_config/ws63/config.py index 0f312ec..46c8b3c 100755 --- a/build/config/target_config/ws63/config.py +++ b/build/config/target_config/ws63/config.py @@ -2,7 +2,7 @@ # encoding=utf-8 # ============================================================================ # @brief Target Definitions File -# Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. +# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. # ============================================================================ target = { 'ws63-liteos-app': { @@ -83,12 +83,11 @@ target = { 'soc_port', #'radar_sensing', #'radar_at', - 'radar_ai', + #'radar_ai', "cjson", 'xo_trim_port', - "mqtt", "coap", - "sle_chba_user","sle_netdev" + "sle_netdev" ], 'ccflags': [ "-DBOARD_ASIC", '-DPRE_ASIC', @@ -153,7 +152,8 @@ target = { "EFUSE_BIT_OPERATION", "PROVISION_WRITE_WITH_INTERFACE", "FLASH_REGION_CFG_LOADERBOOT", - "BUILD_NOOSAL" + "BUILD_NOOSAL", + "CONFIG_LOADERBOOT" ], 'ram_component': [ "loaderboot_common", "common_boot", "ws63_loaderboot_lds", "dfx_preserve", @@ -264,9 +264,31 @@ target = { 'nv_update':True, 'copy_files_to_interim': True }, + 'ws63-liteos-hilink': { + 'base_target_name': 'target_ws63_hilink_rom_template', + 'os': 'liteos', + 'defines': [ + 'CONFIG_SUPPORT_HILINK_INDIE_UPGRADE', + 'SUPPORT_QUICK_NETCFG', + ], + 'ram_component': [ + 'ws63_liteos_hilink_lds', + 'hilink_addr_map', + 'hilinkdevicesdk', + 'hilinkota', + 'hilinkbtsdk', + 'hilinkquickcfg', + ], + 'ccflags': [ + "-DBOARD_ASIC", '-DPRE_ASIC', + ], + 'application': 'application', + 'bin_name': 'ws63-liteos-hilink', + 'copy_files_to_interim': True + }, 'ws63-liteos-app-iot': { 'base_target_name': 'target_ws63_app_rom_template', - 'liteos_kconfig': 'ws63_iot', #ekko add for remove indie upgrade + # 'liteos_kconfig': 'ws63_iot', #ekko add for remove indie upgrade 'os': 'liteos', 'defines': [ "USE_CMSIS_OS", @@ -308,15 +330,14 @@ target = { "SUPPORT_MINIMALIST_NETCFG", # 极简配网 "SUPPORT_SOFTAP_NETCFG", # softAP配网 "SUPPORT_BLE_ANCILLAY_NETCFG", # ble辅助配网 - "SUPPORT_QUICK_NETCFG", # 快速配网 - # "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE", #ekko remove for indie upgrade + # "SUPPORT_QUICK_NETCFG", # 快速配网 + "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE", #ekko remove for indie upgrade "CONFIG_SPOTLIGHT_UT", #EKKO ADD "CONFIG_USE_CUSTOMER_SVC_INFO", #EKKO ADD "CONFIG_DHCPS_GW", "_HSF_", "CONFIG_PWM_USING_V150", #EKKO ADD # "ENABLE_BLE_SCAN" #open ble scan - # "HF_MCU_OTA" #open mcu ota ], 'ram_component': [ 'ws63_liteos_app', @@ -358,11 +379,11 @@ target = { 'cjson', 'xo_trim_port', 'hilink', - # 'app_addr_map', #ekko remove for indie upgrade - 'hilinkdevicesdk', #ekko add for remove indie upgrade - 'hilinkota', #ekko add for remove indie upgrade - 'hilinkbtsdk', #ekko add for remove indie upgrade - # 'hilinkquickcfg', #ekko add for remove indie upgrade + 'app_addr_map', #ekko remove for indie upgrade + #'hilinkdevicesdk', #ekko add for remove indie upgrade + #'hilinkota', #ekko add for remove indie upgrade + #'hilinkbtsdk', #ekko add for remove indie upgrade + #'hilinkquickcfg', #ekko add for remove indie upgrade 'huks_sdk', 'deviceauth', 'little_fs', 'littlefs_adapt_ws63', @@ -381,28 +402,6 @@ target = { 'nv_update':True, 'copy_files_to_interim': True }, - 'ws63-liteos-hilink': { - 'base_target_name': 'target_ws63_hilink_rom_template', - 'os': 'liteos', - 'defines': [ - 'CONFIG_SUPPORT_HILINK_INDIE_UPGRADE', - 'SUPPORT_QUICK_NETCFG', - ], - 'ram_component': [ - 'ws63_liteos_hilink_lds', - 'hilink_addr_map', - 'hilinkdevicesdk', - 'hilinkota', - 'hilinkbtsdk', - 'hilinkquickcfg', - ], - 'ccflags': [ - "-DBOARD_ASIC", '-DPRE_ASIC', - ], - 'application': 'application', - 'bin_name': 'ws63-liteos-hilink', - 'copy_files_to_interim': True - }, } # custom copy rules, put it in target_group below and it takes effect. diff --git a/build/config/target_config/ws63/fota/fota_format_st.py b/build/config/target_config/ws63/fota/fota_format_st.py deleted file mode 100755 index d359651..0000000 --- a/build/config/target_config/ws63/fota/fota_format_st.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -''' -* Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* Description: part of hupg build scripts -''' - -import struct -from ctypes import * - -###############################Defining Basic Types############################################### -td_char = c_char -td_s8 = c_byte -td_u8 = c_ubyte -td_s16 = c_short -td_u16 = c_ushort -td_s32 = c_int -td_u32 = c_uint - -fota_key_area_data_fields = [ - ("image_id", td_u32), - ("struct_version", td_u32), - ("struct_length", td_u32), - ("signature_length", td_u32), - ("key_owner_id", td_u32), - ("key_id", td_u32), - ("key_alg", td_u32), - ("ecc_curve_type", td_u32), - ("key_length", td_u32), - ("fota_key_version_ext", td_u32), - ("mask_fota_key_version_ext", td_u32), - ("msid_ext", td_u32), - ("mask_msid_ext", td_u32), - ("maintenance_mode", td_u32), - ("die_id", td_u8 * 16), - ("fota_info_addr", td_u32), - ("reserved", td_u8 * 52), - ("fota_external_public_key", td_u8 * 64), - ("sig_fota_key_area", td_u8 * 64), -] - -fota_info_area_data_fields = [ - ("image_id", td_u32), - ("struct_version", td_u32), - ("struct_length", td_u32), - ("signature_length", td_u32), - ("fota_version_ext", td_u32), - ("mask_fota_version_ext", td_u32), - ("msid_ext", td_u32), - ("mask_msid_ext", td_u32), - ("image_hash_table_addr", td_u32), - ("image_hash_table_length", td_u32), - ("image_hash_table_hash", td_u8 * 32), - ("image_num", td_u32), - ("hardware_id", td_u32), - ("reserved", td_u8 * 112), - ("sign_fota_info", td_u8 * 64), -] \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/base_datatype_def.txt b/build/config/target_config/ws63/hdb_config/base_datatype_def.txt deleted file mode 100755 index 3b4a6a5..0000000 --- a/build/config/target_config/ws63/hdb_config/base_datatype_def.txt +++ /dev/null @@ -1,54 +0,0 @@ -uint32_t 32 0 -uint16_t 16 0 -uint8_t 8 0 - -int32_t 32 1 -int16_t 16 1 -int8_t 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -TD_U32 32 0 -TD_U16 16 0 -TD_U8 8 0 -TD_S32 32 1 -TD_S16 16 1 -TD_S8 8 1 -TD_BOOL 8 0 -TD_CHAR 8 1 1 -char 8 1 1 - -long 32 1 -TD_PVOID 32 0 -TD_PBYTE 32 0 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 - -td_pvoid 32 0 -td_pbyte 32 0 -uintptr_t 32 0 - -td_u64 64 0 -td_uintptr_t 32 0 -td_void 32 0 \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_cfg/OTA_MSG_List.txt b/build/config/target_config/ws63/hdb_config/database_cfg/OTA_MSG_List.txt deleted file mode 100755 index 31d5045..0000000 --- a/build/config/target_config/ws63/hdb_config/database_cfg/OTA_MSG_List.txt +++ /dev/null @@ -1,42 +0,0 @@ -//ļBFGNϷMsgIDӦַļʹñļʽ -////עͷţȡڶӦĿʼĩβ[*** START][*** END] -//ӦĸʽΪǰΪMsgIDȻһTabλȻӦַ -//עԼMsgIDӦƣעʲôģʹñݷά -// -//BFGN OTA -//[BFGN OTA START] -//0x2000 abc -//0x2001 efg -//[BFGN OTA END] - -//BT OTA -[BT OTA START] -0x1000 OTA_BT_LMP_NAME_REQ -0x1001 OTA_BT_LMP_NAME_RES -0x1002 OTA_BT_LMP_FEATURE_REQ -0x1003 OTA_BT_LMP_FEATURE_RES -0x1004 OTA_BT_LMP_PDU_TX -0x1005 OTA_BT_LMP_PDU_RX -0x1006 OTA_BT_RW_CS_STRU -0x1007 OTA_BT_EX_TAB -0x1008 OTA_BT_KE_QUEUE -0x1009 OTA_BT_KE_QUEUE -0x100A OTA_BT_LD_ENV_STRU -0x100B OTA_BT_RWBT_ENV_STRU -0x100C OTA_BT_AFH_CHNL_STAT -0x100D OTA_BT_ACL_RX_LINK_STAT -0x100E OTA_BT_SCO_STAT -0x100F OTA_BT_RSSI_STAT -0x1010 OTA_BT_ACL_TX_STAT -0x1011 OTA_BT_SLEEP_STAT -0x1012 OTA_BT_GET_BT_EXT_CS -0x1013 OTA_BT_GET_BLE_EXT_CS -0x1014 OTA_BT_READ_BT_REG -0x1015 OTA_BT_READ_BLE_REG -0x1016 OTA_BT_CHNLSCAN_REPORT -0x1017 OTA_BT_CHNLSCAN_DATA -0x1018 OTA_BT_CHNLSCAN_RSSI -0x1019 OTA_BT_CHNLSCAN_DUTYCYCYLE -0x101A OTA_BT_READ_DATA -0x101B OTA_EA_ELT_TAG -[BT OTA END] \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_cfg/STATUS_CommandList.txt b/build/config/target_config/ws63/hdb_config/database_cfg/STATUS_CommandList.txt deleted file mode 100755 index 2c83f40..0000000 --- a/build/config/target_config/ws63/hdb_config/database_cfg/STATUS_CommandList.txt +++ /dev/null @@ -1,2033 +0,0 @@ -//格式说明: -//[]内的内容为处理的消息ID和参数显示设置,其中MsgID值为16进制,Parameter Number值为10进制,后面的显示为按格式显示,其中除开格式描述字符的其他字符串按字符串显示,格式显示中各个参数显示间以“;”间隔,最后一个参数显示后不加“;” -//格式描述字符说明:%d为将接收到的该参数数据按10进制显示,%x为将接收到的该参数数据按16进制显示,%s为将接收到的该参数数据在对应的参数表中查询对应的字符串再显示该字符串 -//所有的要显示参数都必须有对应的Start、End标记,以%d、%x格式显示的参数仅需加上这两个标记即可,以%s格式显示的参数需添加该标记以及填充对应关系,若无该对应关系,则显示时会显示找不到该参数数据对应的字符串 -//对应关系表:以“ParameterX_CommandList Start:”作为开始标记,以“ParameterX_CommandList End”作为结束标记,每行都有两栏,以TAB键分隔,其中第一栏为索引,第二栏为对应字符串,索引为16进制数据 -//对于数量多且用于多处的对应关系表,添加了提取这个公共部分的功能,公共关系表请放在注释//Public Content START和注释//Public Content END之间部分。 -//公共关系表添加方法,首先添加公共关系表标头,格式为{标头名 START},然后从第二行开始添加对应表,和普通对应表格式相同,公共对应表结束后,要在最后一行添加{PUBLIC END}标尾示意结束。 -//公共关系表使用方法,在需要使用的公共关系表的参数对应表位置,添加格式为$$标头名。 -//以“//”开头的为注释行 -// -//注意:Status MsgID分配【BT:0x0000……0x2fff】【GNSS:0x3000……0x5fff】【NFC:0x6000……0x8fff】【FM:0x9000……0x9fff】,其他预留~ -// -//示例说明: -//{BT OTA} 定义公共对应表 -//0x1 Show_1 -//0x2 Show_2 -//[MsgID=0x0001;Parameter Num=3;Parameter1 Show=%s;Parameter2 Show=%x;Parameter3 Show=%s] -//Parameter1_CommandList Start: -//$$BT OTA 使用公共对应表 -//Parameter1_CommandList End -//Parameter2_CommandList Start: -//Parameter2_CommandList End -//Parameter3_CommandList Start: -//Index Show -//0x1 Show_1 -//0x2 Show_2 -//0x3 Show_3 -//0xa Show_a -//Parameter3_CommandList End -//如果传递过来的参数1、2、3均为0xa,则SDT上显示部分为:Parameter1 Show=10;Parameter2 Show=0xa;Parameter3 Show=Show_a -// -//BT -//[MsgID=0x0801;Parameter Number=4;Src=%s;Dest=%s;Link Id=%d;Msg:%d] -//Parameter1_CommandList Start: -//Index Show -//0 TASK_LM -//Parameter1_CommandList End -// -//Parameter2_CommandList Start: -//Index Show -//1 TASK_LC -//Parameter2_CommandList End -// -//Parameter3_CommandList Start: -//Parameter3_CommandList End -//Parameter4_CommandList Start: -//Parameter4_CommandList End -// - - - - -//Public Content START 公共对应表添加在Public Content START与Public Content END之间 - -{BT CFILE START} -0x0000 hci_romcb.c -0x0001 fsm.c -0x0002 bt_main.c -0x0003 bt_thread.c -0x0004 hci_if.c -0x0005 evt_task_fsm.c -0x0006 dm_ble_fal.c -0x0007 dm_ble_rpa.c -0x0008 lm_ble_adv.c -0x0009 lm_ble_adv_ext_act.c -0x000a lm_ble_adv_fsm.c -0x000b lm_ble_adv_legacy_act.c -0x000c lm_ble_acl.c -0x000d lm_ble_acl_per_fsm.c -0x000e lm_ble_acl_srv_ver.c -0x000f lm_ble_acl_srv_feat.c -0x0010 lm_ble_acl_srv_enc.c -0x0011 lm_ble_acl_srv_enc_central.c -0x0012 lm_ble_acl_srv_enc_peripheral.c -0x0013 lm_ble_acl_srv_conn_update.c -0x0014 lm_ble_acl_srv_phy_upd.c -0x0015 lm_ble_acl_srv_uhd_upd.c -0x0016 lm_ble_acl_srv_map.c -0x0017 lm_ble_acl_srv_pwr_ctrl.c -0x0018 lm_ble_acl_srv_data_length.c -0x0019 lm_ble_acl_srv_cs.c -0x001a lm_ble_acl_disc.c -0x001b lm_ble_scan.c -0x001c lm_ble_scan_fsm.c -0x001d lm_ble_legacy_scan_act.c -0x001e lm_ble_ext_scan_act.c -0x001f lm_ble_initiate.c -0x0020 lm_ble_legacy_initiate_act.c -0x0021 lm_ble_initiate_fsm.c -0x0022 lm_ble_ext_initiate_act.c -0x0023 lm_ble_test_mode_act.c -0x0024 lm_ble_acl_fsm.c -0x0025 lm_ble_test_mode.c -0x0026 lm_ble_test_mode_fsm.c -0x0027 lm_gle_acb_disc.c -0x0028 lm_gle_acb_fsm.c -0x0029 lm_gle_acb.c -0x002a lm_gle_iob_disc.c -0x002b lm_gle_iob_fsm.c -0x002c lm_gle_iob.c -0x002d evt_task_ble_acl.c -0x002e evt_task_ble_adv.c -0x002f evt_task_ble_scan.c -0x0030 evt_task_ble_scan_isr.c -0x0031 evt_task_ble_initiate.c -0x0032 evt_task_ble_initiate_isr.c -0x0033 evt_task_chnl_scan.c -0x0034 evt_task_ble_test_mode.c -0x0035 evt_task_ble_test_mode_isr.c -0x0036 evt_task_ble_cs.c -0x0037 evt_task_gle_acb.c -0x0038 evt_sched.c -0x0039 evt_sched_calc.c -0x003a evt_sched_mgr.c -0x003b evt_sched_util.c -0x003c evt_prog.c -0x003d ble_isr.c -0x003e gle_isr.c -0x003f hci_bt.c -0x0040 hci_gle.c -0x0041 em_sed.c -0x0042 hw_em.c -0x0043 dts_mem.c -0x0044 dts_hci.c -0x0045 em_tx_buff.c -0x0046 em_tx_desc.c -0x0047 em_mgr.c -0x0048 bt_adpll.c -0x0049 bt_rf_table.c -0x004a bt_hal_control.c -0x004b mpw_poweron.c -0x004c btc_timer.c -0x004d bgtp_sleep_sw.c -0x004e bgtp_pmu_fsm.c -0x004f btdfx_fn.c -0x0050 lm_chnl_scan.c -0x0051 dts_coex.c -0x0052 coex_adapter.c -0x0053 coex_if.c -0x0054 encrypt.c -0x0055 lm_ble_acl_srv_priv_feat.c -0x0056 bt_cali_func.c -0x0057 bt_cali_main.c -0x0058 bt_hal_cali.c -0x0059 em_rx_desc.c -0x005a em_map.c -0x005b cali_entrance.c -0x005c cali_state.c -0x005d cali_rx.c -0x005e cali_tx.c -0x005f cali_adpll.c -0x0060 cali_list.c -0x0061 hal_bt_cali.c -0x0062 rf_calibration_alg.c -0x0063 rf_accumulation.c -0x0064 lm_gle_scan_fsm.c -0x0065 lm_gle_scan_act.c -0x0066 evt_task_gle_scan.c -0x0067 lm_gle_scan.c -0x0068 lm_gle_initiate_fsm.c -0x0069 evt_task_gle_initiate.c -0x006a lm_gle_initiate.c -0x006b lm_gle_initiate_act.c -0x006c lm_ble_per_adv.c -0x006d lm_ble_per_adv_fsm.c -0x006e lm_ble_per_adv_act.c -0x006f evt_task_ble_per_adv.c -0x0070 lm_ble_per_sync.c -0x0071 lm_ble_per_sync_fsm.c -0x0072 lm_ble_per_sync_act.c -0x0073 evt_task_ble_per_sync.c -0x0074 evt_task_ble_adv_isr.c -0x0075 evt_task_gle_scan_isr.c -0x0076 evt_task_gle_initiate_isr.c -0x0077 evt_task_gle_adv.c -0x0078 ecc_p256.c -0x0079 evt_task_gle_test_mode.c -0x007a evt_task_gle_test_mode_isr.c -0x007b lm_gle_test_mode_act.c -0x007c lm_gle_test_mode.c -0x007d lm_gle_test_mode_fsm.c -0x007e dts_mips.c -0x007f evt_task_gle_iob.c -0x0080 lm_gle_adv_act.c -0x0081 evt_task_gle_adv_isr.c -0x0082 lm_gle_acb_srv_conn_update.c -0x0083 lm_gle_acb_srv_feat.c -0x0084 lm_gle_acb_srv_phy_update.c -0x0085 evt_task_gle_adv_scan_comm.c -0x0086 lm_gle_acb_srv_map.c -0x0087 lm_gle_acb_srv_ver.c -0x0088 enc_ke_ecc.c -0x0089 lm_gle_acb_srv_enc.c -0x008a evt_task_ble_ext_adv.c -0x008b lm_ble_scan_filter.c -0x008c lm_gle_acb_srv_data_length.c -0x008d evt_task_gle_imb.c -0x008e lm_gle_acb_srv_imb.c -0x008f hci_comm_if.c -0x0090 lm_gle_acb_srv_pwr_ctrl.c -0x0091 dm_co.c -0x0092 lm_ble_acl_srv_conn_update_fsm_act.c -0x0093 lm_gle_imb.c -0x0094 enc_kd_sm3.c -0x0095 evt_task_comm.c -0x0096 lm_ble_comm.c -0x0097 lm_gle_acb_srv_set_evt_param.c -0x0098 evt_task_gle_acb_isr.c -0x0099 bt_customize.c -0x009a cali_dll.c -0x009b evt_task_gle_acb_retry.c -0x009c evt_task_gle_comm.c -0x009d lm_gle_acb_srv_set_low_latency.c -0x009e em_gle_rx_desc.c -0x009f dts_btc_task.c -0x00a0 lm_ble_acl_ram.c -0x00a1 evt_task_ble_acl_ram.c -0x00a2 evt_task_ble_scan_ram.c -0x00a3 evt_task_ble_initiate_ram.c -0x00a4 evt_sched_ram.c -0x00a5 evt_sched_mgr_ram.c -0x00a6 evt_sched_util_ram.c -0x00a7 evt_prog_ram.c -0x00a8 em_map_ram.c -0x00a9 lm_ble_scan_act_ram.c -0x00aa lm_ble_ext_scan_act_ram.c -0x00ab enc_kd_sm3_ram.c -0x00ac evt_task_ble_ext_adv_ram.c -0x00ad bgtp_sleep_sw_ram.c -0x00ae evt_task_ble_adv_ram.c -0x00af splz_adv_recv.c -0x00b0 splz_adv_recv_isr.c -{PUBLIC END} - -{BT FSM_TYPE START} -0x0000 FSM_INVALID -0x0001 FSM_TYPE_HCI_BT -0x0002 FSM_TYPE_HCI_GLE -0x0003 FSM_TYPE_HCI_BT_SUB -0x0004 FSM_TYPE_HCI_GLE_SUB -0x0005 FSM_TYPE_DM_COMM -0x0006 FSM_TYPE_DM_BLE -0x0007 FSM_TYPE_DM_GLE -0x0008 FSM_TYPE_DM_BT -0x0009 FSM_TYPE_LM_BLE_ADV -0x000a FSM_TYPE_LM_BLE_EXT_ADV_INIT -0x000b FSM_TYPE_LM_BLE_EXT_ADV -0x000c FSM_TYPE_LM_BLE_EXT_ADV_COMM -0x000d FSM_TYPE_LM_BLE_PER_ADV -0x000e FSM_TYPE_LM_BLE_SCAN -0x000f FSM_TYPE_LM_BLE_PER_SYNC -0x0010 FSM_TYPE_LM_BLE_PER_SYNC_MGR -0x0011 FSM_TYPE_LM_BLE_INITIATE -0x0012 FSM_TYPE_LM_BLE_ACL -0x0013 FSM_TYPE_LM_BLE_FEATS -0x0014 FSM_TYPE_LM_BLE_VER -0x0015 FSM_TYPE_LM_BLE_CONN_UPD -0x0016 FSM_TYPE_LM_BLE_ENABLE_ENC -0x0017 FSM_TYPE_LM_BLE_PHY_UPD -0x0018 FSM_TYPE_LM_BLE_UHD_UPD -0x0019 FSM_TYPE_LM_BLE_MAP_UPD -0x001a FSM_TYPE_LM_BLE_TEST_MODE -0x001b FSM_TYPE_LM_BLE_PWR_CTRL -0x001c FSM_TYPE_LM_BLE_DATA_LEN_UPD -0x001d FSM_TYPE_LM_BLE_PRIV_FEAT -0x001e FSM_TYPE_LM_GLE -0x001f FSM_TYPE_LM_GLE_ACB -0x0020 FSM_TYPE_LM_GLE_IOB -0x0021 FSM_TYPE_LM_GLE_TEST_MODE -0x0022 FSM_TYPE_LM_BT -0x0023 FSM_TYPE_LM_BLE_CS -0x0024 FSM_TYPE_EVT_TASK_BLE_ACL -0x0025 FSM_TYPE_EVT_TASK_BLE_ADV -0x0026 FSM_TYPE_EVT_TASK_BLE_PRIM_ADV -0x0027 FSM_TYPE_EVT_TASK_BLE_AUX_ADV -0x0028 FSM_TYPE_EVT_TASK_BLE_PER_ADV -0x0029 FSM_TYPE_EVT_TASK_BLE_PER_SYNC -0x002a FSM_TYPE_EVT_TASK_BLE_SCAN -0x002b FSM_TYPE_EVT_TASK_BLE_INITIATE -0x002c FSM_TYPE_EVT_TASK_GLE -0x002d FSM_TYPE_EVT_TASK_GLE_ACB -0x002e FSM_TYPE_EVT_TASK_GLE_IOB -0x002f FSM_TYPE_EVT_TASK_ISO -0x0030 FSM_TYPE_EVT_TASK_BT -0x0031 FSM_TYPE_EVT_TASK_CHNL_SCAN -0x0032 FSM_TYPE_EVT_TASK_BLE_TEST_MODE -0x0033 FSM_TYPE_EVT_TASK_BLE_CS -0x0034 FSM_TYPE_SCH -0x0035 FSM_TYPE_PROG -0x0036 FSM_TYPE_DPC -0x0037 FSM_TYPE_ISR -0x0038 FSM_TYPE_TIMER -0x0039 FSM_TYPE_ENCRYPT -0x003a FSM_TYPE_COEX -0x003b FSM_TYPE_LM_GLE_SCAN -0x003c FSM_TYPE_LM_GLE_INITIATE -0x003d FSM_TYPE_EVT_TASK_GLE_SCAN -0x003e FSM_TYPE_EVT_TASK_GLE_SCAN_AUX -0x003f FSM_TYPE_EVT_TASK_GLE_SCAN_REQ -0x0040 FSM_TYPE_EVT_TASK_GLE_INITIATE -0x0041 FSM_TYPE_EVT_TASK_GLE_INITIATE_AUX -0x0042 FSM_TYPE_EVT_TASK_GLE_INITIATE_REQ -0x0043 FSM_TYPE_LM_GLE_ADV -0x0044 FSM_TYPE_LM_GLE_ADV_COMM -0x0045 FSM_TYPE_EVT_TASK_GLE_ADV -0x0046 FSM_TYPE_EVT_TASK_GLE_TEST_MODE -0x0047 FSM_TYPE_LOWPOWER -0x0048 FSM_TYPE_EVT_TASK_GLE_SCAN_RSP -0x0049 FSM_TYPE_LM_GLE_CONN_UPD -0x004a FSM_TYPE_LM_GLE_PHY_UPD -0x004b FSM_TYPE_LM_GLE_MAP_UPD -0x004c FSM_TYPE_LM_GLE_FEATS -0x004d FSM_TYPE_LM_GLE_IMB -0x004e FSM_TYPE_LM_GLE_IMG -0x004f FSM_TYPE_LM_GLE_IMG_FSM_EXISTED -0x0050 FSM_TYPE_LM_GLE_ENC_CHANGE -0x0051 FSM_TYPE_LM_GLE_VER -0x0052 FSM_TYPE_LM_GLE_DATA_LEN_UPD -0x0053 FSM_TYPE_EVT_TASK_GLE_IMB -0x0054 FSM_TYPE_DISPATCH_HCI_GLE_DISCONNECT -0x0055 FSM_TYPE_LM_GLE_PWR_CTRL -0x0056 FSM_TYPE_LM_GLE_ACB_EVT_PARAM_UPDATE -0x0057 FSM_TYPE_EVT_TASK_GLE_ACB_RETRY -0x0058 FSM_TYPE_LM_GLE_ACB_LOW_LATENCY_UPDATE -0x0059 FSM_TYPE_EVT_TASK_GLE_AUX_ADV -0x005a FSM_TYPE_EVT_TASK_GLE_REQ_RX -0x005b FSM_TYPE_EVT_TASK_GLE_RSP_ADV -0x005c FSM_TYPE_EVT_TASK_GLE_INITIATE_RSP -0x005d FSM_TYPE_BUTT -{PUBLIC END} - -{BT FSM_STATE START} -0x0000 LM_BLE_STATE_ADV_STANDBY -0x0001 LM_BLE_STATE_ADV_ADVERTISING -0x0002 LM_BLE_STATE_ADV_STOPPING -0x0003 LM_BLE_STATE_ADV_REMOVING -0x0004 LM_BLE_STATE_ADV_COMM_IDLE -0x0005 LM_BLE_STATE_ADV_COMM_BUSY -0x0006 LM_BLE_STATE_PER_ADV_IDLE -0x0007 LM_BLE_STATE_PER_ADV_CONFIGING -0x0008 LM_BLE_STATE_PER_ADV_PENDING -0x0009 LM_BLE_STATE_PER_ADV_RUNNING -0x000a LM_BLE_STATE_PER_ADV_RUNNING_CTE_RUNNING -0x000b LM_BLE_STATE_PER_SYNC_MGR_STANDBY -0x000c LM_BLE_STATE_PER_SYNC_MGR_SYNCING -0x000d LM_BLE_STATE_PER_SYNC_STANDBY -0x000e LM_BLE_STATE_PER_SYNC_PENDING -0x000f LM_BLE_STATE_PER_SYNC_SYNCING -0x0010 LM_BLE_STATE_PER_SYNC_CANCELLING -0x0011 LM_BLE_STATE_PER_SYNC_SYNCED -0x0012 LM_BLE_STATE_SCAN_OFF -0x0013 LM_BLE_STATE_SCANNING -0x0014 LM_BLE_STATE_SCAN_STOPPING -0x0015 LM_BLE_STATE_INITIATE_OFF -0x0016 LM_BLE_STATE_INITIATING -0x0017 LM_BLE_STATE_INITIATE_STOPPING -0x0018 LM_BLE_STATE_CONNECTION -0x0019 LM_BLE_STATE_ACL_WAIT_DISC_TX_ACK -0x001a LM_BLE_STATE_ACL_WAIT_SCHED_STOP -0x001b LM_BLE_STATE_FEATS_IDLE -0x001c LM_BLE_STATE_WAIT_FEATS_RSP -0x001d LM_BLE_STATE_VER_IDLE -0x001e LM_BLE_STATE_WAIT_VER_RSP -0x001f LM_BLE_STATE_MAP_UPDATA_IDLE -0x0020 LM_BLE_STATE_WAIT_MAP_IND_ACK -0x0021 LM_BLE_STATE_WAIT_MAP_IND_ACK_INSTANT_PAST -0x0022 LM_BLE_STATE_WAIT_MAP_INSTANT -0x0023 LM_BLE_STATE_PHY_UPD_IDLE -0x0024 LM_BLE_STATE_PHY_UPD_WAIT_RSP -0x0025 LM_BLE_STATE_PHY_UPD_WAIT_IND -0x0026 LM_BLE_STATE_PHY_UPD_WAIT_INST -0x0027 LM_BLE_STATE_UHD_UPD_IDLE -0x0028 LM_BLE_STATE_UHD_UPD_WAIT_RSP -0x0029 LM_BLE_STATE_UHD_UPD_WAIT_IND -0x002a LM_BLE_STATE_UHD_UPD_WAIT_INST -0x002b LM_BLE_STATE_CONN_UPDATE_IDLE -0x002c LM_BLE_STATE_WAIT_UPDATE_RSP -0x002d LM_BLE_STATE_WAIT_UPDATE_IND -0x002e LM_BLE_STATE_WAIT_UPDATE_CMP -0x002f LM_BLE_STATE_WAIT_UPDATE_HOST_REPLY -0x0030 LM_BLE_STATE_CENTRAL_ENCRYPTED -0x0031 LM_BLE_STATE_CENTRAL_STANDBY -0x0032 LM_BLE_STATE_CENTRAL_REQUEST_ENC_PAUSE -0x0033 LM_BLE_STATE_CENTRAL_GENERATE_SKD_IV -0x0034 LM_BLE_STATE_CENTRAL_REQUEST_ENC -0x0035 LM_BLE_STATE_CENTRAL_CALCULATE_SK -0x0036 LM_BLE_STATE_CENTRAL_SK_READY -0x0037 LM_BLE_STATE_CENTRAL_ENC_START_REQUESTED -0x0038 LM_BLE_STATE_CENTRAL_RESPOND_ENC_START -0x0039 LM_BLE_STATE_PERIPHERAL_ENCRYPTED -0x003a LM_BLE_STATE_PERIPHERAL_RESPOND_ENC_PAUSE -0x003b LM_BLE_STATE_PERIPHERAL_STANDBY -0x003c LM_BLE_STATE_PERIPHERAL_RESPOND_ENC -0x003d LM_BLE_STATE_PERIPHERAL_GENERATE_SKD_IV -0x003e LM_BLE_STATE_PERIPHERAL_REQUEST_LTK -0x003f LM_BLE_STATE_PERIPHERAL_CALCULATE_SK -0x0040 LM_BLE_STATE_PERIPHERAL_REQUEST_ENC_START -0x0041 LM_BLE_STATE_PWR_CTRL_IDLE -0x0042 LM_BLE_STATE_WAIT_PWR_CTRL_RSP -0x0043 LM_BLE_STATE_TEST_MODE_IDLE -0x0044 LM_BLE_STATE_TEST_MODE_BUSY -0x0045 LM_BLE_STATE_TEST_MODE_STOPPING -0x0046 LM_BLE_STATE_DATA_LENGTH_IDLE -0x0047 LM_BLE_STATE_DATA_LENGTH_WAIT_RSP -0x0048 LM_BLE_STATE_PRIV_FEAT_IDLE -0x0049 LM_BLE_STATE_WAIT_PRIV_FEAT_RSP -0x004a LM_GLE_STATE_CONNECTION -0x004b LM_GLE_STATE_ACB_WAIT_DISC_TX_ACK -0x004c LM_GLE_STATE_ACB_WAIT_SCHED_STOP -0x004d LM_GLE_STATE_IOB_WAIT_DISC_TX_ACK -0x004e LM_GLE_STATE_IOB_WAIT_SCHED_STOP -0x004f LM_BLE_STATE_CS_IDLE -0x0050 LM_BLE_STATE_WAIT_REMOTE_CAP_RSP -0x0051 LM_BLE_STATE_WAIT_REMOTE_CONFIG_RSP -0x0052 LM_BLE_STATE_WAIT_REMOTE_CS_RSP -0x0053 LM_BLE_STATE_WAIT_REMOTE_CS_IND -0x0054 EVT_TASK_STATE_IDLE -0x0055 EVT_TASK_STATE_ENDING -0x0056 LM_GLE_STATE_SCAN_OFF -0x0057 LM_GLE_STATE_SCANNING -0x0058 LM_GLE_STATE_SCAN_STOPPING -0x0059 LM_GLE_STATE_INITIATE_OFF -0x005a LM_GLE_STATE_INITIATING -0x005b LM_GLE_STATE_INITIATE_STOPPING -0x005c LM_GLE_STATE_ADV_STANDBY -0x005d LM_GLE_STATE_ADV_ADVERTISING -0x005e LM_GLE_STATE_ADV_STOPPING -0x005f LM_GLE_STATE_ADV_REMOVING -0x0060 LM_GLE_STATE_ADV_COMM_IDLE -0x0061 LM_GLE_STATE_ADV_COMM_BUSY -0x0062 LM_GLE_STATE_TEST_MODE_IDLE -0x0063 LM_GLE_STATE_TEST_MODE_BUSY -0x0064 LM_GLE_STATE_TEST_MODE_STOPPING -0x0065 LM_GLE_STATE_CONN_UPDATE_IDLE -0x0066 LM_GLE_STATE_CONN_UPDATE_WAIT_RSP -0x0067 LM_GLE_STATE_CONN_UPDATE_WAIT_IND -0x0068 LM_GLE_STATE_CONN_UPDATE_WAIT_CMP -0x0069 LM_GLE_STATE_CONN_UPDATE_WAIT_HOST_REPLY -0x006a LM_GLE_STATE_ENCRYPTED -0x006b LM_GLE_STATE_ENC_STANDBY -0x006c LM_GLE_STATE_G_WAIT_ENC_STOP_RSP -0x006d LM_GLE_STATE_G_WAIT_ENC_STOP_RSP_ACK -0x006e LM_GLE_STATE_G_GENERATE_SKD_IV -0x006f LM_GLE_STATE_G_WAIT_ENC_RSP -0x0070 LM_GLE_STATE_G_CALCULATE_SK -0x0071 LM_GLE_STATE_G_SK_READY -0x0072 LM_GLE_STATE_G_ENC_START_REQUESTED -0x0073 LM_GLE_STATE_G_WAIT_ENC_START_RSP -0x0074 LM_GLE_STATE_T_WAIT_ENC_STOP_RSP -0x0075 LM_GLE_STATE_T_GENERATE_SKD_IV -0x0076 LM_GLE_STATE_T_WAIT_ENC_PARAM -0x0077 LM_GLE_STATE_T_CALCULATE_SK -0x0078 LM_GLE_STATE_T_WAIT_ENC_START_RSP -0x0079 LM_GLE_STATE_PHY_UPDATE_IDLE -0x007a LM_GLE_STATE_PHY_UPDATE_WAIT_IND -0x007b LM_GLE_STATE_PHY_UPDATE_WAIT_CMP -0x007c LM_GLE_STATE_WAIT_FEATS_RSP -0x007d LM_GLE_STATE_MAP_UPDATA_IDLE -0x007e LM_GLE_STATE_WAIT_MAP_IND_ACK -0x007f LM_GLE_STATE_WAIT_MAP_IND_ACK_INSTANT_PAST -0x0080 LM_GLE_STATE_WAIT_MAP_INSTANT -0x0081 LM_GLE_STATE_DATA_LENGTH_IDLE -0x0082 LM_GLE_STATE_DATA_LENGTH_WAIT_RSP -0x0083 LM_GLE_STATE_IMG_INITED -0x0084 LM_GLE_STATE_IMG_SETUP -0x0085 LM_GLE_STATE_IMG_WAIT_ACTIVE -0x0086 LM_GLE_STATE_IMG_ACTIVE -0x0087 LM_GLE_STATE_IMG_WAIT_DISC -0x0088 LM_GLE_STATE_IMB_INIT -0x0089 LM_GLE_STATE_IMB_CREATED -0x008a LM_GLE_STATE_IMB_WAIT_HOST_REPLY -0x008b LM_GLE_STATE_IMB_DISC_INITD -0x008c LM_GLE_STATE_IMB_WAIT_DISC_TX_ACK -0x008d LM_GLE_STATE_IMG_WAIT_SCHED_STOP -0x008e LM_GLE_STATE_WAIT_VER_RSP -0x008f LM_GLE_STATE_PWR_CTRL_IDLE -0x0090 LM_GLE_STATE_WAIT_PWR_CTRL_RSP -0x0091 LM_GLE_STATE_ACB_SET_EVT_PARAM_IDLE -0x0092 LM_GLE_STATE_WAIT_ACB_ACCEPT_EVT_PARAM -0x0093 LM_GLE_STATE_ACB_SET_LOW_LATENCY_IDLE -0x0094 LM_GLE_STATE_WAIT_ACB_ACCEPT_LOW_LATENCY -0x0095 LM_GLE_STATE_WAIT_ACB_ACCEPT_LOW_LATENCY_ACK -0x0096 FSM_STATE_BUTT -{PUBLIC END} - -{BT BT_CMD START} -0x0406 HCI_DISCONNECT -0x041d HCI_READ_REMOTE_VERSION_INFORMATION -0x0c01 HCI_SET_EVENT_MASK -0x0c03 HCI_RESET -0x0c13 HCI_WRITE_LOCAL_NAME -0x0c14 HCI_READ_LOCAL_NAME -0x0c31 HCI_SET_CONTROLLER_TO_HOST_FLOW_CONTROL -0x0c33 HCI_HOST_BUFFER_SIZE -0x0c48 HCI_READ_AFH_CHANNEL_ASSESSMENT_MODE -0x0c49 HCI_WRITE_AFH_CHANNEL_ASSESSMENT_MODE -0x0c63 HCI_SET_EVENT_MASK_PAGE_2 -0x0c6c HCI_READ_LE_HOST_SUPPORT -0x0c6d HCI_WRITE_LE_HOST_SUPPORT -0x1001 HCI_READ_LOCAL_VERSION_INFORMATION -0x1002 HCI_READ_LOCAL_SUPPORTED_COMMANDS -0x1003 HCI_READ_LOCAL_SUPPORTED_FEATURES -0x1009 HCI_READ_BD_ADDR -0x1405 HCI_READ_RSSI -0x2001 HCI_LE_SET_EVENT_MASK -0x2002 HCI_LE_READ_BUFFER_SIZE -0x2003 HCI_LE_READ_LOCAL_SUPPORTED_FEATURES -0x2005 HCI_LE_SET_RANDOM_ADDRESS -0x2006 HCI_LE_SET_ADVERTISING_PARAMETERS -0x2007 HCI_LE_READ_ADVERTISING_CHANNEL_TX_POWER -0x2008 HCI_LE_SET_ADVERTISING_DATA -0x2009 HCI_LE_SET_SCAN_RESPONSE_DATA -0x200a HCI_LE_SET_ADVERTISING_ENABLE -0x200b HCI_LE_SET_SCAN_PARAMETERS -0x200c HCI_LE_SET_SCAN_ENABLE -0x200d HCI_LE_CREATE_CONNECTION -0x200e HCI_LE_CREATE_CONNECTION_CANCEL -0x200f HCI_LE_READ_FILTER_ACCEPT_LIST_SIZE -0x2010 HCI_LE_CLEAR_FILTER_ACCEPT_LIST -0x2011 HCI_LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST -0x2012 HCI_LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST -0x2013 HCI_LE_CONNECTION_UPDATE -0x2014 HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION -0x2015 HCI_LE_READ_CHANNEL_MAP -0x2016 HCI_LE_READ_REMOTE_FEATURES -0x2017 HCI_LE_ENCRYPT -0x2018 HCI_LE_RAND -0x2019 HCI_LE_ENABLE_ENCRYPTION -0x201a HCI_LE_LTK_REQUEST_REPLY -0x201b HCI_LE_LTK_REQUEST_NEGATIVE_REPLY -0x201c HCI_LE_READ_SUPPORTED_STATES -0x201d HCI_LE_RX_TEST_V1 -0x201e HCI_LE_TX_TEST_V1 -0x201f HCI_LE_TEST_END -0x2020 HCI_LE_REM_CONNECTION_PARAM_REQ_REPLY -0x2021 HCI_LE_REM_CONNECTION_PARAM_REQ_NEGATIVE_REPLY -0x2022 HCI_LE_SET_DATA_LENGTH -0x2023 HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH -0x2024 HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH -0x2025 HCI_LE_READ_LOCAL_P256_PUBLIC_KEY -0x2026 HCI_LE_GENERATE_DHKEY_V1 -0x2027 HCI_LE_ADD_DEVICE_TO_RESOLVING_LIST -0x2028 HCI_LE_REMOVE_DEVICE_FROM_RESOLVING_LIST -0x2029 HCI_LE_CLEAR_RESOLVING_LIST -0x202a HCI_LE_READ_RESOLVING_LIST_SIZE -0x202b HCI_LE_READ_PEER_RESOLVABLE_ADDRESS -0x202c HCI_LE_READ_LOCAL_RESOLVABLE_ADDRESS -0x202d HCI_LE_SET_ADDRESS_RESOLUTION_ENABLE -0x202e HCI_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT -0x202f HCI_LE_READ_MAXIMUM_DATA_LENGTH -0x2030 HCI_LE_READ_PHY -0x2031 HCI_LE_SET_DEFAULT_PHY -0x2032 HCI_LE_SET_PHY -0x2033 HCI_LE_RX_TEST_V2 -0x2034 HCI_LE_TX_TEST_V2 -0x2035 HCI_LE_SET_ADVERTISING_SET_RANDOM_ADDRESS -0x2036 HCI_LE_SET_EXTENDED_ADVERTISING_PARAMETERS -0x2037 HCI_LE_SET_EXTENDED_ADVERTISING_DATA -0x2038 HCI_LE_SET_EXTENDED_SCAN_RESPONSE_DATA -0x2039 HCI_LE_SET_EXTENDED_ADVERTISING_ENABLE -0x203a HCI_LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH -0x203b HCI_LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS -0x203c HCI_LE_REMOVE_ADVERTISING_SET -0x203d HCI_LE_CLEAR_ADVERTISING_SETS -0x203e HCI_LE_SET_PERIODIC_ADVERTISING_PARAMETERS -0x203f HCI_LE_SET_PERIODIC_ADVERTISING_DATA -0x2040 HCI_LE_SET_PERIODIC_ADVERTISING_ENABLE -0x2041 HCI_LE_SET_EXTENDED_SCAN_PARAMETERS -0x2042 HCI_LE_SET_EXTENDED_SCAN_ENABLE -0x2043 HCI_LE_EXTENDED_CREATE_CONNECTION -0x2044 HCI_LE_PERIODIC_ADVERTISING_CREATE_SYNC -0x2045 HCI_LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL -0x2046 HCI_LE_PERIODIC_ADVERTISING_TERMINATE_SYNC -0x2047 HCI_LE_ADD_DEVICE_TO_PERIODIC_ADVERTISER_LIST -0x2048 HCI_LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISER_LIST -0x2049 HCI_LE_CLEAR_PERIODIC_ADVERTISER_LIST -0x204a HCI_LE_READ_PERIODIC_ADVERTISER_LIST_SIZE -0x204b HCI_LE_READ_TRANSMIT_POWER -0x204c HCI_LE_READ_RF_PATH_COMPENSATION -0x204d HCI_LE_WRITE_RF_PATH_COMPENSATION -0x204e HCI_LE_SET_PRIVACY_MODE -0x204f HCI_LE_RX_TEST_V3 -0x2050 HCI_LE_TX_TEST_V3 -0x2051 HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_PARAMETERS -0x2052 HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_ENABLE -0x2058 HCI_LE_READ_ANTENNA_INFORMATION -0x2059 HCI_LE_SET_PERIODIC_ADVERTISING_RECEIVE_ENABLE -0x205e HCI_LE_GENERATE_DHKEY_V2 -0x2076 HCI_LE_ENHANCED_READ_TRANSMIT_POWER_LEVEL -0x2077 HCI_LE_READ_REMOTE_TRANSMIT_POWER_LEVEL -0x2078 HCI_LE_SET_PATH_LOSS_REPORTING_PARAMETERS -0x2079 HCI_LE_SET_PATH_LOSS_REPORTING_ENABLE -0x207a HCI_LE_SET_TRANSMIT_POWER_REPORTING_ENABLE -0x207b HCI_LE_TX_TEST_V4 -0x2099 HCI_LE_SET_HADM_PARAM -0x209a HCI_LE_SET_HADM_EN -0x2100 HCI_LE_READ_LOCAL_HADM_CAPS -0x2101 HCI_LE_READ_REMOTE_HADM_CAPS -0x2102 HCI_LE_CREATE_HADM_CONFIG -0x2103 HCI_LE_SET_HADM_PROCEDURE_EN -0xfc32 HCI_VENDOR_SET_BD_ADDR -0xfc4a HCI_RD_LOCAL_DEV_PRIV_FEAT -0xfc4f HCI_WR_LOCAL_HOST_PRIV_FEAT -0xfd53 HCI_LE_GET_VENDOR_CAPS -0xfd57 HCI_LE_ADV_FILTER -0xfdb1 HCI_LE_RD_REMOTE_PRIV_FEAT -0xfdb2 HCI_DBG_LE_SET_UHD_PHY -0xfdb3 HCI_DBG_LE_READ_UHD_PHY -0xfdb7 HCI_PRODUCT_LINE_ADPLL_START_TX -0xfdb8 HCI_PRODUCT_LINE_CALI -{PUBLIC END} - -{BT GLE_CMD START} -0x0402 HCI_GLE_READ_BUFFER_SIZE -0x0403 HCI_GLE_READ_LOCAL_SUPPORTED_FEATURES -0x0404 HCI_GLE_READ_LOCAL_VERSION_INFORMATION -0x0405 HCI_GLE_SET_PUBLIC_ADDRESS -0x0406 HCI_GLE_GET_PUBLIC_ADDRESS -0x0407 HCI_GLE_SET_RANDOM_ADDRESS -0x0408 HCI_GLE_RESET -0x0409 HCI_GLE_SET_HOST_CHANNEL_CLASSIFICATION -0x040a HCI_GLE_READ_ACCESS_FILTER_LIST_SIZE -0x040b HCI_GLE_CLEAR_ACCESS_FILTER_LIST -0x040c HCI_GLE_ADD_DEVICE_TO_ACCESS_FILTER_LIST -0x040d HCI_GLE_REMOVE_DEVICE_FROM_ACCESS_FILTER_LIST -0x0c02 HCI_GLE_SET_ADVERTISING_PARAMETERS -0x0c03 HCI_GLE_SET_ADVERTISING_DATA -0x0c04 HCI_GLE_SET_SCAN_RESPONSE_DATA -0x0c05 HCI_GLE_SET_ADVERTISING_ENABLE -0x0c06 HCI_GLE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH -0x0c07 HCI_GLE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS -0x0c08 HCI_GLE_REMOVE_ADVERTISING_SET -0x1001 HCI_GLE_SET_SCAN_PARAMETERS -0x1002 HCI_GLE_SET_SCAN_ENABLE -0x1003 HCI_GLE_SET_SCAN_DATA -0x1401 HCI_GLE_CREATE_CONNECTION -0x1402 HCI_GLE_CREATE_CONNECTION_CANCEL -0x1403 HCI_GLE_DISCONNECT -0x1801 HCI_GLE_READ_REMOTE_FEATURES -0x1802 HCI_GLE_READ_REMOTE_VERSION -0x1804 HCI_GLE_SET_DATA_LENGTH -0x1805 HCI_GLE_READ_PHY -0x1806 HCI_GLE_SET_PHY -0x1807 HCI_GLE_CONNECTION_UPDATE -0x1808 HCI_GLE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY -0x1809 HCI_GLE_READ_CHANNEL_MAP -0x180a HCI_GLE_SET_MCS -0x180c HCI_GLE_READ_RSSI -0x180d HCI_GLE_SET_LOCAL_POWER_VALUE -0x180e HCI_GLE_GET_LOCAL_POWER_VALUE -0x180f HCI_GLE_GET_REMOTE_POWER_VALUE -0x1810 HCI_GLE_SET_POWER_CHANGE_REPORT_ENABLE -0x1811 HCI_GLE_SET_ACB_EVT_PARAM -0x18ff HCI_GLE_SET_ACB_LOW_LATENCY -0x1c01 HCI_GLE_ENCRYPT -0x1c02 HCI_GLE_RANDOM -0x1c03 HCI_GLE_ENABLE_ENCRYPTION -0x1c04 HCI_GLE_DISABLE_ENCRYPTION -0x1c05 HCI_GLE_ENC_PARAM_REQUEST_REPLY -0x1c06 HCI_GLE_ENC_PARAM_REQUEST_NEGATIVE_REPLY -0x1c07 HCI_GLE_READ_SUPPORT_CRYPTO_ALGO -0x2c01 HCI_GLE_SET_IMG_PARAMETER -0x2c02 HCI_GLE_CREATE_IMB -0x2c03 HCI_GLE_REMOVE_IMG -0x2c04 HCI_GLE_ACCEPT_IMB_REQUEST -0x2c05 HCI_GLE_REJECT_IMB_REQUEST -0xfc01 HCI_GLE_RX_TEST -0xfc02 HCI_GLE_TX_TEST -0xfc03 HCI_GLE_TEST_END -{PUBLIC END} - -{BT BT_EVT START} -0x0005 HCI_DISCONNECTION_COMPLETE -0x0008 HCI_ENCRYPTION_CHANGE_V1 -0x000c HCI_READ_REMOTE_VERSION_INFORMATION_COMPLETE -0x000e HCI_COMMAND_COMPLETE -0x000f HCI_COMMAND_STATUS -0x0010 HCI_HARDWARE_ERROR -0x0013 HCI_NUMBER_OF_COMPLETED_PACKETS -0x001a HCI_DATA_BUFFER_OVERFLOW -0x0030 HCI_ENCRYPTION_KEY_REFRESH_COMPLETE -0x003e HCI_LE_META_EVENT -0x00ff HCI_VENDOR_DEBUG_EVENT -{PUBLIC END} - -{BT GLE_EVT START} -0x0001 HCI_GLE_COMMAND_STATUS_EVT -0x0002 HCI_GLE_COMMAND_COMPLETE_EVT -0x0003 HCI_GLE_DATA_LENGTH_CHANGE_EVT -0x0004 HCI_GLE_ADVERTISING_TERMINATED -0x0005 HCI_GLE_DISCONNECTION_EVT -0x0007 HCI_GLE_REMOTE_CONNECTION_PARAMETER_REQUEST_EVT -0x0008 HCI_GLE_POWER_CHANGE_REPORT_EVT -0x0009 HCI_GLE_NUMBER_OF_COMPLETED_PACKETS_EVT -0x000a HCI_GLE_HARDWARE_ERROR_EVT -0x000b HCI_GLE_DATA_BUFFER_OVERFLOW_EVT -0x000c HCI_GLE_IMB_REQUEST_EVT -0x000d HCI_GLE_IMB_ESTABLISHED_EVT -0x000e HCI_GLE_ENCRYPTION_PARAMETER_REQUEST_EVT -0x0011 HCI_GLE_ENCRYPTION_CHANGE_EVT -0x0012 HCI_GLE_ACB_RETRY_EVT -0x0013 HCI_GLE_ACB_LOW_LATENCY_EN_EVT -0x1401 HCI_GLE_CONNECTION_EVT -0x1801 HCI_GLE_READ_REMOTE_FEATURES_EVT -0x1802 HCI_GLE_READ_REMOTE_VERSION_EVT -0x1805 HCI_GLE_READ_PHY_EVT -0x1806 HCI_GLE_PHY_UPDATE_EVT -0x1807 HCI_GLE_CONNECTION_UPDATE_EVT -0x180b HCI_GLE_ADVERTISING_REPORT_EVT -0x180f HCI_GLE_GET_REMOTE_POWER_VALUE_EVT -0x1811 HCI_GLE_SET_ACB_EVT_PARAM_EVT -0x18ff HCI_GLE_SET_ACB_LOW_LATENCY_EVT -{PUBLIC END} - -{BT BLE_SUB_EVT START} -0x0001 HCI_LE_CONNECTION_COMPLETE -0x0002 HCI_LE_ADVERTISING_REPORT -0x0003 HCI_LE_CONNECTION_UPDATE_COMPLETE -0x0004 HCI_LE_READ_REMOTE_FEATURES_COMPLETE -0x0005 HCI_LE_LONG_TERM_KEY_REQUEST -0x0006 HCI_LE_REMOTE_CONNECTION_PARAMETER_REQUEST -0x0007 HCI_LE_DATA_LENGTH_CHANGE -0x0008 HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE -0x0009 HCI_LE_GENERATE_DHKEY_COMPLETE -0x000a HCI_LE_ENHANCED_CONNECTION_COMPLETE -0x000b HCI_LE_DIRECTED_ADVERTISING_REPORT -0x000c HCI_LE_PHY_UPDATE_COMPLETE -0x000d HCI_LE_EXTENDED_ADVERTISING_REPORT -0x000e HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED -0x000f HCI_LE_PERIODIC_ADVERTISING_REPORT -0x0010 HCI_LE_PERIODIC_ADVERTISING_SYNC_LOST -0x0011 HCI_LE_EXTENDED_SCAN_TIMEOUT -0x0012 HCI_LE_ADVERTISING_SET_TERMINATED -0x0013 HCI_LE_SCAN_REQUEST_RECEIVED -0x0014 HCI_LE_CHANNEL_SELECTION_ALGORITHM -0x0020 HCI_LE_PATH_LOSS_THRESHOLD -0x0021 HCI_LE_TRANSMIT_POWER_REPORTING -0x005d HCI_LE_HADM_PROC_RESULT -0x005e HCI_LE_HADM_CONFIG -0x005f HCI_LE_HADM_CAPS -0x0070 HCI_LE_RD_REMOTE_PRIV_FEAT_COMPLETE -0x0071 HCI_LE_UHD_PHY_UPDATE_COMPLETE -{PUBLIC END} - -{BT BLE_LLCP START} -0x0000 LL_CONNECTION_UPDATE_IND -0x0001 LL_CHANNEL_MAP_IND -0x0002 LL_TERMINATE_IND -0x0003 LL_ENC_REQ -0x0004 LL_ENC_RSP -0x0005 LL_START_ENC_REQ -0x0006 LL_START_ENC_RSP -0x0007 LL_UNKNOWN_RSP -0x0008 LL_FEATURE_REQ -0x0009 LL_FEATURE_RSP -0x000a LL_PAUSE_ENC_REQ -0x000b LL_PAUSE_ENC_RSP -0x000c LL_VERSION_IND -0x000d LL_REJECT_IND -0x000e LL_PERIPHERAL_FEATURE_REQ -0x000f LL_CONNECTION_PARAM_REQ -0x0010 LL_CONNECTION_PARAM_RSP -0x0011 LL_REJECT_EXT_IND -0x0012 LL_PING_REQ -0x0013 LL_PING_RSP -0x0014 LL_LENGTH_REQ -0x0015 LL_LENGTH_RSP -0x0016 LL_PHY_REQ -0x0017 LL_PHY_RSP -0x0018 LL_PHY_UPDATE_IND -0x0019 LL_MIN_USED_CHANNELS_IND -0x0023 LL_POWER_CONTROL_REQ -0x0024 LL_POWER_CONTROL_RSP -0x0025 LL_POWER_CHANGE_IND -0x0028 LL_CHANNEL_REPORTING_IND -0x0029 LL_CHANNEL_STATUS_IND -0x0039 LLCP_HADM_V2_REQ -0x0040 LLCP_HADM_V2_RSP -0x0041 LLCP_HADM_IND -0x0042 LLCP_HADM_CAPS_IND -0x0043 LLCP_HADM_CONFIG_REQ -0x0044 LLCP_HADM_CONFIG_RES -0x0091 LL_PRIV_FEATURE_IND -0x0092 LL_PRIV_FEATURE_REQ -0x0093 LL_PRIV_FEATURE_RSP -0x0094 LL_UHD_REQ -0x0095 LL_UHD_RSP -0x0096 LL_UHD_UPDATE_IND -0x0097 LL_MAX -{PUBLIC END} - -{BT GLE_LLCP START} -0x0003 GLE_LL_REJECT_IND -0x0004 GLE_LL_ENC_REQ -0x0005 GLE_LL_ENC_RSP -0x0006 GLE_LL_START_ENC_REQ -0x0007 GLE_LL_START_ENC_RSP -0x0008 GLE_LL_PAUSE_ENC_REQ -0x0009 GLE_LL_PAUSE_ENC_RSP -0x000a GLE_LL_FEATURE_REQ -0x000b GLE_LL_FEATURE_RSP -0x000c GLE_LL_UNKNOWN_RSP -0x000d GLE_LL_VERSION_IND -0x000e GLE_LL_LENGTH_REQ -0x000f GLE_LL_LENGTH_RSP -0x0010 GLE_LL_CHANNEL_REPORTING_IND -0x0011 GLE_LL_CHANNEL_STATUS_IND -0x0012 GLE_LL_CHANNEL_FREQ_TABLE_IND -0x0013 GLE_LL_CHANNEL_MAP_IND -0x0014 GLE_LL_MIN_USED_CHANNELS_IND -0x0017 GLE_LL_PHY_UPDATE_REQ -0x0018 GLE_LL_PHY_UPDATE_IND -0x0019 GLE_LL_POWER_CONTROL_REQ -0x001a GLE_LL_POWER_CONTROL_RSP -0x001b GLE_LL_POWER_CHANGE_IND -0x001e GLE_LL_TERMINATE_IND -0x0020 GLE_LL_CONNECTION_PARAM_REQ -0x0021 GLE_LL_CONNECTION_PARAM_RSP -0x0022 GLE_LL_IMB_CONNECT_IND -0x003a GLE_LL_CONNECTION_UPDATE_IND -0x003d GLE_LL_IMB_TERMINATE_IND -0x004c GLE_LL_IOB_TERMINATE_IND -0x00f0 GLE_LL_SET_ACB_EVT_PARAM -0x00f1 GLE_LL_ACCEPT_ACB_EVT_PARAM -0x00f2 GLE_LL_SET_ACB_LOW_LATENCY -0x00f3 GLE_LL_ACCEPT_ACB_LOW_LATENCY -0xffff GLE_LL_INVALID -{PUBLIC END} - -{BT BLE_ACL_DATA START} -0x0000 MSG_SEND_BLE_ACL_DATA -0x0001 MSG_RECV_BLE_ACL_DATA -{PUBLIC END} - -{BT PRIVATE START} -0x0000 MSG_TASK_EVENT_INT -0x0001 MSG_TASK_END -0x0002 MSG_TASK_LSTO -0x0003 MSG_TASK_SET_TASK_PARAM -0x0004 MSG_TASK_SEND_LMP_DATA -0x0005 MSG_TASK_SEND_LLCP_DATA -0x0006 MSG_TASK_SEND_GLCP_DATA -0x0007 MSG_TASK_SEND_SYNC_DATA -0x0008 MSG_TASK_RECV_LMP_DATA -0x0009 MSG_TASK_RECV_GLCP_DATA -0x000a MSG_TASK_RECV_SYNC_DATA -0x000b MSG_HCI_RETRY_TX -0x000c MSG_DM_CO_AFH_CHNL_ASSESS_MODE_CHANGED -0x000d MSG_DM_BLE_HOST_SET_CHNL_INTERVAL_TO -0x000e MSG_DM_BLE_HOST_SET_CHNL_CHANGED -0x000f MSG_DM_BLE_ADDR_RESOLUTION_TO -0x0010 MSG_BLE_ADV_CONNECT_REQ_RECEIVED -0x0011 MSG_BLE_ADV_SCAN_REQ_RECEIVED -0x0012 MSG_BLE_ADV_EVT_ADV_END -0x0013 MSG_BLE_ADV_EVT_ADV_STOP -0x0014 MSG_BLE_ADV_SET_EXT_EN -0x0015 MSG_BLE_ADV_DISPATCH_ACK -0x0016 MSG_BLE_EXT_ADV_ENABLED -0x0017 MSG_BLE_PER_ADV_ENABLED -0x0018 MSG_BLE_PER_ADV_DISABLED -0x0019 MSG_BLE_PER_SYNC_FINISHED -0x001a MSG_BLE_PER_SYNC_TERMINATED -0x001b MSG_BLE_PER_SYNC_DATA_REPORT -0x001c MSG_BLE_PER_SYNC_INFO -0x001d MSG_BLE_ACL_TERMINATE_ACK -0x001e MSG_BLE_ACL_DISC_WITH_TERMINATE -0x001f MSG_BLE_ACL_DISC_WITHOUT_TERMINATE -0x0020 MSG_BLE_ACL_EVENT_SCHED_STOP -0x0021 MSG_BLE_ACL_CONN_UPDATE_REQ -0x0022 MSG_BLE_ACL_CONN_UPDATE_CMP -0x0023 MSG_BLE_ACL_SEND_CHNL_REPORT -0x0024 MSG_BLE_ACL_CHANNEL_MAP_ACK -0x0025 MSG_BLE_ACL_CHANNEL_MAP_ACK_TO -0x0026 MSG_BLE_ACL_REQ_MAP_UPDATE -0x0027 MSG_BLE_ACL_REQ_CHNL_STATUS_TIMER -0x0028 MSG_BLE_ACL_MAP_UPDATE_INSTANT_DIFF_ONE -0x0029 MSG_BLE_ACL_MAP_UPDATE_INSTANT_CMP -0x002a MSG_BLE_ACL_PHY_AUTO_UPD -0x002b MSG_BLE_ACL_PHY_UPD_INST_CMP -0x002c MSG_BLE_ACL_UHD_UPD_INST_CMP -0x002d MSG_BLE_ACL_TERMINATE_TO -0x002e MSG_BLE_ACL_PROC_RSP_TO -0x002f MSG_BLE_ACL_RD_REM_FEATS_TO -0x0030 MSG_BLE_ACL_RD_REM_VER_TO -0x0031 MSG_BLE_ACL_CONNECTION_TO -0x0032 MSG_BLE_ACL_CONN_UPDATE_TO -0x0033 MSG_BLE_ACL_PHY_UPD_TO -0x0034 MSG_BLE_ACL_UHD_UPD_TO -0x0035 MSG_BLE_ACL_PWR_CTRL_LLCP_TO -0x0036 MSG_BLE_ACL_PATH_LOSS_THRES_REP_TO -0x0037 MSG_BLE_ACL_PWR_CTRL_IND -0x0038 MSG_BLE_ACL_START_DATA_LENGTH_UPDATE -0x0039 MSG_BLE_ACL_DATA_LENGTH_SEND_REQ -0x003a MSG_BLE_ACL_DATA_LENGTH_RSP_TO -0x003b MSG_TASK_BLE_ACL_EVENT_ABNORMAL -0x003c MSG_GLE_ACB_ESTABLISH_TO -0x003d MSG_GLE_ACB_CONNECTION_TO -0x003e MSG_TASK_GLE_ACB_EVENT_ABNORMAL -0x003f MSG_GLE_ACB_TERMINATE_ACK -0x0040 MSG_GLE_ACB_DISC_WITH_TERMINATE -0x0041 MSG_GLE_ACB_DISC_WITHOUT_TERMINATE -0x0042 MSG_GLE_ACB_EVENT_SCHED_STOP -0x0043 MSG_GLE_ACB_TERMINATE_TO -0x0044 MSG_GLE_IOB_TERMINATE_TO -0x0045 MSG_GLE_IOB_ESTABLISH_TO -0x0046 MSG_GLE_IOB_CONNECTION_TO -0x0047 MSG_TASK_GLE_IOB_EVENT_ABNORMAL -0x0048 MSG_GLE_IOB_TERMINATE_ACK -0x0049 MSG_GLE_IOB_DISC_WITH_TERMINATE -0x004a MSG_GLE_IOB_DISC_WITHOUT_TERMINATE -0x004b MSG_GLE_IOB_EVENT_SCHED_STOP -0x004c MSG_ACTIVE_TIMER_SCHEDULER -0x004d MSG_KEY_DERIV_ENCRYPT_START -0x004e MSG_KEY_EXCHANGE_ENCRYPT_START -0x004f MSG_KEY_DERIV_ENCRYPT_DONE -0x0050 MSG_KEY_EXCHANGE_ENCRYPT_DONE -0x0051 MSG_SESSION_ENCRYPT_START -0x0052 MSG_SESSION_ENCRYPT_DONE -0x0053 MSG_BLE_SCAN_SCHED_STOP -0x0054 MSG_BLE_SCAN_EVT_TASK_REPORT_DATA -0x0055 MSG_BLE_SCAN_EVT_TASK_FSM_START -0x0056 MSG_BLE_EXTENDED_SCAN_DURATION_TO -0x0057 MSG_BLE_EXTENDED_SCAN_RESTART -0x0058 MSG_BLE_INITIATE_SCHED_STOP -0x0059 MSG_BLE_INITIATE_EVT_TASK_REPORT_DATA -0x005a MSG_BLE_INITIATE_EVT_TASK_FSM_START -0x005b MSG_BLE_TEST_MODE_END -0x005c MSG_BLE_ACL_RD_REM_PRIV_FEAT_TO -0x005d MSG_BLE_CS_RPT_RESULT -0x005e MSG_BLE_CS_EVT_END -0x005f MSG_CS_OPERATION_TO -0x0060 MSG_DPC_START -0x0061 MSG_DPC_SAMPLE_MSG -0x0062 MSG_DPC_ES_MSG -0x0063 MSG_DPC_ES_CANCEL_PROCESS_MSG -0x0064 MSG_DPC_END -0x0065 MSG_COEX_MAP_UPDATE -0x0066 MSG_GLE_SCAN_SCHED_STOP -0x0067 MSG_GLE_SCAN_EVT_TASK_REPORT_DATA -0x0068 MSG_GLE_SCAN_EVT_TASK_FSM_START -0x0069 MSG_GLE_SCAN_DURATION_TO -0x006a MSG_GLE_SCAN_RESTART -0x006b MSG_GLE_INITIATE_SCHED_STOP -0x006c MSG_GLE_INITIATE_EVT_TASK_REPORT_DATA -0x006d MSG_GLE_INITIATE_EVT_TASK_FSM_START -0x006e MSG_GLE_ADV_CONNECT_REQ_RECEIVED -0x006f MSG_GLE_ADV_SET_EN -0x0070 MSG_GLE_ADV_DISPATCH_ACK -0x0071 MSG_GLE_TEST_MODE_END -0x0072 MSG_SLEEP_DEFER -0x0073 MSG_BLE_START_ENC_RSP_ACK -0x0074 MSG_GLE_ADV_SCAN_REQ_RECEIVED -0x0075 MSG_GLE_ACB_CONN_UPDATE_REQ -0x0076 MSG_GLE_ACB_CONN_UPDATE_CMP -0x0077 MSG_GLE_ACB_CONN_UPDATE_TO -0x0078 MSG_GLE_ACB_PHY_UPDATE_AUTO_REQ -0x0079 MSG_GLE_ACB_PHY_UPDATE_CMP -0x007a MSG_GLE_ACB_PHY_UPDATE_TO -0x007b MSG_GLE_ACB_RD_REM_FEATS_TO -0x007c MSG_GLE_IMB_INSTANT -0x007d MSG_GLE_ACB_CHANNEL_MAP_ACK -0x007e MSG_GLE_ACB_CHANNEL_MAP_ACK_TO -0x007f MSG_GLE_ACB_REQ_MAP_UPDATE -0x0080 MSG_GLE_ACB_MAP_UPDATE_INSTANT_CMP -0x0081 MSG_DM_GLE_HOST_SET_CHNL_INTERVAL_TO -0x0082 MSG_DM_GLE_HOST_SET_CHNL_CHANGED -0x0083 MSG_GLE_ACB_RD_REM_VER_TO -0x0084 MSG_GLE_ACB_ENC_PROC_RSP_TO -0x0085 MSG_GLE_ACB_START_DATA_LENGTH_UPDATE -0x0086 MSG_GLE_ACB_DATA_LENGTH_RSP_TO -0x0087 MSG_GLE_IMB_WAIT_FIRST_PDU_TO -0x0088 MSG_TASK_GLE_IMB_EVENT_ABNORMAL -0x0089 MSG_GLE_IMB_DISC_WITH_TERMINATE -0x008a MSG_GLE_IMB_DISC_WITHOUT_TERMINATE -0x008b MSG_GLE_IMG_EVENT_SCHED_STOP -0x008c MSG_GLE_IMB_TERMINATE_TO -0x008d MSG_GLE_IMB_TERMINATE_ACK -0x008e MSG_GLE_IMG_ADD_ACTIVE_IMB -0x008f MSG_GLE_IMG_ADD_ACTIVE_IMB_FAIL -0x0090 MSG_GLE_IMG_DISC_ACTIVE_IMB -0x0091 MSG_GLE_ACB_CREATE_IMB -0x0092 MSG_GLE_ACB_DISCONNECT_IMB -0x0093 MSG_GLE_ACB_TERMINATE -0x0094 MSG_GLE_ACB_PWR_CTRL_IND -0x0095 MSG_GLE_ACB_PWR_CTRL_LLCP_TO -0x0096 MSG_GLE_ACB_START_EVT_PARAM_UPDATE -0x0097 MSG_GLE_ACB_ACCEPT_EVT_PARAM_TO -0x0098 MSG_ENCRYPT_EXECUTE_TASK_TRIGGER -0x0099 MSG_GLE_ACB_START_LOW_LATENCY_UPDATE -0x009a MSG_GLE_ACB_ACCEPT_LOW_LATENCY_TO -0x009b MSG_GLE_ACB_ACCEPT_LOW_LATENCY_ACK -0x009c MSG_GLE_ACB_WAIT_ACCEPT_LOW_LATENCY_ACK_TO -0x009d MSG_GLE_ADV_SCHED_STOP -0x009e MSG_DM_CLOCK_GT_MODE_TO -{PUBLIC END} - -{BT GLE_ACB_DATA START} -0x0000 MSG_SEND_GLE_ACB_DATA -0x0001 MSG_RECV_GLE_ACB_DATA -0x0002 MSG_SEND_GLE_ACB_EM_DATA -{PUBLIC END} - -{BT GLE_IOB_DATA START} -0x0000 MSG_SEND_GLE_IOB_DATA -0x0001 MSG_RECV_GLE_IOB_DATA -{PUBLIC END} - -{BT GLE_IMB_DATA START} -0x0000 MSG_SEND_GLE_IMB_DATA -0x0001 MSG_RECV_GLE_IMB_DATA -0x0002 MSG_SEND_GLE_IMB_EM_DATA -{PUBLIC END} - -================================================================================================================================================================= - -//BT fsm_send_msg -[MsgID=0x0100;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_CMD -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0101;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0102;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_EVT -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0103;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_EVT -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0104;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0106;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0107;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_ACL_DATA -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x010B;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT PRIVATE -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x010C;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_ACB_DATA -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x010D;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_IOB_DATA -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x010E;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_IMB_DATA -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0180;Parameter Number=4;%s;---->%s; send sed_id=%d; HCI_COMMAND_COMPLETE, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_CMD -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0181;Parameter Number=4;%s;---->%s; send sed_id=%d; HCI_COMMAND_STATUS, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_CMD -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0182;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_SUB_EVT -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0183;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0184;Parameter Number=4;%s;---->%s; send sed_id=%d; LL_UNKNOWN_RSP, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter4_CommandList End - -//BT fsm_send_msg -[MsgID=0x0185;Parameter Number=4;%s;---->%s; send sed_id=%d; LL_REJECT_EXT_IND, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0186;Parameter Number=4;%s;---->%s; send sed_id=%d; HCI_GLE_COMMAND_COMPLETE, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0187;Parameter Number=4;%s;---->%s; send sed_id=%d; HCI_GLE_COMMAND_STATUS, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0188;Parameter Number=4;%s;---->%s; send sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x0189;Parameter Number=4;%s;---->%s; send sed_id=%d; GLE_LL_UNKNOWN_RSP, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter4_CommandList End - -//GLE fsm_send_msg -[MsgID=0x018A;Parameter Number=4;%s;---->%s; send sed_id=%d; GLE_LL_REJECT_IND, %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter4_CommandList End - -//BT fsm_msg_forward -[MsgID=0x0200;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_CMD -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x0201;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter4_CommandList End - -//BT fsm_msg_forward -[MsgID=0x0202;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BT_EVT -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x0203;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_EVT -Parameter4_CommandList End - -//BT fsm_msg_forward -[MsgID=0x0204;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x0206;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter4_CommandList End - -//BT fsm_msg_forward -[MsgID=0x0207;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT BLE_ACL_DATA -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x020B;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT PRIVATE -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x020C;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_ACB_DATA -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x020D;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_IOB_DATA -Parameter4_CommandList End - -//GLE fsm_msg_forward -[MsgID=0x020E;Parameter Number=4;%s;---->%s; forward sed_id=%d; %s] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -$$BT GLE_IMB_DATA -Parameter4_CommandList End - -//BT fsm_msg_save_to_head_ext -[MsgID=0x0300;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BT_CMD -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x0301;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_head_ext -[MsgID=0x0302;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BT_EVT -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x0303;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_EVT -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_head_ext -[MsgID=0x0304;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x0306;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_head_ext -[MsgID=0x0307;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BLE_ACL_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_head_ext -[MsgID=0x030B;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT PRIVATE -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x030C;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_ACB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x030D;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_IOB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_head_ext -[MsgID=0x030E;Parameter Number=4;%s; sed_id=%d; SAVED HEAD %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_IMB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_tail_ext -[MsgID=0x0400;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BT_CMD -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x0401;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_CMD -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_tail_ext -[MsgID=0x0402;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BT_EVT -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x0403;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_EVT -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_tail_ext -[MsgID=0x0404;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BLE_LLCP -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x0406;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_LLCP -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_tail_ext -[MsgID=0x0407;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT BLE_ACL_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_save_to_tail_ext -[MsgID=0x040B;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT PRIVATE -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x040C;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_ACB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x040D;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_IOB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//GLE fsm_msg_save_to_tail_ext -[MsgID=0x040E;Parameter Number=4;%s; sed_id=%d; SAVED TAIL %s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT GLE_IMB_DATA -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_restore_to_head_ext -[MsgID=0x0801;Parameter Number=4;%s; sed_id=%d; RESTORE HEAD file=%s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT CFILE -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_msg_restore_to_tail_ext -[MsgID=0x0802;Parameter Number=4;%s; sed_id=%d; RESTORE TAIL file=%s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT CFILE -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End - -//BT fsm_trans_state_ext -[MsgID=0x0810;Parameter Number=4;%s; sed_id=%d; TRANS_STATE=%s; linenum=%d] -Parameter1_CommandList Start: -Index Show -$$BT FSM_TYPE -Parameter1_CommandList End -Parameter2_CommandList Start: -Index Show -Parameter2_CommandList End -Parameter3_CommandList Start: -Index Show -$$BT FSM_STATE -Parameter3_CommandList End -Parameter4_CommandList Start: -Index Show -Parameter4_CommandList End diff --git a/build/config/target_config/ws63/hdb_config/database_cfg/ext_dfx_include.cfg b/build/config/target_config/ws63/hdb_config/database_cfg/ext_dfx_include.cfg deleted file mode 100755 index e69de29..0000000 diff --git a/build/config/target_config/ws63/hdb_config/database_cfg/mk_hdb_xml.json b/build/config/target_config/ws63/hdb_config/database_cfg/mk_hdb_xml.json deleted file mode 100755 index 0240e50..0000000 --- a/build/config/target_config/ws63/hdb_config/database_cfg/mk_hdb_xml.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "OUT_DIR" : "output/ws63", - "BUILD_TEMP_PATH" : "output/ws63/build_hso_cfg", - - "DATABASE_VERSION":"", - "DATABASE_VERSION_CORE":"acore", - "DATABASE_BASE" : "build/config/target_config/ws63/hdb_config/database_template", - "DATABASE_DEFAULT_CFG_PATH" : "", - "DATABASE_EXTERN_CFG_PATH" : "", - "DATABASE_MSS_PRIM_PATH" : "output/ws63/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml", - "DATABASE_DIAG_DIR_PATH" : "output/ws63/build_hso_cfg/hdb/struct", - "DATABASE_TXT_FILE" : "output/ws63/build_hso_cfg/database.etypes", - - "LOG_FILE_NAME":"output/ws63/build_hso_cfg/hso_database/xml/log", - - "HDB_XML_TEMP_ROOT_DIR":"output/ws63/build_hso_cfg/hso_database/xml", - "HDB_XML_TEMP_BASE_DIR":"output/ws63/build_hso_cfg/hso_database/xml/base", - - "HDB_PRIM_XML_DST_FILE" : "output/ws63/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml", - "HDB_PRIM_XML_SRC_FILE" : "build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_prim_db.xml", - "HDB_CMD_XML_DST_FILE" : "output/ws63/build_hso_cfg/hdb/hdbcfg/mss_cmd_db.xml", - "HDB_CMD_XML_SRC_FILE" : "build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml", - "HDB_PRIM_XML_FILE_ID_BIT" : "14", - "HDB_PRIM_XML_LINE_ID_BIT" : "14", - "HDB_PRIM_XML_PRINT_LEVEL_BIT" : "4", - - "HDB_TXT_TEMP_DIR":"output/ws63/build_hso_cfg/hso_database/txt", - "HDB_TXT_BASE_DATATYPE":"build/config/target_config/ws63/hdb_config/base_datatype_def.txt", - "HDB_TXT_DST_DIR":"output/ws63/build_hso_cfg/hdb/struct", - "HDB_TXT_SRC_DIR":"build/config/target_config/ws63/hdb_config/database_template/acore/system/diag", - - "HDB_XML_PRE_GENERATED_CORE":["closed_comp"], - "HDB_XML_PRE_GENERATED_DIR":["interim_binary/ws63/acore/build_hso_cfg"], - - "BT_STATUS_DIR":"build/config/target_config/ws63/hdb_config/database_cfg", - "OTA_MSG_DIR":"build/config/target_config/ws63/hdb_config/database_cfg" - -} diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/apps_core_hso_msg_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/apps_core_hso_msg_struct_def.txt deleted file mode 100755 index b24f229..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/apps_core_hso_msg_struct_def.txt +++ /dev/null @@ -1,629 +0,0 @@ -#include "base_datatype_def.txt" -typedef struct { - td_char name[32]; - td_u32 id; - td_u16 status; - td_u16 priority; - td_pvoid task_sem; - td_pvoid task_mutex; - td_u32 event_stru[3]; - td_u32 event_mask; - td_u32 stack_size; - td_u32 top_of_stack; - td_u32 bottom_of_stack; - td_u32 sp; - td_u32 curr_used; - td_u32 peak_used; - td_u32 overflow_flag; -} ext_task_info; -typedef struct { - td_u16 task_prio; - td_u32 stack_size; - td_u32 task_policy; - td_u32 task_nice; - td_u32 task_cpuid; - td_char *task_name; - td_void *resved; -} ext_task_attr; -ext_errno uapi_task_create(td_u32 *taskid, const ext_task_attr *attr, - td_void *(*task_route)(td_void *), td_void *arg); -ext_errno uapi_task_delete(td_u32 taskid); -ext_errno uapi_task_suspend(td_u32 taskid); -ext_errno uapi_task_resume(td_u32 taskid); -ext_errno uapi_task_get_priority(td_u32 taskid, td_u32 *priority); -ext_errno uapi_task_set_priority(td_u32 taskid, td_u32 priority); -td_u32 uapi_task_get_current_id(td_void); -td_void uapi_task_lock(td_void); -td_void uapi_task_unlock(td_void); -td_bool uapi_task_is_lock(td_void); -ext_errno uapi_sleep(td_u32 ms); -typedef struct { - td_u32 total; - td_u32 used; - td_u32 free; - td_u32 free_node_num; - td_u32 used_node_num; - td_u32 max_free_node_size; - td_u32 malloc_fail_count; - td_u32 peek_size; -} ext_mdm_mem_info; -typedef struct { - td_u32 pool_addr; - td_u32 pool_size; - td_u32 fail_count; - td_u32 cur_use_size; - td_u32 peek_size; -} ext_mem_pool_crash_info; -td_pvoid uapi_malloc(td_u32 size); -td_void uapi_free(const td_pvoid addr); -TD_CONST ext_mem_pool_crash_info *uapi_mem_get_sys_info_crash(td_void); -ext_errno uapi_pool_mem_init(td_void *pool, td_u32 size); -td_void *uapi_pool_mem_alloc(td_void *pool, td_ulong size); -td_void uapi_pool_mem_free(td_void *pool, TD_CONST td_void *addr); -ext_errno uapi_pool_mem_deinit(td_void *pool); -typedef enum { - EXCEPTION_PHASE_INITIALIZATION, - EXCEPTION_PHASE_TASK, - EXCEPTION_PHASE_INTERRUPT, - EXCEPTION_PHASE_MAX_TYPE -} ext_exception_phase_type; -typedef struct { - td_u32 mepc; - td_u32 ra; - td_u32 sp; -} ext_exception_cpu_basic_info; -typedef struct { - td_u32 mcause; - td_u32 mstatus; - td_u32 ccause; - td_u32 mtval; - td_u32 gp; - td_u32 tp; - td_u32 t0; - td_u32 t1; - td_u32 t2; - td_u32 s0; - td_u32 s1; - td_u32 a0; - td_u32 a1; - td_u32 a2; - td_u32 a3; - td_u32 a4; - td_u32 a5; - td_u32 a6; - td_u32 a7; - td_u32 s2; - td_u32 s3; - td_u32 s4; - td_u32 s5; - td_u32 s6; - td_u32 s7; - td_u32 s8; - td_u32 s9; - td_u32 s10; - td_u32 s11; - td_u32 t3; - td_u32 t4; - td_u32 t5; - td_u32 t6; -} ext_exception_cpu_extend_info; -typedef struct { - td_u32 event_type; - td_u32 task; - td_u64 time; - td_uintptr_t identity; - td_uintptr_t params[2]; -} ext_exception_track_info; -typedef struct { - ext_exception_cpu_basic_info basic_info; - ext_exception_cpu_extend_info extend_info; -} ext_exception_cpu_register; -typedef struct { - td_u16 is_irq; - td_u16 type; - td_u32 faultaddr; - td_u32 thrdpid; - td_u32 stack_top; - td_u32 stack_bottom; -} ext_exception_schedule_info; -typedef struct { - ext_exception_cpu_register exc_cpu_context; - ext_exception_schedule_info schedule_info; -} ext_exception_context; -typedef enum { - CORES_APPLICATION_CORE = 0, - CORES_PROTOCOL_CORE, - CORES_SECURITY_CORE, - CORES_DSP_CORE, - CORES_CGRA_CORE, - CORES_IOMCU_CORE, - CORES_MAX_NUMBER_PHYSICAL, - CORES_UNKNOWN, -} cores; -typedef enum { - EXT_SYSERR_NO_USED = 0, - EXT_SYSERR_WATCH_DOG = 1, - EXT_SYSERR_OLD_PANIC, - EXT_SYSERR_LOS_PANIC, - EXT_SYSERR_CPU_EXEC, - EXT_SYSERR_OS_ERR, - EXT_SYSERR_MAX_MAIN_TYPE -} ext_syserr_main_type; -typedef enum { - SYSERR_QUERY_SPECIFY_BLOCK_ID0, - SYSERR_QUERY_SPECIFY_BLOCK_ID1, - SYSERR_QUERY_SPECIFY_BLOCK_ID2, - SYSERR_QUERY_SPECIFY_BLOCK_ID3, - SYSERR_QUERY_SPECIFY_BLOCK_ID4, - SYSERR_QUERY_SPECIFY_BLOCK_ID5, - SYSERR_QUERY_SPECIFY_BLOCK_ID6, - SYSERR_QUERY_SPECIFY_BLOCK_ID7, - SYSERR_QUERY_SPECIFY_BLOCK_MAX_TYPE, - SYSERR_LASTEST_STORED_BLOCK, - SYSERR_NEW_STORE_BLOCK, - SYSERR_BLOCK_MAX_TYPE, -} syserr_info_type; -typedef struct { - td_u8 core[1]; -} dbk_str_type; -typedef struct { - td_u32 head_magic; - td_bool save_ind; - td_u8 core; - td_u16 structure_ver; - td_u32 size; -} ext_syserr_head_info; -typedef struct { - td_u16 main_type; - td_u16 pad; - td_u32 sub_type; - ext_exception_cpu_basic_info cpu_context; -} ext_syserr_basic_context_info; -typedef struct { - td_u8 is_isr; - td_u8 pad[3]; - td_u32 id; - td_u32 top; - td_u32 bottom; - td_u32 revised_top; - td_u32 revised_bottom; - td_u32 revised_sp; -} ext_syserr_base_stack_info; -typedef struct { - ext_syserr_basic_context_info basic_context[2]; - ext_syserr_base_stack_info basic_stack[2]; - td_u32 trace[40]; -} ext_syserr_lite_info; -typedef struct { - td_u32 crash_sec; - td_u32 soft_version; - td_u8 loop; - td_u8 last_trap_level; - td_u16 process_map; - td_u32 data[5]; -} ext_syserr_crash_scene; -typedef struct { - ext_exception_cpu_extend_info cpu_register; -} ext_syserr_cpu_extend_register; -typedef struct { - ext_mem_pool_crash_info mem; -} ext_syserr_mem_info; -typedef struct { - td_u32 peek; - td_u32 top_content; - td_u32 stack[0x10]; - td_char name[32]; -} ext_syserr_extend_stack_info; -typedef struct { - td_u32 end_magic; -} ext_syserr_tail; -typedef struct { - ext_syserr_head_info head; - ext_syserr_crash_scene scene; - ext_syserr_lite_info lite_info; - ext_syserr_cpu_extend_register cpu; - ext_syserr_mem_info mem; - ext_syserr_extend_stack_info stack; - ext_syserr_tail tail; -} ext_syserr_info; -typedef td_void (*uapi_syserr_hook)(td_u32 main_type, td_u32 sub_type); -td_void uapi_syserr_set_unreboot(td_void); -td_void uapi_syserr_register_hook(uapi_syserr_hook hook); -td_void uapi_syserr_panic(td_u32 reason, td_u32 data0, td_u32 data1, td_u32 data2, td_u32 data3); -td_u32 uapi_syserr_query_crash_info(cores src_core, syserr_info_type type, ext_syserr_info *dest_addr); -typedef unsigned char td_uchar; -typedef unsigned char td_u8; -typedef unsigned short td_u16; -typedef unsigned int td_u32; -typedef unsigned long long td_u64; -typedef unsigned long td_ulong; -typedef char td_char; -typedef signed char td_s8; -typedef short td_s16; -typedef int td_s32; -typedef long long td_s64; -typedef long td_slong; -typedef float td_float; -typedef double td_double; -typedef void td_void; -typedef td_u8 td_bool; -typedef td_u32 td_handle; -typedef td_u8 td_byte; -typedef td_byte* td_pbyte; -typedef void* td_pvoid; -typedef volatile td_u32 td_u32_reg; -typedef unsigned long td_size_t; -typedef signed long td_ssize_t; -typedef unsigned long td_length_t; -typedef unsigned long long td_mem_size_t; -typedef long long td_mem_handle_t; -typedef unsigned int td_fr32; -typedef unsigned int uintptr_t; -typedef uintptr_t td_uintptr_t; -typedef unsigned int td_phys_addr_t; -typedef unsigned int td_virt_addr_t; -typedef unsigned int td_phys_addr_bit32; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_req_st; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_ind_st; -typedef struct { - td_u32 put_msg_2_cache_fail_times; - td_u32 send_ipc_times; - td_u32 send_used_size; - td_u32 log_receive_times; - td_u32 log_reported_times; - td_u32 send_local_q_fail; - td_u32 record_idx; - td_u32 channel_receive_data_cnt[4]; - td_u32 mem_pkt_alloc_size[2]; - td_u32 mem_pkt_free_size[2]; -} zdiag_dfx_stat; -typedef struct { - td_u32 dir; - td_u32 random_data; -} diag_beat_heart_cmd_ind; -typedef enum { - EXT_UART_IDX_0, - EXT_UART_IDX_1, - EXT_UART_IDX_2, - EXT_UART_IDX_3, - EXT_UART_IDX_LP, - EXT_UART_IDX_MAX, - EXT_UART_IDX_INVALID_ID = 0xFF, -} ext_uart_idx; -typedef enum { - EXT_SPI_ID_0, - EXT_SPI_ID_MAX, -} ext_spi_idx; -typedef enum { - EXT_DMA_PERIPHERAL_MEMORY = 0, - EXT_DMA_PERIPHERAL_UART0_TX = 1, - EXT_DMA_PERIPHERAL_UART0_RX = 2, - EXT_DMA_PERIPHERAL_SSP_TX = 3, - EXT_DMA_PERIPHERAL_SSP_RX = 4, - EXT_DMA_PERIPHERAL_MAX_NUM, -} ext_dma_peripheral; -typedef enum { - EXT_DMA_CHANNEL_NONE = 0xFF, - EXT_DMA_CHANNEL_0 = 0, - EXT_DMA_CHANNEL_1, - EXT_DMA_CHANNEL_2, - EXT_DMA_CHANNEL_3, - EXT_DMA_CHANNEL_MAX_NUM, -} ext_dma_channel; -typedef enum { - EXT_DMA_CH_PRIORITY_HIGHEST = 0, - EXT_DMA_CH_PRIORITY_HIGH_1 = 1, - EXT_DMA_CH_PRIORITY_HIGH_2 = 2, - EXT_DMA_CH_PRIORITY_LOWEST = 3, - EXT_DMA_CH_PRIORITY_MAX -} ext_dma_ch_priority; -typedef enum { - EXT_LP_PWM_PORT_PWM0, - EXT_LP_PWM_PORT_PWM1, - EXT_LP_PWM_PORT_PWM2, - EXT_PWM_PORT_PWM0, - EXT_PWM_PORT_PWM1, - EXT_PWM_PORT_PWM2, - EXT_PWM_PORT_PWM3, - EXT_PWM_PORT_MAX -} ext_pwm_idx; -typedef enum { - EXT_PWM_GROUP_ID_0 = 0, - EXT_PWM_GROUP_ID_1, - EXT_PWM_GROUP_ID_2, - EXT_PWM_GROUP_ID_3, - EXT_PWM_GROUP_ID_4, - EXT_PWM_GROUP_ID_MAX, -} ext_pwm_group_idx; -typedef enum { - EXT_PWM_PORT_ID_0 = 0, - EXT_PWM_PORT_ID_1, - EXT_PWM_PORT_ID_2, - EXT_PWM_PORT_ID_3, - EXT_PWM_PORT_ID_4, - EXT_PWM_PORT_ID_MAX, -} ext_pwm_port_idx; -typedef enum { - EXT_HWTIMER_ID_0, - EXT_HWTIMER_ID_1, - EXT_HWTIMER_ID_2, - EXT_HWTIMER_ID_3, - EXT_HWTIMER_ID_4, - EXT_HWTIMER_ID_5, - EXT_HWTIMER_ID_6, - EXT_HWTIMER_ID_7, - EXT_HWTIMER_ID_MAX, -} ext_hwtimer_id; -typedef enum { - EXT_CLK_IPC = 0, - EXT_CLK_UART0, - EXT_CLK_UART1, - EXT_CLK_UART2, - EXT_CLK_UART3, - EXT_CLK_LP_UART, - EXT_CLK_I2C0, - EXT_CLK_I2C1, - EXT_CLK_I2C2, - EXT_CLK_I2C3, - EXT_CLK_I2C4, - EXT_CLK_SPI0, - EXT_CLK_PWM0, - EXT_CLK_PWM1, - EXT_CLK_AO_PWM, - EXT_CLK_TIMER0, - EXT_CLK_TIMER1, - EXT_CLK_TIMER2, - EXT_CLK_TIMER3, - EXT_CLK_TIMER4, - EXT_CLK_TIMER5, - EXT_CLK_TIMER6, - EXT_CLK_TIMER7, - EXT_CLK_WDT, - EXT_CLK_GPIO, - EXT_CLK_DMA, - EXT_CLK_CPU, - EXT_CLK_TSENSOR, - EXT_CLK_LSADC, - EXT_CLK_ID_MAX, - EXT_CLK_ID_INVALID_ID = 0xFFFFFFFF, -} ext_clk_id; -typedef struct { - td_u32 reg_base_addr; - td_u32 irq_number; - td_u32 channel_max_num; - td_u32 peripheral_max_num; - td_u32 lowest_priority; -} ext_dma_device; -td_void dma_resource_init(td_void); -td_void uart_resource_init(td_void); -td_void ipc_resource_init(td_void); -td_void hrtimer_resource_init(td_void); -td_void hwtimer_resource_init(td_void); -td_void rtc_resource_init(td_void); -td_void rtc_calendar_resource_init(td_void); -td_void i2c_resource_init(td_void); -td_void clk_resource_init(td_void); -td_void io_resource_init(td_void); -td_void pwm_resource_init(td_void); -td_void spi_resource_init(td_void); -td_void watchdog_resource_init(td_void); -td_void tsensor_resource_init(td_void); -td_void share_os_res_resource_init(td_void); -td_void dntc_resource_init(td_void); -typedef enum { - EXT_DMA_POWER_OF_BURST_0 = 0, - EXT_DMA_POWER_OF_BURST_1 = 1, - EXT_DMA_POWER_OF_BURST_2 = 2, - EXT_DMA_POWER_OF_BURST_3 = 3, - EXT_DMA_POWER_OF_BURST_4 = 4, - EXT_DMA_POWER_OF_BURST_5 = 5, - EXT_DMA_POWER_OF_BURST_6 = 6, - EXT_DMA_POWER_OF_BURST_7 = 7, - EXT_DMA_POWER_OF_BURST_8 = 8, - EXT_DMA_POWER_OF_BURST_9 = 9, - EXT_DMA_POWER_OF_BURST_10 = 10, -} ext_dma_power_of_burst; -typedef struct { - ext_dma_power_of_burst power_of_burst; - td_bool use_burst; - td_u8 pad[3]; -} ext_dma_peripheral_feature; -typedef td_void (*ext_dma_transfer_peripheral_prepare_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef td_void (*ext_dma_transfer_peripheral_finish_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef struct { - ext_dma_peripheral src_periph; - ext_dma_peripheral dst_periph; - ext_dma_peripheral_feature feature; - ext_dma_transfer_peripheral_prepare_callback transfer_prepare; - ext_dma_transfer_peripheral_finish_callback transfer_finish; -} ext_dma_peripheral_config; -typedef enum { - EXT_DMA_DATA_WIDTH_BYTE = 0x0, - EXT_DMA_DATA_WIDTH_HALFWORD = 0x1, - EXT_DMA_DATA_WIDTH_WORD = 0x2, - EXT_DMA_DATA_WIDTH_MAX = 0x3, -} ext_dma_data_width; -typedef enum { - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_MEM = 0, - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_PERIPHERAL = 1, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_MEM = 2, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL = 3, - EXT_DMA_CH_TRANSFER_TYPE_MAX -} ext_dma_ch_transfer_type; -typedef enum { - EXT_DMA_CH_CYCLE_TYPE_SINGLE = 0, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_PART = 1, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_END = 2, - EXT_DMA_CH_CYCLE_TYPE_MAX -} ext_dma_ch_cycle_type; -typedef enum { - EXT_DMA_INTERRUPT_DONE, - EXT_DMA_INTERRUPT_ERR, - EXT_DMA_INTERRUPT_MAX -} ext_dma_interrupt; -typedef td_void (*ext_dma_transfer_callback)(ext_dma_interrupt intr); -typedef struct { - td_u32 src_addr; - td_u32 dst_addr; - td_u16 transfer_num; - ext_dma_data_width data_width; - ext_dma_ch_cycle_type cycle_type; -} ext_dma_ch_user_config; -ext_errno uapi_dma_init(td_void); -td_void uapi_dma_deinit(td_void); -ext_errno uapi_dma_open_ch(ext_dma_channel *ch, ext_dma_ch_priority pri, - const ext_dma_peripheral_config *config); -ext_errno uapi_dma_close_ch(ext_dma_channel ch); -ext_errno uapi_dma_transfer(ext_dma_channel ch, const ext_dma_ch_user_config *user_cfg, - ext_dma_transfer_callback callback, td_bool block); -typedef enum { - EXT_UART_DATA_BIT_5 = 5, - EXT_UART_DATA_BIT_6, - EXT_UART_DATA_BIT_7, - EXT_UART_DATA_BIT_8, -} ext_uart_data_bit; -typedef enum { - EXT_UART_PARITY_NONE, - EXT_UART_PARITY_ODD, - EXT_UART_PARITY_EVEN, -} ext_uart_parity; -typedef enum { - EXT_UART_STOP_BIT_1 = 1, - EXT_UART_STOP_BIT_2, -} ext_uart_stop_bit; -typedef enum { - EXT_UART_FLOW_CTRL_NONE = 0x0, - EXT_UART_FLOW_CTS = 0x1, - EXT_UART_FLOW_RTS = 0x2, - EXT_UART_FLOW_CTRL_RTS_CTS = EXT_UART_FLOW_CTS | EXT_UART_FLOW_RTS, - EXT_UART_FLOW_CTRL_SOFT = 0x4, -} ext_uart_flow_ctrl; -typedef enum { - EXT_UART_ERR_FRAM = 0x1, - EXT_UART_ERR_PARITY = 0x2, - EXT_UART_ERR_BREAK = 0x4, - EXT_UART_ERR_OVER_RUN = 0x8, -} ext_uart_err_type; -typedef struct { - td_u32 baud_rate; - td_u8 data_bits; - td_u8 stop_bits; - td_u8 parity; - td_u8 pad; -} ext_uart_attr; -typedef struct { - td_bool tx_use_dma; - td_u8 tx_dma_ch_priority; - td_u16 rx_buf_size; - td_u16 tx_buf_size; -} ext_uart_extra_attr; -typedef struct { - ext_dma_ch_cycle_type cycle_type; - ext_dma_transfer_callback done_callback; -} ext_uart_write_dma_config; -typedef enum { - EXT_UART_NOTIFY_RX_MASK_IDLE = 0x1, - EXT_UART_NOTIFY_RX_SUFFICIENT_DATA = 0x2, - EXT_UART_NOTIFY_RX_ERR = 0x4, - EXT_UART_NOTIFY_RX_DATA = 0x8, - EXT_UART_NOTIFY_TX_FINISH = 0x10, - EXT_UART_NOTIFY_ALL_MASK = 0x1F, -} ext_uart_rx_hook_type; -typedef td_void(*ext_uart_rx_hook)(ext_uart_rx_hook_type type, td_u16 data); -ext_errno uapi_uart_init(ext_uart_idx id, TD_CONST ext_uart_attr *attr, TD_CONST ext_uart_extra_attr *advance_attr); -ext_errno uapi_uart_set_attr(ext_uart_idx id, ext_uart_attr *attr); -ext_errno uapi_uart_get_attr(ext_uart_idx id, ext_uart_attr *attr); -td_s32 uapi_uart_read(ext_uart_idx id, td_u8 *data, td_u32 len); -td_s32 uapi_uart_write(ext_uart_idx id, TD_CONST td_u8 *data, td_u32 len); -ext_errno uapi_uart_deinit(ext_uart_idx id); -ext_errno uapi_uart_register_rx_callback(ext_uart_idx id, - td_u32 hook_mask, - td_u16 sufficient_cnt, - ext_uart_rx_hook hook); -td_bool uapi_uart_has_pending_transmissions(ext_uart_idx id); -ext_errno uapi_uart_flush_rx_data(ext_uart_idx id); -td_s32 uapi_uart_write_by_dma(ext_uart_idx id, TD_CONST td_u8 *data, td_u16 len, ext_uart_write_dma_config *dma_cfg); -ext_errno uapi_uart_set_flow_ctrl(ext_uart_idx id, ext_uart_flow_ctrl type); -ext_errno uapi_uart_set_software_flow_ctrl_level(ext_uart_idx id, td_u16 lower_water_margin, td_u16 upper_water_margin); -ext_errno uapi_uart_set_tx_timeout(ext_uart_idx id, td_u32 block_ms); -ext_errno uapi_uart_set_rx_timeout(ext_uart_idx id, td_u32 block_ms); -td_s32 uapi_uart_get_rx_data_count(ext_uart_idx id); -typedef struct { - td_u32 offset; - td_u32 size; -} ext_diag_dump_item; -typedef struct { - td_u32 len; - td_char name[128]; - td_u32 cnt; - ext_diag_dump_item item[0]; -} ext_diag_dump_by_name_cmd; -typedef struct { - td_u32 ret; - td_u32 offset; - td_u32 size; - td_u8 data[0]; -} ext_diag_dump_by_name_ind; -typedef enum { - TRANSMIT_STATE_NOTIFY_INVALID_ID = 10, - TRANSMIT_STATE_NOTIFY_FINISH, - TRANSMIT_STATE_NOTIFY_FINISH_2, - TRANSMIT_STATE_NOTIFY_DUPLICATE_ID, -} transmit_state_notify_code; -typedef enum { - TRANSMIT_TYPE_READ_FILE, - TRANSMIT_TYPE_DUMP, - TRANSMIT_TYPE_SAVE_FILE, -} transmit_type; -typedef struct { - td_u32 offset; - td_u32 size; -} transmit_data_request_item; -typedef struct { - td_u32 transmit_id; - td_u32 cnt; - transmit_data_request_item item[0]; -} transmit_data_request_pkt; -typedef struct { - td_u32 transmit_id; - td_u32 ret; - td_u32 offset; - td_u32 size; - td_u32 crc; - td_u8 data[0]; -} transmit_data_reply_pkt; -typedef struct { - td_u32 transmit_id; - td_u32 state_code; - td_u32 len; - td_u8 data[0]; -} transmit_state_notify_pkt; -typedef struct { - td_u16 name_size; - td_u16 pad; - td_char file_name[0]; -} transmit_save_file_start_info; -typedef struct { - td_u32 transmit_id; - td_u16 pad; - td_u16 transmit_type; - td_u32 total_size; - td_u32 info_size; - td_u8 info[0]; -} transmit_start_pkt; -typedef struct { - td_u32 dir_len; - td_char name[128]; -} ext_diag_ls_cmd; -typedef struct { - td_u16 idx; - td_u16 path_len; - td_u32 file_size; - td_char name[128]; -} ext_diag_ls_ind; diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/base_datatype_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/base_datatype_def.txt deleted file mode 100755 index bf0c60e..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/base_datatype_def.txt +++ /dev/null @@ -1,41 +0,0 @@ -UINT32 32 0 -UINT16 16 0 -UINT8 8 0 - -INT32 32 1 -INT16 16 1 -INT8 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 -char 8 1 1 - -long 32 1 -td_pvoid 32 0 -td_pbyte 32 0 - -uint8_t 8 0 -uint16_t 16 0 -uint32_t 32 0 \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/fix_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/fix_struct_def.txt deleted file mode 100755 index 64af24e..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/fix_struct_def.txt +++ /dev/null @@ -1,250 +0,0 @@ -#include "base_datatype_def.txt" - -typedef struct { - -} tool_null_stru; - -typedef struct { - td_u8 array[0]; -}tool_u8_array; - -typedef struct { - td_u32 array[0]; -}tool_u32_array; - -typedef struct { - td_u32 data; -}tool_u32; - -typedef struct { - char str[1]; -} tool_str; - -typedef struct { - td_u16 key; -} nv_key_info_t; - -typedef struct { - td_u16 key; - td_u16 length; - td_u8 value[300]; -} nv_key_write_info_t; - -typedef struct { - td_u16 key; - td_u16 length; - td_u8 value[300]; - td_bool permanent; - td_bool encrypted; - td_bool non_upgrade; -} nv_key_write_with_attr_info_t; - -typedef struct { - td_u32 package_len; -} upg_prepare_info_t; - -typedef struct { - td_u32 id; - td_char name[32]; - td_u32 usage; -} dfx_cpup_item; - -typedef struct { - td_u32 param; -} dfx_diag_cpup_cmd; - -typedef struct { - td_u32 total; - td_u32 used; - td_u32 free; - td_u32 free_node_num; - td_u32 used_node_num; - td_u32 max_free_node_size; - td_u32 peek_size; -} ext_mdm_mem_info; - -typedef struct { - td_u8 timer_usage; - td_u8 task_usage; - td_u8 sem_usage; - td_u8 queue_usage; - td_u8 mux_usage; -} osal_os_resource_use_stat; - -typedef struct { - td_char name[32]; - td_u32 valid; - td_u32 id; - td_u16 status; - td_u16 priority; - td_pvoid task_sem; - td_pvoid task_mutex; - td_u32 event_stru[3]; - td_u32 event_mask; - td_u32 stack_size; - td_u32 top_of_stack; - td_u32 bottom_of_stack; - td_u32 sp; - td_u32 curr_used; - td_u32 peak_used; - td_u32 overflow_flag; -} ext_task_info; - -typedef struct { - td_u32 id; -} ext_dbg_stat_q; - -typedef struct { - td_bool enable; - td_u8 channel; - td_u8 band; - td_u32 cycle; - td_u16 duration; -} psd_enable_stru; - -typedef struct { - td_s8 psd_result[1024]; -} psd_report_stru; - -typedef struct { - td_u32 addr; - td_u32 len; -} read_mem; - -typedef struct { - td_u32 start_addr; - td_u32 end_addr; -} cycle_read_mem; - -typedef struct { - td_u32 len; - td_u32 data[80]; -} read_mem_ind; - -typedef struct { - td_u32 start_addr; - td_u32 cnt; -} mem_read_cmd_t; - -typedef struct { - td_u32 start_addr; - td_u32 size; -}mem_read_ind_head_t; - -typedef struct { - mem_read_ind_head_t head; - td_u32 data[80]; -}mem_read32_ind_t; - -typedef struct { - mem_read_ind_head_t head; - td_u16 data[80]; -}mem_read16_ind_t; - -typedef struct { - mem_read_ind_head_t head; - td_u8 data[80]; -}mem_read8_ind_t; - -typedef struct { - td_u32 start_addr; - td_u32 val; -} mem_write_cmd_t; - -typedef struct { - td_u32 ret; -} mem_write_ind_t; - -typedef struct { - td_u32 baud_rate; - td_u8 data_bits; - td_u8 stop_bits; - td_u8 parity; - td_u8 pad; -} uart_attr_t; - -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_req_st; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_ind_st; -typedef struct { - td_u32 put_msg_2_cache_fail_times; - td_u16 dfx_msg_q_num; - td_u16 dfx_msg_q_peak_num; - td_u16 transmit_msg_q_num; - td_u16 transmit_msg_q_peak_num; - td_u32 dfx_msg_process_max_time; - td_u32 transmit_msg_process_max_time; - td_u32 send_local_q_fail; - td_u32 send_local_q_success; - td_u32 transmit_msg_rev_cnt; - td_u32 msg_rev_cnt; - td_u32 diag_pkt_msg_rev_cnt; - td_u32 beat_heart_msg_rev_cnt; - td_u32 channel_receive_data_cnt[4]; - td_u32 channel_receive_frame_cnt[4]; - td_u32 mem_pkt_alloc_size[2]; - td_u32 mem_pkt_free_size[2]; - td_u32 alloc_mem_size; - td_u32 alloc_mem_peak_size; - td_u32 conn_excep_cnt; - td_u32 conn_bu_cnt; -} zdiag_dfx_stat; - -typedef struct { - td_u32 transmit_id; - td_u32 ret; - td_u32 offset; - td_u32 size; - td_u32 crc; - td_u32 data[1]; -} transmit_data_reply_pkt; - -typedef struct { - td_u32 flag; - td_u32 transmit_id; -} diag_sample_data_cmd_t; - -typedef struct { - td_u32 ret; - td_u32 flag; - td_u32 transmit_id; -} diag_sample_data_ind_t; - -typedef struct { - td_u32 file_num; -} last_dump_start_ind_t; - -typedef struct { - char name[64]; - td_u32 total_size; - td_u32 offset; - td_u32 size; - td_u32 crc; - td_u8 data[0]; -} last_dump_data_ind_t; - -typedef struct { - char name[64]; - td_u32 total_size; -} last_dump_data_ind_finish_t; - -typedef struct { - td_u32 stack_limit; - td_u32 fault_type; - td_u32 fault_reason; - td_u32 address; - td_u32 reg_value[32]; - td_u32 psp_value; - td_u32 lr_value; - td_u32 pc_value; - td_u32 psps_value; - td_u32 primask_value; - td_u32 fault_mask_value; - td_u32 bserpri_value; - td_u32 control_value; -} diag_last_word_ind_t; \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/prot_core_hso_msg_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/prot_core_hso_msg_struct_def.txt deleted file mode 100755 index 52a1a9b..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/prot_core_hso_msg_struct_def.txt +++ /dev/null @@ -1,755 +0,0 @@ -#include "base_datatype_def.txt" -typedef enum { - EXT_UART_IDX_0, - EXT_UART_IDX_1, - EXT_UART_IDX_2, - EXT_UART_IDX_MAX, - EXT_UART_IDX_INVALID_ID = 0xFF, -} ext_uart_idx; -typedef enum { - EXT_DMA_CHANNEL_NONE = 0xFF, - EXT_DMA_CHANNEL_0 = 0, - EXT_DMA_CHANNEL_1, - EXT_DMA_CHANNEL_2, - EXT_DMA_CHANNEL_3, - EXT_DMA_CHANNEL_MAX_NUM, -} ext_dma_channel; -typedef enum { - EXT_DMA_PERIPHERAL_MEMORY = 0, - EXT_DMA_PERIPHERAL_UART0_TX = 1, - EXT_DMA_PERIPHERAL_UART0_RX = 2, - EXT_DMA_PERIPHERAL_SSP_TX = 3, - EXT_DMA_PERIPHERAL_SSP_RX = 4, - EXT_DMA_PERIPHERAL_MAX_NUM, -} ext_dma_peripheral; -typedef enum { - EXT_DMA_CH_PRIORITY_HIGHEST = 0, - EXT_DMA_CH_PRIORITY_HIGH_1 = 1, - EXT_DMA_CH_PRIORITY_HIGH_2 = 2, - EXT_DMA_CH_PRIORITY_LOWEST = 3, - EXT_DMA_CH_PRIORITY_MAX -} ext_dma_ch_priority; -typedef enum { - EXT_HWTIMER_ID_0, - EXT_HWTIMER_ID_1, - EXT_HWTIMER_ID_2, - EXT_HWTIMER_ID_3, - EXT_HWTIMER_ID_4, - EXT_HWTIMER_ID_5, - EXT_HWTIMER_ID_6, - EXT_HWTIMER_ID_7, - EXT_HWTIMER_ID_MAX, -} ext_hwtimer_id; -typedef enum { - EXT_CLK_IPC = 0, - EXT_CLK_UART0, - EXT_CLK_UART1, - EXT_CLK_UART2, - EXT_CLK_TIMER0, - EXT_CLK_TIMER1, - EXT_CLK_TIMER2, - EXT_CLK_TIMER3, - EXT_CLK_TIMER4, - EXT_CLK_TIMER5, - EXT_CLK_TIMER6, - EXT_CLK_TIMER7, - EXT_CLK_WDT, - EXT_CLK_GPIO, - EXT_CLK_DMA, - EXT_CLK_CPU, - EXT_CLK_TSENSOR, - EXT_CLK_ID_MAX, - EXT_CLK_ID_INVALID_ID = 0xFFFFFFFF, -} ext_clk_id; -typedef struct { - td_u32 reg_base_addr; - td_u32 irq_number; - td_u32 channel_max_num; - td_u32 peripheral_max_num; - td_u32 lowest_priority; -} ext_dma_device; -td_void dma_resource_init(td_void); -td_void uart_resource_init(td_void); -td_void ipc_resource_init(td_void); -td_void hrtimer_resource_init(td_void); -td_void hwtimer_resource_init(td_void); -td_void rtc_resource_init(td_void); -td_void rtc_calendar_resource_init(td_void); -td_void i2c_resource_init(td_void); -td_void clk_resource_init(td_void); -td_void io_resource_init(td_void); -td_void pwm_resource_init(td_void); -td_void spi_resource_init(td_void); -td_void watchdog_resource_init(td_void); -td_void tsensor_resource_init(td_void); -td_void share_os_res_resource_init(td_void); -td_void dntc_resource_init(td_void); -typedef enum { - EXT_DMA_POWER_OF_BURST_0 = 0, - EXT_DMA_POWER_OF_BURST_1 = 1, - EXT_DMA_POWER_OF_BURST_2 = 2, - EXT_DMA_POWER_OF_BURST_3 = 3, - EXT_DMA_POWER_OF_BURST_4 = 4, - EXT_DMA_POWER_OF_BURST_5 = 5, - EXT_DMA_POWER_OF_BURST_6 = 6, - EXT_DMA_POWER_OF_BURST_7 = 7, - EXT_DMA_POWER_OF_BURST_8 = 8, - EXT_DMA_POWER_OF_BURST_9 = 9, - EXT_DMA_POWER_OF_BURST_10 = 10, -} ext_dma_power_of_burst; -typedef struct { - ext_dma_power_of_burst power_of_burst; - td_bool use_burst; - td_u8 pad[3]; -} ext_dma_peripheral_feature; -typedef td_void (*ext_dma_transfer_peripheral_prepare_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef td_void (*ext_dma_transfer_peripheral_finish_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef struct { - ext_dma_peripheral src_periph; - ext_dma_peripheral dst_periph; - ext_dma_peripheral_feature feature; - ext_dma_transfer_peripheral_prepare_callback transfer_prepare; - ext_dma_transfer_peripheral_finish_callback transfer_finish; -} ext_dma_peripheral_config; -typedef enum { - EXT_DMA_DATA_WIDTH_BYTE = 0x0, - EXT_DMA_DATA_WIDTH_HALFWORD = 0x1, - EXT_DMA_DATA_WIDTH_WORD = 0x2, - EXT_DMA_DATA_WIDTH_MAX = 0x3, -} ext_dma_data_width; -typedef enum { - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_MEM = 0, - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_PERIPHERAL = 1, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_MEM = 2, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL = 3, - EXT_DMA_CH_TRANSFER_TYPE_MAX -} ext_dma_ch_transfer_type; -typedef enum { - EXT_DMA_CH_CYCLE_TYPE_SINGLE = 0, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_PART = 1, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_END = 2, - EXT_DMA_CH_CYCLE_TYPE_MAX -} ext_dma_ch_cycle_type; -typedef enum { - EXT_DMA_INTERRUPT_DONE, - EXT_DMA_INTERRUPT_ERR, - EXT_DMA_INTERRUPT_MAX -} ext_dma_interrupt; -typedef td_void (*ext_dma_transfer_callback)(ext_dma_interrupt intr); -typedef struct { - td_u32 src_addr; - td_u32 dst_addr; - td_u16 transfer_num; - ext_dma_data_width data_width; - ext_dma_ch_cycle_type cycle_type; -} ext_dma_ch_user_config; -ext_errno uapi_dma_init(td_void); -td_void uapi_dma_deinit(td_void); -ext_errno uapi_dma_open_ch(ext_dma_channel *ch, ext_dma_ch_priority pri, - const ext_dma_peripheral_config *config); -ext_errno uapi_dma_close_ch(ext_dma_channel ch); -ext_errno uapi_dma_transfer(ext_dma_channel ch, const ext_dma_ch_user_config *user_cfg, - ext_dma_transfer_callback callback, td_bool block); -typedef enum { - EXT_UART_DATA_BIT_5 = 5, - EXT_UART_DATA_BIT_6, - EXT_UART_DATA_BIT_7, - EXT_UART_DATA_BIT_8, -} ext_uart_data_bit; -typedef enum { - EXT_UART_PARITY_NONE, - EXT_UART_PARITY_ODD, - EXT_UART_PARITY_EVEN, -} ext_uart_parity; -typedef enum { - EXT_UART_STOP_BIT_1 = 1, - EXT_UART_STOP_BIT_2, -} ext_uart_stop_bit; -typedef enum { - EXT_UART_FLOW_CTRL_NONE = 0x0, - EXT_UART_FLOW_CTS = 0x1, - EXT_UART_FLOW_RTS = 0x2, - EXT_UART_FLOW_CTRL_RTS_CTS = EXT_UART_FLOW_CTS | EXT_UART_FLOW_RTS, - EXT_UART_FLOW_CTRL_SOFT = 0x4, -} ext_uart_flow_ctrl; -typedef enum { - EXT_UART_ERR_FRAM = 0x1, - EXT_UART_ERR_PARITY = 0x2, - EXT_UART_ERR_BREAK = 0x4, - EXT_UART_ERR_OVER_RUN = 0x8, -} ext_uart_err_type; -typedef struct { - td_u32 baud_rate; - td_u8 data_bits; - td_u8 stop_bits; - td_u8 parity; - td_u8 pad; -} ext_uart_attr; -typedef struct { - td_bool tx_use_dma; - td_u8 tx_dma_ch_priority; - td_u16 rx_buf_size; - td_u16 tx_buf_size; -} ext_uart_extra_attr; -typedef struct { - ext_dma_ch_cycle_type cycle_type; - ext_dma_transfer_callback done_callback; -} ext_uart_write_dma_config; -typedef enum { - EXT_UART_NOTIFY_RX_MASK_IDLE = 0x1, - EXT_UART_NOTIFY_RX_SUFFICIENT_DATA = 0x2, - EXT_UART_NOTIFY_RX_ERR = 0x4, - EXT_UART_NOTIFY_RX_DATA = 0x8, - EXT_UART_NOTIFY_TX_FINISH = 0x10, - EXT_UART_NOTIFY_ALL_MASK = 0x1F, -} ext_uart_rx_hook_type; -typedef td_void(*ext_uart_rx_hook)(ext_uart_rx_hook_type type, td_u16 data); -ext_errno uapi_uart_init(ext_uart_idx id, TD_CONST ext_uart_attr *attr, TD_CONST ext_uart_extra_attr *advance_attr); -ext_errno uapi_uart_set_attr(ext_uart_idx id, ext_uart_attr *attr); -ext_errno uapi_uart_get_attr(ext_uart_idx id, ext_uart_attr *attr); -td_s32 uapi_uart_read(ext_uart_idx id, td_u8 *data, td_u32 len); -td_s32 uapi_uart_write(ext_uart_idx id, TD_CONST td_u8 *data, td_u32 len); -ext_errno uapi_uart_deinit(ext_uart_idx id); -ext_errno uapi_uart_register_rx_callback(ext_uart_idx id, - td_u32 hook_mask, - td_u16 sufficient_cnt, - ext_uart_rx_hook hook); -td_bool uapi_uart_has_pending_transmissions(ext_uart_idx id); -ext_errno uapi_uart_flush_rx_data(ext_uart_idx id); -td_s32 uapi_uart_write_by_dma(ext_uart_idx id, TD_CONST td_u8 *data, td_u16 len, ext_uart_write_dma_config *dma_cfg); -ext_errno uapi_uart_set_flow_ctrl(ext_uart_idx id, ext_uart_flow_ctrl type); -ext_errno uapi_uart_set_software_flow_ctrl_level(ext_uart_idx id, td_u16 lower_water_margin, td_u16 upper_water_margin); -ext_errno uapi_uart_set_tx_timeout(ext_uart_idx id, td_u32 block_ms); -ext_errno uapi_uart_set_rx_timeout(ext_uart_idx id, td_u32 block_ms); -td_s32 uapi_uart_get_rx_data_count(ext_uart_idx id); -typedef td_u32 (*diag_cmd_f_prv)(td_u16 cmd_id, td_pvoid cmd_param, td_u16 cmd_param_size, td_u8 option); -typedef struct { - td_u16 min_id; - td_u16 max_id; - diag_cmd_f_prv fn_input_cmd; -} ext_diag_cmd_reg_obj; -td_u32 diag_register_cmd_prv(TD_CONST ext_diag_cmd_reg_obj *cmd_tbl, td_u16 cmd_num); -td_bool diag_is_connect_prv(td_void); -td_u32 diag_report_packet_prv(td_u16 cmd_id, td_u8 instance_id, TD_CONST td_pbyte packet, - td_u16 pakcet_size, td_bool sync); -td_u32 diag_init_prv(td_void); -typedef struct { -} diag_log_msg0; -typedef struct { - td_u32 data0; -} diag_log_msg1; -typedef struct { - td_u32 data0; - td_u32 data1; -} diag_log_msg2; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; -} diag_log_msg3; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; -} diag_log_msg4; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; -} diag_log_msg5; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; - td_u32 data5; -} diag_log_msg6; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; - td_u32 data5; - td_u32 data6; -} diag_log_msg7; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; - td_u32 data5; - td_u32 data6; - td_u32 data7; -} diag_log_msg8; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; - td_u32 data5; - td_u32 data6; - td_u32 data7; - td_u32 data8; -} diag_log_msg9; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; - td_u32 data4; - td_u32 data5; - td_u32 data6; - td_u32 data7; - td_u32 data8; - td_u32 data9; -} diag_log_msg10; -typedef enum { - APPLICATION_CORE = 0, - PROTOCOL_CORE, - SECURITY_CORE, -} core_type; -typedef struct { - td_u32 data0[5]; - td_u32 data1; -} user_define_struct1; -typedef struct { - td_u32 data0; - td_u32 data1; - user_define_struct1 data2; -} user_define_struct0; -td_u32 diag_log_msg0_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod); -td_u32 diag_log_msg1_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_u32 d0); -td_u32 diag_log_msg2_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_u32 d0, td_u32 d1); -td_u32 diag_log_msg3_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, diag_log_msg3 log_msg); -td_u32 diag_log_msg4_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, diag_log_msg4 log_msg); -td_u32 diag_log_msg_buffer_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_pvoid buffer, td_u16 size); -td_void dms_regist_app_uart_rx_prv(td_pvoid fun1, td_pvoid fun2); -td_void dms_regist_app_uart_cb_prv(td_pvoid fun); -typedef struct { - td_s16 module; - td_s16 x2b_surround; - td_s16 x2b_sound_width; - td_s16 eq_pre_gain_lr; - td_s16 eq_bands_lr; - td_s16 eq_type_lr[12]; - td_s16 eq_gain_lr[12]; - td_s16 eq_q[2][12]; - td_s16 eq_fc[2][12]; - td_s16 drc_gain; - td_s16 drc_paral_glr; - td_s16 drc_looka_lr; - td_s16 lmt_th; -} audio_sws_mobile_para; -typedef struct { - td_char name[32]; - td_u32 id; - td_u16 status; - td_u16 priority; - td_pvoid task_sem; - td_pvoid task_mutex; - td_u32 event_stru[3]; - td_u32 event_mask; - td_u32 stack_size; - td_u32 top_of_stack; - td_u32 bottom_of_stack; - td_u32 sp; - td_u32 curr_used; - td_u32 peak_used; - td_u32 overflow_flag; -} ext_task_info; -typedef struct { - td_u16 task_prio; - td_u32 stack_size; - td_u32 task_policy; - td_u32 task_nice; - td_u32 task_cpuid; - td_char *task_name; - td_void *resved; -} ext_task_attr; -ext_errno uapi_task_create(td_u32 *taskid, const ext_task_attr *attr, - td_void *(*task_route)(td_void *), td_void *arg); -ext_errno uapi_task_delete(td_u32 taskid); -ext_errno uapi_task_suspend(td_u32 taskid); -ext_errno uapi_task_resume(td_u32 taskid); -ext_errno uapi_task_get_priority(td_u32 taskid, td_u32 *priority); -ext_errno uapi_task_set_priority(td_u32 taskid, td_u32 priority); -td_u32 uapi_task_get_current_id(td_void); -td_void uapi_task_lock(td_void); -td_void uapi_task_unlock(td_void); -td_bool uapi_task_is_lock(td_void); -ext_errno uapi_sleep(td_u32 ms); -typedef struct { - td_u32 total; - td_u32 used; - td_u32 free; - td_u32 free_node_num; - td_u32 used_node_num; - td_u32 max_free_node_size; - td_u32 malloc_fail_count; - td_u32 peek_size; -} ext_mdm_mem_info; -typedef struct { - td_u32 pool_addr; - td_u32 pool_size; - td_u32 fail_count; - td_u32 cur_use_size; - td_u32 peek_size; -} ext_mem_pool_crash_info; -td_pvoid uapi_malloc(td_u32 size); -td_void uapi_free(const td_pvoid addr); -TD_CONST ext_mem_pool_crash_info *uapi_mem_get_sys_info_crash(td_void); -ext_errno uapi_pool_mem_init(td_void *pool, td_u32 size); -td_void *uapi_pool_mem_alloc(td_void *pool, td_ulong size); -td_void uapi_pool_mem_free(td_void *pool, TD_CONST td_void *addr); -ext_errno uapi_pool_mem_deinit(td_void *pool); -typedef struct { - td_u8 timer_usage; - td_u8 task_usage; - td_u8 sem_usage; - td_u8 queue_usage; - td_u8 mux_usage; - td_u8 event_usage; - td_u16 err_info; -} ext_os_resource_use_stat; -ext_errno uapi_os_get_resource_status(ext_os_resource_use_stat *os_resource_stat); -td_void uapi_os_task_join(td_u32 taskid, td_u32 wait_interval); -ext_errno uapi_os_get_task_info(td_u32 taskid, ext_task_info *inf); -ext_errno uapi_os_get_mem_sys_info(TD_OUT ext_mdm_mem_info *mem_inf); -typedef enum { - EXCEPTION_PHASE_INITIALIZATION, - EXCEPTION_PHASE_TASK, - EXCEPTION_PHASE_INTERRUPT, - EXCEPTION_PHASE_MAX_TYPE -} ext_exception_phase_type; -typedef struct { - td_u32 mepc; - td_u32 ra; - td_u32 sp; -} ext_exception_cpu_basic_info; -typedef struct { - td_u32 mcause; - td_u32 mstatus; - td_u32 ccause; - td_u32 mtval; - td_u32 gp; - td_u32 tp; - td_u32 t0; - td_u32 t1; - td_u32 t2; - td_u32 s0; - td_u32 s1; - td_u32 a0; - td_u32 a1; - td_u32 a2; - td_u32 a3; - td_u32 a4; - td_u32 a5; - td_u32 a6; - td_u32 a7; - td_u32 s2; - td_u32 s3; - td_u32 s4; - td_u32 s5; - td_u32 s6; - td_u32 s7; - td_u32 s8; - td_u32 s9; - td_u32 s10; - td_u32 s11; - td_u32 t3; - td_u32 t4; - td_u32 t5; - td_u32 t6; -} ext_exception_cpu_extend_info; -typedef struct { - td_u32 event_type; - td_u32 task; - td_u64 time; - td_uintptr_t identity; - td_uintptr_t params[2]; -} ext_exception_track_info; -typedef struct { - ext_exception_cpu_basic_info basic_info; - ext_exception_cpu_extend_info extend_info; -} ext_exception_cpu_register; -typedef struct { - td_u16 is_irq; - td_u16 type; - td_u32 faultaddr; - td_u32 thrdpid; - td_u32 stack_top; - td_u32 stack_bottom; -} ext_exception_schedule_info; -typedef struct { - ext_exception_cpu_register exc_cpu_context; - ext_exception_schedule_info schedule_info; -} ext_exception_context; -typedef enum { - CORES_APPLICATION_CORE = 0, - CORES_PROTOCOL_CORE, - CORES_SECURITY_CORE, - CORES_DSP_CORE, - CORES_CGRA_CORE, - CORES_IOMCU_CORE, - CORES_MAX_NUMBER_PHYSICAL, - CORES_UNKNOWN, -} cores; -typedef enum { - EXT_SYSERR_NO_USED = 0, - EXT_SYSERR_WATCH_DOG = 1, - EXT_SYSERR_OLD_PANIC, - EXT_SYSERR_LOS_PANIC, - EXT_SYSERR_CPU_EXEC, - EXT_SYSERR_OS_ERR, - EXT_SYSERR_MAX_MAIN_TYPE -} ext_syserr_main_type; -typedef enum { - SYSERR_QUERY_SPECIFY_BLOCK_ID0, - SYSERR_QUERY_SPECIFY_BLOCK_ID1, - SYSERR_QUERY_SPECIFY_BLOCK_ID2, - SYSERR_QUERY_SPECIFY_BLOCK_ID3, - SYSERR_QUERY_SPECIFY_BLOCK_ID4, - SYSERR_QUERY_SPECIFY_BLOCK_ID5, - SYSERR_QUERY_SPECIFY_BLOCK_ID6, - SYSERR_QUERY_SPECIFY_BLOCK_ID7, - SYSERR_QUERY_SPECIFY_BLOCK_MAX_TYPE, - SYSERR_LASTEST_STORED_BLOCK, - SYSERR_NEW_STORE_BLOCK, - SYSERR_BLOCK_MAX_TYPE, -} syserr_info_type; -typedef struct { - td_u8 core[1]; -} dbk_str_type; -typedef struct { - td_u32 head_magic; - td_bool save_ind; - td_u8 core; - td_u16 structure_ver; - td_u32 size; -} ext_syserr_head_info; -typedef struct { - td_u16 main_type; - td_u16 pad; - td_u32 sub_type; - ext_exception_cpu_basic_info cpu_context; -} ext_syserr_basic_context_info; -typedef struct { - td_u8 is_isr; - td_u8 pad[3]; - td_u32 id; - td_u32 top; - td_u32 bottom; - td_u32 revised_top; - td_u32 revised_bottom; - td_u32 revised_sp; -} ext_syserr_base_stack_info; -typedef struct { - ext_syserr_basic_context_info basic_context[2]; - ext_syserr_base_stack_info basic_stack[2]; - td_u32 trace[40]; -} ext_syserr_lite_info; -typedef struct { - td_u32 crash_sec; - td_u32 soft_version; - td_u8 loop; - td_u8 last_trap_level; - td_u16 process_map; - td_u32 data[5]; -} ext_syserr_crash_scene; -typedef struct { - ext_exception_cpu_extend_info cpu_register; -} ext_syserr_cpu_extend_register; -typedef struct { - td_u32 stat_errno; - ext_os_resource_use_stat resource_stat; -} ext_syserr_sys_status; -typedef struct { - ext_mem_pool_crash_info mem; -} ext_syserr_mem_info; -typedef struct { - td_u32 peek; - td_u32 top_content; - td_u32 stack[0x10]; - td_char name[32]; -} ext_syserr_extend_stack_info; -typedef struct { - td_u32 end_magic; -} ext_syserr_tail; -typedef struct { - ext_syserr_head_info head; - ext_syserr_crash_scene scene; - ext_syserr_lite_info lite_info; - ext_syserr_cpu_extend_register cpu; - ext_syserr_sys_status sys; - ext_syserr_mem_info mem; - ext_syserr_extend_stack_info stack; - ext_syserr_tail tail; -} ext_syserr_info; -typedef td_void (*uapi_syserr_hook)(td_u32 main_type, td_u32 sub_type); -td_void uapi_syserr_set_unreboot(td_void); -td_void uapi_syserr_register_hook(uapi_syserr_hook hook); -td_void uapi_syserr_panic(td_u32 reason, td_u32 data0, td_u32 data1, td_u32 data2, td_u32 data3); -td_u32 uapi_syserr_query_crash_info(cores src_core, syserr_info_type type, ext_syserr_info *dest_addr); -typedef unsigned int uintptr_t; -typedef int intptr_t; -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -typedef signed long long int64_t; -typedef signed long long intmax_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef unsigned long long uintmax_t; -typedef int8_t int_fast8_t; -typedef int64_t int_fast64_t; -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_fast8_t; -typedef uint64_t uint_fast64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; -typedef int32_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef uint32_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef unsigned char td_uchar; -typedef unsigned char td_u8; -typedef unsigned short td_u16; -typedef unsigned int td_u32; -typedef unsigned long long td_u64; -typedef unsigned long td_ulong; -typedef char td_char; -typedef signed char td_s8; -typedef short td_s16; -typedef int td_s32; -typedef long long td_s64; -typedef long td_slong; -typedef float td_float; -typedef double td_double; -typedef void td_void; -typedef td_u8 td_bool; -typedef td_u32 td_handle; -typedef td_u8 td_byte; -typedef td_byte* td_pbyte; -typedef void* td_pvoid; -typedef volatile td_u32 td_u32_reg; -typedef unsigned long td_size_t; -typedef signed long td_ssize_t; -typedef unsigned long td_length_t; -typedef unsigned long long td_mem_size_t; -typedef long long td_mem_handle_t; -typedef unsigned int td_fr32; -typedef uintptr_t td_uintptr_t; -typedef unsigned int td_phys_addr_t; -typedef unsigned int td_virt_addr_t; -typedef unsigned int td_phys_addr_bit32; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_req_st; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_ind_st; -typedef struct { - td_u32 put_msg_2_cache_fail_times; - td_u32 send_ipc_times; - td_u32 send_used_size; - td_u32 log_receive_times; - td_u32 log_reported_times; - td_u32 send_local_q_fail; - td_u32 record_idx; - td_u32 channel_receive_data_cnt[4]; - td_u32 mem_pkt_alloc_size[2]; - td_u32 mem_pkt_free_size[2]; -} zdiag_dfx_stat; -typedef struct { - td_u32 dir; - td_u32 random_data; -} diag_beat_heart_cmd_ind; -typedef struct { - td_u32 offset; - td_u32 size; -} ext_diag_dump_item; -typedef struct { - td_u32 len; - td_char name[128]; - td_u32 cnt; - ext_diag_dump_item item[0]; -} ext_diag_dump_by_name_cmd; -typedef struct { - td_u32 ret; - td_u32 offset; - td_u32 size; - td_u8 data[0]; -} ext_diag_dump_by_name_ind; -typedef enum { - TRANSMIT_STATE_NOTIFY_INVALID_ID = 10, - TRANSMIT_STATE_NOTIFY_FINISH, - TRANSMIT_STATE_NOTIFY_FINISH_2, - TRANSMIT_STATE_NOTIFY_DUPLICATE_ID, -} transmit_state_notify_code; -typedef enum { - TRANSMIT_TYPE_READ_FILE, - TRANSMIT_TYPE_DUMP, - TRANSMIT_TYPE_SAVE_FILE, -} transmit_type; -typedef struct { - td_u32 offset; - td_u32 size; -} transmit_data_request_item; -typedef struct { - td_u32 transmit_id; - td_u32 cnt; - transmit_data_request_item item[0]; -} transmit_data_request_pkt; -typedef struct { - td_u32 transmit_id; - td_u32 ret; - td_u32 offset; - td_u32 size; - td_u32 crc; - td_u8 data[0]; -} transmit_data_reply_pkt; -typedef struct { - td_u32 transmit_id; - td_u32 state_code; - td_u32 len; - td_u8 data[0]; -} transmit_state_notify_pkt; -typedef struct { - td_u16 name_size; - td_u16 pad; - td_char file_name[0]; -} transmit_save_file_start_info; -typedef struct { - td_u32 transmit_id; - td_u16 pad; - td_u16 transmit_type; - td_u32 total_size; - td_u32 info_size; - td_u8 info[0]; -} transmit_start_pkt; -typedef struct { - td_u32 dir_len; - td_char name[128]; -} ext_diag_ls_cmd; -typedef struct { - td_u16 idx; - td_u16 path_len; - td_u32 file_size; - td_char name[128]; -} ext_diag_ls_ind; diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/tool_fix_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/tool_fix_struct_def.txt deleted file mode 100755 index 1622a6f..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/tool_fix_struct_def.txt +++ /dev/null @@ -1 +0,0 @@ -#include "base_datatype_def.txt" diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/ws63_mcore_hso_msg_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/ws63_mcore_hso_msg_struct_def.txt deleted file mode 100755 index b661cdb..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/diag/ws63_mcore_hso_msg_struct_def.txt +++ /dev/null @@ -1,301 +0,0 @@ -#include "base_datatype_def.txt" -typedef enum { - EXT_UART_IDX_0, - EXT_UART_IDX_1, - EXT_UART_IDX_2, - EXT_UART_IDX_3, - EXT_UART_IDX_LP, - EXT_UART_IDX_MAX, - EXT_UART_IDX_INVALID_ID = 0xFF, -} ext_uart_idx; -typedef enum { - EXT_DMA_PERIPHERAL_MEMORY = 0, - EXT_DMA_PERIPHERAL_UART0_TX = 1, - EXT_DMA_PERIPHERAL_UART0_RX = 2, - EXT_DMA_PERIPHERAL_UART1_TX = 3, - EXT_DMA_PERIPHERAL_UART1_RX = 4, - EXT_DMA_PERIPHERAL_MAX_NUM, -} ext_dma_peripheral; -typedef enum { - EXT_DMA_CHANNEL_NONE = 0xFF, - EXT_DMA_CHANNEL_0 = 0, - EXT_DMA_CHANNEL_1, - EXT_DMA_CHANNEL_MAX_NUM, -} ext_dma_channel; -typedef enum { - EXT_DMA_CH_PRIORITY_HIGHEST = 0, - EXT_DMA_CH_PRIORITY_HIGH_1 = 1, - EXT_DMA_CH_PRIORITY_HIGH_2 = 2, - EXT_DMA_CH_PRIORITY_LOWEST = 3, - EXT_DMA_CH_PRIORITY_RESERVED = 0xFF -} ext_dma_ch_priority; -typedef enum { - EXT_CLK_CPU = 0, - EXT_CLK_TIMER0 = 1, - EXT_CLK_TIMER1 = 2, - EXT_CLK_TIMER2 = 3, - EXT_CLK_WDT = 4, - EXT_CLK_GPIO = 5, - EXT_CLK_TSENSOR = 6, - EXT_CLK_ID_MAX, - EXT_CLK_ID_INVALID_ID = 0xFFFFFFFF, -} ext_clk_id; -typedef struct { - td_u32 reg_base_addr; - td_u32 irq_number; - td_u32 channel_max_num; - td_u32 peripheral_max_num; - td_u32 lowest_priority; -} ext_dma_device; -td_void dma_resource_init(td_void); -td_void uapi_malloc_resource_init(td_void); -td_void hrtimer_resource_init(td_void); -td_void uapi_tsensor_resource_init(td_void); -td_void uapi_io_resource_init(td_void); -typedef enum { - EXT_DMA_POWER_OF_BURST_0 = 0, - EXT_DMA_POWER_OF_BURST_1 = 1, - EXT_DMA_POWER_OF_BURST_2 = 2, - EXT_DMA_POWER_OF_BURST_3 = 3, - EXT_DMA_POWER_OF_BURST_4 = 4, - EXT_DMA_POWER_OF_BURST_5 = 5, - EXT_DMA_POWER_OF_BURST_6 = 6, - EXT_DMA_POWER_OF_BURST_7 = 7, - EXT_DMA_POWER_OF_BURST_8 = 8, - EXT_DMA_POWER_OF_BURST_9 = 9, - EXT_DMA_POWER_OF_BURST_10 = 10, -} ext_dma_power_of_burst; -typedef struct { - ext_dma_power_of_burst power_of_burst; - td_bool use_burst; - td_u8 pad[3]; -} ext_dma_peripheral_feature; -typedef td_void (*ext_dma_transfer_peripheral_prepare_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef td_void (*ext_dma_transfer_peripheral_finish_callback)(ext_dma_peripheral src, ext_dma_peripheral dst); -typedef struct { - ext_dma_peripheral src_periph; - ext_dma_peripheral dst_periph; - ext_dma_peripheral_feature feature; - ext_dma_transfer_peripheral_prepare_callback transfer_prepare; - ext_dma_transfer_peripheral_finish_callback transfer_finish; -} ext_dma_peripheral_config; -typedef enum { - EXT_DMA_DATA_WIDTH_BYTE = 0x0, - EXT_DMA_DATA_WIDTH_HALFWORD = 0x1, - EXT_DMA_DATA_WIDTH_WORD = 0x2, - EXT_DMA_DATA_WIDTH_MAX = 0x3, -} ext_dma_data_width; -typedef enum { - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_MEM = 0, - EXT_DMA_CH_TRANSFER_TYPE_MEM_TO_PERIPHERAL = 1, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_MEM = 2, - EXT_DMA_CH_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL = 3, - EXT_DMA_CH_TRANSFER_TYPE_MAX -} ext_dma_ch_transfer_type; -typedef enum { - EXT_DMA_CH_CYCLE_TYPE_SINGLE = 0, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_PART = 1, - EXT_DMA_CH_CYCLE_TYPE_BATCHED_END = 2, - EXT_DMA_CH_CYCLE_TYPE_MAX -} ext_dma_ch_cycle_type; -typedef enum { - EXT_DMA_INTERRUPT_DONE, - EXT_DMA_INTERRUPT_ERR, - EXT_DMA_INTERRUPT_MAX -} ext_dma_interrupt; -typedef td_void (*ext_dma_transfer_callback)(ext_dma_interrupt intr); -typedef struct { - td_u32 src_addr; - td_u32 dst_addr; - td_u16 transfer_num; - ext_dma_data_width data_width; - ext_dma_ch_cycle_type cycle_type; -} ext_dma_ch_user_config; -ext_errno uapi_dma_init(td_void); -td_void uapi_dma_deinit(td_void); -ext_errno uapi_dma_open_ch(ext_dma_channel *ch, ext_dma_ch_priority pri, - const ext_dma_peripheral_config *config); -ext_errno uapi_dma_close_ch(ext_dma_channel ch); -ext_errno uapi_dma_transfer(ext_dma_channel ch, const ext_dma_ch_user_config *user_cfg, - ext_dma_transfer_callback callback, td_bool block); -typedef enum { - EXT_UART_DATA_BIT_5 = 5, - EXT_UART_DATA_BIT_6, - EXT_UART_DATA_BIT_7, - EXT_UART_DATA_BIT_8, -} ext_uart_data_bit; -typedef enum { - EXT_UART_PARITY_NONE, - EXT_UART_PARITY_ODD, - EXT_UART_PARITY_EVEN, -} ext_uart_parity; -typedef enum { - EXT_UART_STOP_BIT_1 = 1, - EXT_UART_STOP_BIT_2, -} ext_uart_stop_bit; -typedef enum { - EXT_UART_FLOW_CTRL_NONE = 0x0, - EXT_UART_FLOW_CTS = 0x1, - EXT_UART_FLOW_RTS = 0x2, - EXT_UART_FLOW_CTRL_RTS_CTS = EXT_UART_FLOW_CTS | EXT_UART_FLOW_RTS, - EXT_UART_FLOW_CTRL_SOFT = 0x4, -} ext_uart_flow_ctrl; -typedef enum { - EXT_UART_ERR_FRAM = 0x1, - EXT_UART_ERR_PARITY = 0x2, - EXT_UART_ERR_BREAK = 0x4, - EXT_UART_ERR_OVER_RUN = 0x8, -} ext_uart_err_type; -typedef struct { - td_u32 baud_rate; - td_u8 data_bits; - td_u8 stop_bits; - td_u8 parity; - td_u8 pad; -} ext_uart_attr; -typedef struct { - td_bool tx_use_dma; - td_u8 tx_dma_ch_priority; - td_u16 rx_buf_size; - td_u16 tx_buf_size; -} ext_uart_extra_attr; -typedef struct { - ext_dma_ch_cycle_type cycle_type; - ext_dma_transfer_callback done_callback; -} ext_uart_write_dma_config; -typedef enum { - EXT_UART_NOTIFY_RX_MASK_IDLE = 0x1, - EXT_UART_NOTIFY_RX_SUFFICIENT_DATA = 0x2, - EXT_UART_NOTIFY_RX_ERR = 0x4, - EXT_UART_NOTIFY_RX_DATA = 0x8, - EXT_UART_NOTIFY_TX_FINISH = 0x10, - EXT_UART_NOTIFY_ALL_MASK = 0x1F, -} ext_uart_rx_hook_type; -typedef td_void(*ext_uart_rx_hook)(ext_uart_rx_hook_type type, td_u16 data); -ext_errno uapi_uart_init(ext_uart_idx id, TD_CONST ext_uart_attr *attr, TD_CONST ext_uart_extra_attr *advance_attr); -ext_errno uapi_uart_set_attr(ext_uart_idx id, ext_uart_attr *attr); -ext_errno uapi_uart_get_attr(ext_uart_idx id, ext_uart_attr *attr); -td_s32 uapi_uart_read(ext_uart_idx id, td_u8 *data, td_u32 len); -td_s32 uapi_uart_write(ext_uart_idx id, TD_CONST td_u8 *data, td_u32 len); -ext_errno uapi_uart_deinit(ext_uart_idx id); -ext_errno uapi_uart_register_rx_callback(ext_uart_idx id, - td_u32 hook_mask, - td_u16 sufficient_cnt, - ext_uart_rx_hook hook); -td_bool uapi_uart_has_pending_transmissions(ext_uart_idx id); -ext_errno uapi_uart_flush_rx_data(ext_uart_idx id); -td_s32 uapi_uart_write_by_dma(ext_uart_idx id, TD_CONST td_u8 *data, td_u16 len, ext_uart_write_dma_config *dma_cfg); -ext_errno uapi_uart_set_flow_ctrl(ext_uart_idx id, ext_uart_flow_ctrl type); -ext_errno uapi_uart_set_software_flow_ctrl_level(ext_uart_idx id, td_u16 lower_water_margin, td_u16 upper_water_margin); -ext_errno uapi_uart_set_tx_timeout(ext_uart_idx id, td_u32 block_ms); -ext_errno uapi_uart_set_rx_timeout(ext_uart_idx id, td_u32 block_ms); -td_s32 uapi_uart_get_rx_data_count(ext_uart_idx id); -typedef td_u32 (*diag_cmd_f_prv)(td_u16 cmd_id, td_pvoid cmd_param, td_u16 cmd_param_size, td_u8 option); -typedef struct { - td_u16 min_id; - td_u16 max_id; - diag_cmd_f_prv fn_input_cmd; -} ext_diag_cmd_reg_obj; -td_u32 diag_register_cmd_prv(TD_CONST ext_diag_cmd_reg_obj *cmd_tbl, td_u16 cmd_num); -td_bool diag_is_connect_prv(td_void); -td_u32 diag_report_packet_prv(td_u16 cmd_id, td_u8 instance_id, TD_CONST td_pbyte packet, - td_u16 pakcet_size, td_bool sync); -td_u32 diag_init_prv(td_void); -typedef struct { -} diag_log_msg0; -typedef struct { - td_u32 data0; -} diag_log_msg1; -typedef struct { - td_u32 data0; - td_u32 data1; -} diag_log_msg2; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; -} diag_log_msg3; -typedef struct { - td_u32 data0; - td_u32 data1; - td_u32 data2; - td_u32 data3; -} diag_log_msg4; -typedef enum { - APPLICATION_CORE = 0, - PROTOCOL_CORE, - SECURITY_CORE, -} core_type; -typedef struct { - td_u32 data0[5]; - td_u32 data1; -} user_define_struct1; -typedef struct { - td_u32 data0; - td_u32 data1; - user_define_struct1 data2; -} user_define_struct0; -td_u32 diag_log_msg0_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod); -td_u32 diag_log_msg1_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_u32 d0); -td_u32 diag_log_msg2_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_u32 d0, td_u32 d1); -td_u32 diag_log_msg3_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, diag_log_msg3 log_msg); -td_u32 diag_log_msg4_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, diag_log_msg4 log_msg); -td_u32 diag_log_msg_buffer_prv(td_u32 msg_id, td_u32 src_mod, td_u32 dest_mod, td_pvoid buffer, td_u16 size); -td_void dms_regist_app_uart_rx_prv(td_pvoid fun1, td_pvoid fun2); -td_void dms_regist_app_uart_cb_prv(td_pvoid fun); -typedef unsigned char td_uchar; -typedef unsigned char td_u8; -typedef unsigned short td_u16; -typedef unsigned int td_u32; -typedef unsigned long long td_u64; -typedef unsigned long td_ulong; -typedef char td_char; -typedef signed char td_s8; -typedef short td_s16; -typedef int td_s32; -typedef long long td_s64; -typedef long td_slong; -typedef float td_float; -typedef double td_double; -typedef void td_void; -typedef td_u8 td_bool; -typedef td_u32 td_handle; -typedef td_u8 td_byte; -typedef td_byte* td_pbyte; -typedef void* td_pvoid; -typedef volatile td_u32 td_u32_reg; -typedef unsigned long td_size_t; -typedef signed long td_ssize_t; -typedef unsigned long td_length_t; -typedef unsigned long long td_mem_size_t; -typedef long long td_mem_handle_t; -typedef unsigned int td_fr32; -typedef unsigned int uintptr_t; -typedef uintptr_t td_uintptr_t; -typedef unsigned int td_phys_addr_t; -typedef unsigned int td_virt_addr_t; -typedef unsigned int td_phys_addr_bit32; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_req_st; -typedef struct { - td_u32 case_id; - td_u32 data[3]; -}diag_dfx_cmd_ind_st; -typedef struct { - td_u32 put_msg_2_cache_fail_times; - td_u32 send_ipc_times; - td_u32 send_used_size; - td_u32 log_receive_times; - td_u32 log_reported_times; - td_u32 send_local_q_fail; - td_u32 record_idx; - td_u32 channel_receive_data_cnt[4]; - td_u32 mem_pkt_alloc_size[2]; - td_u32 mem_pkt_free_size[2]; -} zdiag_dfx_stat; -typedef struct { - td_u32 dir; - td_u32 random_data; -} diag_beat_heart_cmd_ind; diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml deleted file mode 100755 index 2b32f9e..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_layout_db.xml b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_layout_db.xml deleted file mode 100755 index a555ee6..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_layout_db.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_nvi_db.xml b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_nvi_db.xml deleted file mode 100755 index 191cf22..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_nvi_db.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_prim_db.xml b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_prim_db.xml deleted file mode 100755 index af1186b..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_prim_db.xml +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_subsystem_db.xml b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_subsystem_db.xml deleted file mode 100755 index 5616af2..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hdbcfg/mss_subsystem_db.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - <ITEM ID="0x00" NAME="NO." STAT="1" VALUE="0" DESCRIPTION="..." /> - <ITEM ID="0x01" NAME="Category" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x02" STAT="0" NAME="Level" DESCRIPTION="..." /> - <ITEM ID="0x03" STAT="1" NAME="Date" DESCRIPTION="..." /> - <ITEM ID="0x04" NAME="Time" STAT="1" DESCRIPTION="..." /> - <ITEM ID="0x05" NAME="TimeStamp" STAT="1" DESCRIPTION="..." /> - <ITEM ID="0x06" NAME="Chip" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x07" NAME="Cpu" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x08" NAME="Side" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x09" NAME="Layer" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0A" NAME="Prim" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0B" NAME="Source" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0C" NAME="Destination" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0D" NAME="FileName" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0E" NAME="LineNo" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0F" NAME="Data" STAT="0" DESCRIPTION="..." /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hso/base_datatype_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/hso/base_datatype_def.txt deleted file mode 100755 index bf0c60e..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/hso/base_datatype_def.txt +++ /dev/null @@ -1,41 +0,0 @@ -UINT32 32 0 -UINT16 16 0 -UINT8 8 0 - -INT32 32 1 -INT16 16 1 -INT8 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 -char 8 1 1 - -long 32 1 -td_pvoid 32 0 -td_pbyte 32 0 - -uint8_t 8 0 -uint16_t 16 0 -uint32_t 32 0 \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/base_datatype_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/base_datatype_def.txt deleted file mode 100755 index bf0c60e..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/base_datatype_def.txt +++ /dev/null @@ -1,41 +0,0 @@ -UINT32 32 0 -UINT16 16 0 -UINT8 8 0 - -INT32 32 1 -INT16 16 1 -INT8 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 -char 8 1 1 - -long 32 1 -td_pvoid 32 0 -td_pbyte 32 0 - -uint8_t 8 0 -uint16_t 16 0 -uint32_t 32 0 \ No newline at end of file diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/extern_datatype_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/extern_datatype_def.txt deleted file mode 100755 index 47980dd..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/extern_datatype_def.txt +++ /dev/null @@ -1,5 +0,0 @@ -EXT_FTM_CHIP_TYPE_E 32 0 -EXT_FTM_HW_PLATFORM_TYPE_E 32 0 -EXT_FTM_PRODUCT_TYPE_E 32 0 -ext_errno 32 0 -sys_nv_enum 32 0 diff --git a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/nv_app_struct_def.txt b/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/nv_app_struct_def.txt deleted file mode 100755 index 951b45a..0000000 --- a/build/config/target_config/ws63/hdb_config/database_template/acore/system/nv/nv_app_struct_def.txt +++ /dev/null @@ -1 +0,0 @@ -#include "base_datatype_def.txt" \ No newline at end of file diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_app.config b/build/config/target_config/ws63/menuconfig/acore/ws63_alios_app.config deleted file mode 100755 index 5927104..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_app.config +++ /dev/null @@ -1,637 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_btc_only.config b/build/config/target_config/ws63/menuconfig/acore/ws63_alios_btc_only.config deleted file mode 100755 index 0891577..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_btc_only.config +++ /dev/null @@ -1,639 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_testsuite.config b/build/config/target_config/ws63/menuconfig/acore/ws63_alios_testsuite.config deleted file mode 100755 index 6b9ff77..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_alios_testsuite.config +++ /dev/null @@ -1,477 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -CONFIG_ADC_SUPPORT_QUERY_REGS=y -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_USING_V100=y -CONFIG_DMA_USING_V120=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -CONFIG_SUPPORT_DATA_CACHE=y -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_PINCTRL=y - -# -# PINCTRL Configuration -# - -# -# Config PINCTRL -# -# CONFIG_PINCTRL_USING_V150 is not set -CONFIG_PINCTRL_USING_CHIPS=y -CONFIG_PINCTRL_SUPPORT_IE=y -CONFIG_PINCTRL_SUPPORT_ST=y -# end of PINCTRL Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_bgle.config b/build/config/target_config/ws63/menuconfig/acore/ws63_ate_bgle.config deleted file mode 100755 index f93175d..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_bgle.config +++ /dev/null @@ -1,263 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# -# end of Boards - -# -# Chips -# -CONFIG_CHIP_WS63=y -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -# -# Config the drivers of chips. -# -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_RTC is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -CONFIG_DRIVER_SUPPORT_SPI=y -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_ADC is not set -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_EFUSE is not set -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# -# end of Protocol -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_flash.config b/build/config/target_config/ws63/menuconfig/acore/ws63_ate_flash.config deleted file mode 100755 index 2dfdc57..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_flash.config +++ /dev/null @@ -1,247 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# -# end of Boards - -# -# Chips -# -CONFIG_CHIP_WS63=y -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -# -# Config the drivers of chips. -# -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_RTC is not set -CONFIG_DRIVER_SUPPORT_GPIO=y -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_ADC is not set -# CONFIG_DRIVER_SUPPORT_TSENSOR is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_EFUSE is not set -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# -# end of Protocol -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_wifi.config b/build/config/target_config/ws63/menuconfig/acore/ws63_ate_wifi.config deleted file mode 100755 index 86592a6..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_ate_wifi.config +++ /dev/null @@ -1,263 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# -# end of Boards - -# -# Chips -# -CONFIG_CHIP_WS63=y -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -# -# Config the drivers of chips. -# -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_RTC is not set -CONFIG_DRIVER_SUPPORT_GPIO=y -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_ADC is not set -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_EFUSE is not set -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# -# end of Protocol -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_flashboot.config b/build/config/target_config/ws63/menuconfig/acore/ws63_flashboot.config deleted file mode 100644 index fc2f195..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_flashboot.config +++ /dev/null @@ -1,545 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# CONFIG_SAMPLE_ENABLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -CONFIG_BOOT_SUPPORT_ECC_VERIFY=y -# CONFIG_BOOT_SUPPORT_SM2_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA3072_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA4096_VERIFY is not set -# CONFIG_BOOT_SUPPORT_SOFT_VERIFY is not set -CONFIG_FLASH_BOOT_SUPPORT_ROM_API=y -CONFIG_ROM_EXPEND_SUPPORT_NOT_ALIGNED=y -# CONFIG_LOADERBOOT_SUPPORT_DYNAMIC_PACKET_SIZE is not set -CONFIG_BOOT_SUPPORT_SECURE_VERIFY=y - -# -# Boot Secure Verify Configuration -# - -# -# Boot secure verify -# -# end of Boot Secure Verify Configuration - -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# CONFIG_LOADERBOOT_SUPPORT_EFUSE_BURN is not set -# CONFIG_LOADERBOOT_SUPPORT_FLASH_CHIP_ERASE is not set -# CONFIG_LOADERBOOT_SUPPORT_UPLOAD_DATA is not set -# CONFIG_LOADERBOOT_SUPPORT_READ_VERSION is not set -# CONFIG_LOADERBOOT_SUPPORT_SET_BUADRATE is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="" -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -# CONFIG_UART_SUPPORT_PORTTING_IRQ is not set -CONFIG_PM_SUPPORT_WKUP_UART=1 -# CONFIG_PM_SUPPORT_POWER_EXCEPTION_DEBUG is not set -# CONFIG_PM_SUPPORT_SRV_DECOUPLING is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_ADC is not set -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -# CONFIG_DMA_SUPPORT_CIRCULAR_LLI is not set -CONFIG_DMA_SUPPORT_LPM=y -# CONFIG_DMA_SUPPORT_QUERY_REGS is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set -# CONFIG_DMA_USING_V150 is not set -CONFIG_SUPPORT_DATA_CACHE=y -# CONFIG_DMA_LLI_NODE_FIX_MEM is not set -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_PM is not set -# CONFIG_DRIVER_SUPPORT_PMP is not set -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=6 -CONFIG_PWM_CHANNEL_NUM=6 -# CONFIG_PWM_PRELOAD is not set -# end of PWM Configuration - -# CONFIG_DRIVER_SUPPORT_RTC is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_HASH is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_KM is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P192R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P224R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P256R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P384R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P521R is not set -CONFIG_PKE_SUPPORT_ECC_BP256R=y -# CONFIG_PKE_SUPPORT_ECC_BP384R is not set -# CONFIG_PKE_SUPPORT_ECC_BP512R is not set -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -CONFIG_PKE_SUPPORT_SM2=y -# CONFIG_PKE_SUPPORT_SM2_SIGN is not set -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -# CONFIG_PKE_SUPPORT_SM2_CRYPTO is not set -# CONFIG_PKE_SUPPORT_RSA is not set -# CONFIG_PKE_SUPPORT_ECC_SIGN is not set -# CONFIG_PKE_SUPPORT_ECC_VERIFY is not set -# CONFIG_PKE_SUPPORT_ECC_ECDH is not set -# CONFIG_PKE_SUPPORT_ECC_GEN_KEY is not set -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -# CONFIG_ENTROPY_SOURCES_FROM_FRO is not set -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_SUPPORT_SINGLE_SPI is not set -CONFIG_SPI_NOT_SUPPORT_TEXAS_FORMAT=y -# CONFIG_SPI_SUPPORT_QUERY_REGS is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_TSENSOR is not set -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -CONFIG_UART_SUPPORT_TX_INT=y -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -# CONFIG_UART_SUPPORT_QUERY_REGS is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -# CONFIG_WATCHDOG_USING_V152 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set - -# -# osal -# - -# -# Config osal. -# -# CONFIG_DRIVER_DISABLE_OSAL_LOG is not set -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_FTM is not set -# CONFIG_MIDDLEWARE_SUPPORT_NV is not set -CONFIG_MIDDLEWARE_SUPPORT_UPG=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS=y -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS_ENCRY=y -CONFIG_MIDDLEWARE_SUPPORT_UPG_SAMPLE_VERIFY=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# CONFIG_MIDDLEWARE_SUPPORT_LFS is not set -# CONFIG_SUPPORT_CRASHINFO_SAVE_TO_FLASH is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# CONFIG_MIDDLEWARE_SUPPORT_TIOT is not set -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_MIDDLEWARE_SUPPORT_PM is not set -# CONFIG_MIDDLEWARE_SUPPORT_DFX is not set -# CONFIG_MIDDLEWARE_SUPPORT_AT is not set -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPDATE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# -CONFIG_AT_BLE=y - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# end of AT_BLE - -CONFIG_AT_GLE=y - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# CONFIG_RADAR_SERVICE is not set -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# end of Test diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_app.config b/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_app.config deleted file mode 100755 index 70d91b3..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_app.config +++ /dev/null @@ -1,640 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_btc_only.config b/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_btc_only.config deleted file mode 100755 index ebe257b..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_btc_only.config +++ /dev/null @@ -1,640 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_testsuite.config b/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_testsuite.config deleted file mode 100755 index 46676ba..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_freertos_testsuite.config +++ /dev/null @@ -1,657 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app.config deleted file mode 100755 index af7e250..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app.config +++ /dev/null @@ -1,747 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -# CONFIG_ENABLE_BT_SAMPLE is not set -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# CONFIG_LOADERBOOT_SUPPORT_EFUSE_BURN is not set -# CONFIG_LOADERBOOT_SUPPORT_FLASH_CHIP_ERASE is not set -# CONFIG_LOADERBOOT_SUPPORT_UPLOAD_DATA is not set -# CONFIG_LOADERBOOT_SUPPORT_READ_VERSION is not set -# CONFIG_LOADERBOOT_SUPPORT_SET_BUADRATE is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_DYNAMIC_UART_ID_BINDDING=y -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_WKUP_UART=1 -# CONFIG_PM_SUPPORT_POWER_EXCEPTION_DEBUG is not set -# CONFIG_PM_SUPPORT_SRV_DECOUPLING is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -CONFIG_AFE_SAMPLE_TIMES=4 -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -# CONFIG_DMA_SUPPORT_CIRCULAR_LLI is not set -CONFIG_DMA_SUPPORT_LPM=y -# CONFIG_DMA_SUPPORT_QUERY_REGS is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set -# CONFIG_DMA_USING_V150 is not set -CONFIG_SUPPORT_DATA_CACHE=y -# CONFIG_DMA_LLI_NODE_FIX_MEM is not set -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_SUPPORT_QUERY_REGS is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - -CONFIG_DRIVER_SUPPORT_I2S=y - -# -# I2S Configuration -# - -# -# Config I2S. User must choose one of master or slave at least, if support I2S. -# -CONFIG_I2S_BUS_MAX_NUM=1 -CONFIG_I2S_SUPPORT_LOOPBACK=y -# CONFIG_I2S_SUPPORT_DMA is not set -CONFIG_I2S_SCLK_PIN=13 -CONFIG_I2S_WS_PIN=14 -CONFIG_I2S_DO_PIN=15 -CONFIG_I2S_DI_PIN=16 -CONFIG_I2S_SCLK_PIN_MODE=35 -CONFIG_I2S_WS_PIN_MODE=36 -CONFIG_I2S_DO_PIN_MODE=37 -CONFIG_I2S_DI_PIN_MODE=38 -# CONFIG_I2S_SUPPORT_QUERY_REGS is not set -# CONFIG_SIO_USING_V150 is not set -# CONFIG_SIO_USING_V151 is not set -# end of I2S Configuration - -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration - -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -CONFIG_PWM_CHANNEL_NUM=6 -# CONFIG_PWM_PRELOAD is not set -# end of PWM Configuration - -# CONFIG_DRIVER_SUPPORT_RTC is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -# CONFIG_PKE_SUPPORT_ECC_FIPS_P384R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P521R is not set -CONFIG_PKE_SUPPORT_ECC_BP256R=y -# CONFIG_PKE_SUPPORT_ECC_BP384R is not set -# CONFIG_PKE_SUPPORT_ECC_BP512R is not set -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -# CONFIG_PKE_SUPPORT_SM2 is not set -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_SUPPORT_RWE_INDEPENDENT is not set -# CONFIG_SFC_SUPPORT_WRITE_PROTECT is not set -# CONFIG_SFC_USE_CUSTOMIZED_DEVICE_INFO is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_SUPPORT_SINGLE_SPI is not set -CONFIG_SPI_NOT_SUPPORT_TEXAS_FORMAT=y -# CONFIG_SPI_SUPPORT_QUERY_REGS is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -CONFIG_UART_SUPPORT_TX_INT=y -CONFIG_UART_SUPPORT_RX=y -CONFIG_SUPPORT_UART_POLL_TIMEOUT=y -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -# CONFIG_UART_SUPPORT_QUERY_REGS is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -# CONFIG_WATCHDOG_USING_V152 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017_CAT1 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set - -# -# osal -# - -# -# Config osal. -# -CONFIG_DRIVER_DISABLE_OSAL_LOG=y -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_SAMPLE_VERIFY is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# CONFIG_MIDDLEWARE_SUPPORT_LFS is not set -CONFIG_SUPPORT_CRASHINFO_SAVE_TO_FLASH=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# CONFIG_MIDDLEWARE_SUPPORT_TIOT is not set -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -CONFIG_PM_ENABLE_WAKEUP_INTERRUPT=y -# CONFIG_PM_SYS_SUPPORT is not set -CONFIG_PM_SYS_SUPPORT_MSGQUEUE=y -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -CONFIG_DFX_SUPPORT_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y - -# -# Config AT CFBB -# - -# -# Config AT CFBB -# -# CONFIG_AT_SUPPORT_LOG is not set -# CONFIG_AT_SUPPORT_CMD_ATTR is not set -# CONFIG_AT_SUPPORT_ASYNCHRONOUS is not set -# CONFIG_AT_SUPPORT_NOTIFY_REPORT is not set -CONFIG_AT_SUPPORT_ZDIAG=y -# end of Config AT CFBB -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPDATE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -# CONFIG_AT_BLE_SERVICE_UUID_CLIENT is not set -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -CONFIG_RADAR_SERVICE=y - -# -# radar -# - -# -# Config radar. -# -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Test diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app_iot.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app_iot.config deleted file mode 100644 index b538f72..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_app_iot.config +++ /dev/null @@ -1,683 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -CONFIG_ENABLE_WIFI_SAMPLE=y -# CONFIG_SAMPLE_SUPPORT_STA_SAMPLE is not set -# CONFIG_SAMPLE_SUPPORT_SOFTAP_SAMPLE is not set -CONFIG_SUPPORT_HILINK=y -# CONFIG_SUPPORT_UAPI is not set -# CONFIG_SAMPLE_SUPPORT_SYSCHANNEL_DEV is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_WKUP_UART=1 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -# CONFIG_PKE_SUPPORT_SM2 is not set -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set - -# -# osal -# - -# -# Config osal. -# -CONFIG_DRIVER_DISABLE_OSAL_LOG=y -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -CONFIG_MIDDLEWARE_SUPPORT_LFS=y -CONFIG_LFS_PARTITION_ID=48 -# CONFIG_LFS_ADAPT_DEBUG is not set -# CONFIG_LFS_ADAPT_WARN is not set -CONFIG_LFS_ADAPT_ERROR=y -CONFIG_SUPPORT_CRASHINFO_SAVE_TO_FLASH=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -CONFIG_DFX_SUPPORT_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y -CONFIG_AT_SUPPORT_ZDIAG=y -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -# CONFIG_AT_BLE_SERVICE_UUID_CLIENT is not set -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -#CONFIG_RADAR_SERVICE=y -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_bgle_all_asic.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_bgle_all_asic.config deleted file mode 100755 index 42b2ef8..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_bgle_all_asic.config +++ /dev/null @@ -1,646 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -# CONFIG_MIDDLEWARE_SUPPORT_NV is not set -CONFIG_MIDDLEWARE_SUPPORT_UPG=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# UPG Configurations for ws63 -# -# -# Config UPG -# -CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS=y -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -# end of UPG Configurations for ws63 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_btc_only_asic.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_btc_only_asic.config deleted file mode 100755 index d4a398b..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_btc_only_asic.config +++ /dev/null @@ -1,642 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_gle_sparklyzer.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_gle_sparklyzer.config deleted file mode 100755 index 8e005ee..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_gle_sparklyzer.config +++ /dev/null @@ -1,641 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_hilink.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_hilink.config deleted file mode 100755 index 6e006b6..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_hilink.config +++ /dev/null @@ -1,665 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -# CONFIG_ENABLE_BT_SAMPLE is not set -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -CONFIG_ENABLE_WIFI_SAMPLE=y -# CONFIG_SAMPLE_SUPPORT_STA_SAMPLE is not set -# CONFIG_SAMPLE_SUPPORT_SOFTAP_SAMPLE is not set -CONFIG_SUPPORT_HILINK=y -# CONFIG_SUPPORT_UAPI is not set -# CONFIG_SAMPLE_SUPPORT_SYSCHANNEL_DEV is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# CONFIG_LOADERBOOT_SUPPORT_EFUSE_BURN is not set -# CONFIG_LOADERBOOT_SUPPORT_UPLOAD_DATA is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_SUPPORT_QUERY_REGS is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -# end of PM Configuration - -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -CONFIG_PWM_CHANNEL_NUM=6 -# end of PWM Configuration - -# CONFIG_DRIVER_SUPPORT_RTC is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -# CONFIG_PKE_SUPPORT_SM2 is not set -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_SUPPORT_RWE_INDEPENDENT is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_SUPPORT_SINGLE_SPI is not set -CONFIG_SPI_NOT_SUPPORT_TEXAS_FORMAT=y -# CONFIG_SPI_SUPPORT_QUERY_REGS is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -# CONFIG_UART_SUPPORT_QUERY_REGS is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -# CONFIG_WATCHDOG_USING_V152 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017_CAT1 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set - -# -# osal -# - -# -# Config osal. -# -# CONFIG_DRIVER_DISABLE_OSAL_LOG is not set -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# CONFIG_MIDDLEWARE_SUPPORT_LFS is not set -# CONFIG_SUPPORT_CRASHINFO_SAVE_TO_FLASH is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# CONFIG_DFX_SUPPORT_PRINT is not set -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y - -# -# Config AT CFBB -# - -# -# Config AT CFBB -# -# CONFIG_AT_SUPPORT_LOG is not set -# CONFIG_AT_SUPPORT_CMD_ATTR is not set -# CONFIG_AT_SUPPORT_ASYNCHRONOUS is not set -# CONFIG_AT_SUPPORT_NOTIFY_REPORT is not set -# CONFIG_AT_SUPPORT_ZDIAG is not set -# end of Config AT CFBB -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# -CONFIG_AT_BLE=y - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# end of AT_BLE - -CONFIG_AT_GLE=y - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -CONFIG_RADAR_SERVICE=y - -# -# radar -# - -# -# Config radar. -# -# CONFIG_RADAR_DBG is not set -# CONFIG_RADAR_AI is not set -# CONFIG_RADAR_MFG is not set -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_mfg.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_mfg.config deleted file mode 100755 index adf2fae..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_mfg.config +++ /dev/null @@ -1,683 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -CONFIG_UART_SUPPORT_RX=y -CONFIG_UART_SUPPORT_RX_THREAD=y -CONFIG_UART_SUPPORT_RX_THREAD_STACK_SIZE=1024 -CONFIG_UART_SUPPORT_RX_THREAD_BUFFER_SIZE=8192 -CONFIG_UART_SUPPORT_RX_THREAD_PRIORITY=1 -# CONFIG_UART_SUPPORT_RX_THREAD_DEBUG is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_NOT_SUPPORT_RX_CONDITON_SIZE_OPTIMIZE=y -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# -# UPG Configurations for ws63 -# - -# -# Config UPG -# -CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS=y -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -# end of UPG Configurations for ws63 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -CONFIG_RADAR_SERVICE=y -CONFIG_RADAR_MFG=y -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_perf.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_perf.config deleted file mode 100755 index f95b94e..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_perf.config +++ /dev/null @@ -1,695 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_SRV_DECOUPLING=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -CONFIG_UART_SUPPORT_RX=y -CONFIG_UART_SUPPORT_RX_THREAD=y -CONFIG_UART_SUPPORT_RX_THREAD_STACK_SIZE=1024 -CONFIG_UART_SUPPORT_RX_THREAD_BUFFER_SIZE=8192 -CONFIG_UART_SUPPORT_RX_THREAD_PRIORITY=1 -# CONFIG_UART_SUPPORT_RX_THREAD_DEBUG is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_NOT_SUPPORT_RX_CONDITON_SIZE_OPTIMIZE=y -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set - -# -# osal -# - -# -# Config osal. -# -CONFIG_DRIVER_DISABLE_OSAL_LOG=y -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -CONFIG_RADAR_SERVICE=y -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite.config deleted file mode 100755 index f35c1b3..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite.config +++ /dev/null @@ -1,684 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_MEMORY_CUSTOMIZE_SEC=y -CONFIG_MEMORY_CUSTOMIZE_RSV=y -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_WKUP_UART=1 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_DMA_USING_V100=y -CONFIG_DMA_USING_V120=y -# CONFIG_DMA_USING_V150 is not set -# CONFIG_DMA_SUPPORT_SMDMA is not set -CONFIG_SUPPORT_DATA_CACHE=y -# CONFIG_DMA_LLI_NODE_FIX_MEM is not set -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration -CONFIG_DRIVER_SUPPORT_I2S=y - -# -# I2S Configuration -# - -# -# Config I2S. User must choose one of master or slave at least, if support I2S. -# -CONFIG_I2S_BUS_MAX_NUM=1 -CONFIG_I2S_SUPPORT_LOOPBACK=y -CONFIG_I2S_SUPPORT_DMA=y -# CONFIG_SIO_USING_V150 is not set -CONFIG_SIO_USING_V151=y -# end of I2S Configuration - -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration - -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -CONFIG_PWM_CHANNEL_NUM=6 -# end of PWM Configuration - -# CONFIG_DRIVER_SUPPORT_RTC is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -CONFIG_TSENSOR_MULTILEVEL=y -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -CONFIG_UART_SUPPORT_DMA=y -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -CONFIG_UART_SUPPORT_LPM=y -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017_CAT1 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_MIDDLEWARE_SUPPORT_PM is not set -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# -CONFIG_AT_BLE=y - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -CONFIG_AT_GLE=y - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x2000 -CONFIG_TEST_SUPPORT_SECURITY_UNIFIED=y -CONFIG_SECURITY_UNIFIED_SERVICE_TEST=y -# CONFIG_SECURITY_UNIFIED_DRV_TEST is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite_radar.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite_radar.config deleted file mode 100755 index 9f76a0f..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_testsuite_radar.config +++ /dev/null @@ -1,677 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_WKUP_UART=1 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -# CONFIG_PKE_SUPPORT_SM2 is not set -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS=y -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -CONFIG_RADAR_AI=y -CONFIG_RADAR_SERVICE=y -CONFIG_RADAR_DBG=y -CONFIG_RADAR_MFG=y -CONFIG_RADAR_MIPS=y -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_xts.config b/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_xts.config deleted file mode 100755 index 848ebc1..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_liteos_xts.config +++ /dev/null @@ -1,667 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -CONFIG_SAMPLE_ENABLE=y -CONFIG_ENABLE_BT_SAMPLE=y -# CONFIG_ENABLE_PERIPHERAL_SAMPLE is not set -# CONFIG_ENABLE_WIFI_SAMPLE is not set -# CONFIG_ENABLE_PRODUCTS_SAMPLE is not set -# CONFIG_ENABLE_RADAR_SAMPLE is not set -# CONFIG_ENABLE_NFC_SAMPLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_BGLE_RAM_SIZE_16K is not set -CONFIG_BGLE_RAM_SIZE_32K=y -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="${ROOT_DIR}/open_source/lwip/lwip_v2.1.3" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART_SUPPORT_PORTTING_IRQ=y -CONFIG_PM_SUPPORT_WKUP_UART=1 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_QUERY_REGS is not set -# CONFIG_ADC_USING_V151 is not set -# CONFIG_ADC_USING_V152 is not set -# CONFIG_ADC_USING_V153 is not set -CONFIG_ADC_USING_V154=y -# CONFIG_AFE_SAMPLE_TIMES is not set -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -# CONFIG_I2C_SUPPORT_SLAVE is not set -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=3000 -# CONFIG_I2C_SUPPORT_INT is not set -# CONFIG_I2C_SUPPORT_DMA is not set -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -# CONFIG_I2C_SUPPORT_CONCURRENCY is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -# CONFIG_I2C_ADDR_VALID_CHECK is not set -# end of I2C Configuration - - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=8 -# end of PWM Configuration -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -# CONFIG_SPACC_IRQ_ENABLE is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -# CONFIG_PKE_SUPPORT_ECC_CURVE_448 is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -# CONFIG_PKE_SUPPORT_SM2 is not set -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -# CONFIG_TSENSOR_MULTILEVEL is not set -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=6 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0=y -# CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0 is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_NV=y -CONFIG_MIDDLEWARE_NV_SUPPORT_HSO_ACCESS=y -CONFIG_PARTITION_FEATURE_SUPPORT=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_DISABLE_WDT is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_REBOOT=y -# CONFIG_MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER is not set -CONFIG_MIDDLEWARE_SUPPORT_LFS=y -CONFIG_LFS_PARTITION_ID=0x21 -CONFIG_LFS_ADAPT_DEBUG=n -CONFIG_LFS_ADAPT_WARN=n -CONFIG_LFS_ADAPT_ERROR=y -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -CONFIG_AT_SUPPORT_PLT=y -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# - -# -# host -# - -# -# Config bluetooth host. -# - -# -# AT_BLE -# - -# -# Config bluetooth host AT BLE. -# -# CONFIG_AT_BLE_LEVEL_ONE is not set -CONFIG_AT_BLE_LEVEL_TWO=y -CONFIG_AT_BLE_MODULE_GAP_COMMON=y -CONFIG_AT_BLE_MODULE_GAP_SLAVE=y -CONFIG_AT_BLE_MODULE_GAP_MASTER=y -CONFIG_AT_BLE_MODULE_GATT_CLIENT=y -CONFIG_AT_BLE_MODULE_GATT_SERVER=y -# CONFIG_AT_BLE_SERVICE_HID_MOUSE is not set -# CONFIG_AT_BLE_SERVICE_HID_KEYBOARD is not set -# CONFIG_AT_BLE_SERVICE_UUID_SERVER is not set -CONFIG_AT_BLE_SERVICE_UUID_CLIENT=y -CONFIG_AT_BLE_REGISTER_TEST=y -# CONFIG_AT_PTS_TEST_SUPPORT is not set -# end of AT_BLE - -# -# AT_GLE -# - -# -# Config bluetooth host AT GLE. -# -# CONFIG_AT_GLE_LEVEL_ONE is not set -CONFIG_AT_GLE_LEVEL_TWO=y -CONFIG_AT_GLE_MODULE_SSAPC=y -CONFIG_AT_GLE_MODULE_SSAPS=y -CONFIG_AT_GLE_MODULE_DD=y -CONFIG_AT_GLE_MODULE_CM=y -# CONFIG_AT_GLE_MODULE_SAMPLE is not set -# CONFIG_AT_GLE_MODULE_LOW_LATENCY is not set -# CONFIG_AT_GLE_MODULE_DFX_CONFIG is not set -CONFIG_AT_GLE_MODULE_TM_SIGNAL=y -# end of AT_GLE - -# -# FEATURE_GLE -# - -# -# Config bluetooth host GLE feature. -# -# CONFIG_FEATURE_GLE_LOW_LATENCY is not set -# CONFIG_FEATURE_GLE_HADM is not set -# end of FEATURE_GLE -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -CONFIG_RADAR_SERVICE=y -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_loaderboot.config b/build/config/target_config/ws63/menuconfig/acore/ws63_loaderboot.config deleted file mode 100755 index 668e12b..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_loaderboot.config +++ /dev/null @@ -1,533 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# CONFIG_SAMPLE_ENABLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_ECC_VERIFY is not set -# CONFIG_BOOT_SUPPORT_SM2_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA3072_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA4096_VERIFY is not set -# CONFIG_BOOT_SUPPORT_SOFT_VERIFY is not set -# CONFIG_FLASH_BOOT_SUPPORT_ROM_API is not set -# CONFIG_LOADERBOOT_SUPPORT_SW_HASH is not set -CONFIG_LOADERBOOT_SUPPORT_DYNAMIC_PACKET_SIZE=y -CONFIG_YMODEM_PACKET_BUFFER_SZIE=8192 -CONFIG_FLASH_WRITE_SIZE=8192 -CONFIG_BOOT_SUPPORT_SECURE_VERIFY=y - -# -# Boot Secure Verify Configuration -# - -# -# Boot secure verify -# -# end of Boot Secure Verify Configuration - -# CONFIG_BOOT_SUPPORT_PARTITION is not set -CONFIG_LOADERBOOT_SUPPORT_EFUSE_BURN=y -CONFIG_LOADERBOOT_SUPPORT_FLASH_CHIP_ERASE=y - -# -# Loaderboot Hash Configuration -# - -# -# Boot hash -# -# end of Loaderboot Hash Configuration - -CONFIG_LOADERBOOT_SUPPORT_UPLOAD_DATA=y -# CONFIG_LOADERBOOT_SUPPORT_READ_VERSION is not set -CONFIG_LOADERBOOT_SUPPORT_SET_BUADRATE=y -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# CONFIG_MEMORY_CUSTOMIZE_RSV is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="" -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -CONFIG_REG_WHITELIST=y -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -# CONFIG_UART_SUPPORT_PORTTING_IRQ is not set -CONFIG_PM_SUPPORT_WKUP_UART=1 -# CONFIG_PM_SUPPORT_POWER_EXCEPTION_DEBUG is not set -# CONFIG_PM_SUPPORT_SRV_DECOUPLING is not set -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_ADC is not set -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -# CONFIG_DMA_SUPPORT_CIRCULAR_LLI is not set -CONFIG_DMA_SUPPORT_LPM=y -# CONFIG_DMA_SUPPORT_QUERY_REGS is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set -# CONFIG_DMA_USING_V150 is not set -CONFIG_SUPPORT_DATA_CACHE=y -# CONFIG_DMA_LLI_NODE_FIX_MEM is not set -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -CONFIG_DRIVER_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config pm -# -CONFIG_PM_SUPPORT_CLOCK_CRG_API=y -# end of PM Configuration - -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -# CONFIG_PMP_USING_RISCV_31 is not set -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set -# CONFIG_DRIVER_SUPPORT_RTC is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_HASH is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_KM is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_PKE is not set -# CONFIG_ENTROPY_SOURCES_FROM_FRO is not set -# CONFIG_TRNG_RING_ENABLE is not set -# CONFIG_SM_EFUSE_CHECK is not set -# end of SECURITY_UNIFIED Configuration - -# CONFIG_DRIVER_SUPPORT_SFC is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_SUPPORT_SINGLE_SPI is not set -CONFIG_SPI_NOT_SUPPORT_TEXAS_FORMAT=y -# CONFIG_SPI_SUPPORT_QUERY_REGS is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -# CONFIG_DRIVER_SUPPORT_TSENSOR is not set -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -CONFIG_UART_SUPPORT_TX_INT=y -CONFIG_UART_SUPPORT_RX=y -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -# CONFIG_UART_NOT_SUPPORT_RX_CONDITON_SIZE_OPTIMIZE is not set -# CONFIG_UART_SUPPORT_QUERY_REGS is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -# CONFIG_WATCHDOG_USING_V152 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set - -# -# osal -# - -# -# Config osal. -# -# CONFIG_DRIVER_DISABLE_OSAL_LOG is not set -# end of osal -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# CONFIG_MIDDLEWARE_SUPPORT_TIOT is not set -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -CONFIG_PM_ENABLE_WAKEUP_INTERRUPT=y -# CONFIG_PM_SYS_SUPPORT is not set -CONFIG_PM_SYS_SUPPORT_MSGQUEUE=y -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# CONFIG_DFX_SUPPORT_PRINT is not set -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPDATE is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# CONFIG_RADAR_SERVICE is not set -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -# CONFIG_TEST_SUPPORT_TESTSUITE is not set -# end of Test diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_romboot.config b/build/config/target_config/ws63/menuconfig/acore/ws63_romboot.config deleted file mode 100755 index b425ec9..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_romboot.config +++ /dev/null @@ -1,269 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -CONFIG_BOOT_SUPPORT_ECC_VERIFY=y -# CONFIG_BOOT_SUPPORT_SM2_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA3072_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA4096_VERIFY is not set -CONFIG_BOOT_SUPPORT_SECURE_VERIFY=y - -# -# Boot Secure Verify Configuration -# - -# -# Boot secure verify -# -# end of Boot Secure Verify Configuration -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_RTC is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set -# CONFIG_DRIVER_SUPPORT_SFC is not set -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_ADC is not set -# CONFIG_DRIVER_SUPPORT_TSENSOR is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_UART is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# end of Testsuite Configuration -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# -# end of Protocol -CONFIG_UART0_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART1_SUPPORT_WRITE_MUTEX=1 -CONFIG_UART2_SUPPORT_WRITE_MUTEX=1 -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/acore/ws63_ssb.config b/build/config/target_config/ws63/menuconfig/acore/ws63_ssb.config deleted file mode 100755 index 17174d7..0000000 --- a/build/config/target_config/ws63/menuconfig/acore/ws63_ssb.config +++ /dev/null @@ -1,425 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# CONFIG_SAMPLE_ENABLE is not set -# CONFIG_SAMPLE_SUPPORT_BLINKY is not set -# CONFIG_SAMPLE_SUPPORT_BUTTON is not set -# CONFIG_SAMPLE_SUPPORT_SYSCHANNEL_DEV is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -CONFIG_BOOT_SUPPORT_ECC_VERIFY=y -# CONFIG_BOOT_SUPPORT_SM2_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA3072_VERIFY is not set -# CONFIG_BOOT_SUPPORT_RSA4096_VERIFY is not set -CONFIG_FLASH_BOOT_SUPPORT_ROM_API=y -CONFIG_BOOT_SUPPORT_SECURE_VERIFY=y - -# -# Boot Secure Verify Configuration -# - -# -# Boot secure verify -# -# end of Boot Secure Verify Configuration - -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# -# end of Boards - -# -# Chips -# -CONFIG_CHIP_WS63=y -# CONFIG_PRINTF_BUFFER_DYNAMIC is not set -CONFIG_UART0_BAUDRATE=115200 -CONFIG_UART1_BAUDRATE=921600 -CONFIG_UART2_BAUDRATE=115200 -CONFIG_DEBUG_UART=0 -CONFIG_DEBUG_UART_BAUDRATE=115200 -CONFIG_LOG_UART=1 -CONFIG_LOG_UART_BAUDRATE=921600 -CONFIG_AT_UART=0 -CONFIG_AT_UART_BAUDRATE=115200 -CONFIG_WVT_UART=2 -CONFIG_WVT_UART_BAUDRATE=115200 -CONFIG_TESTSUIT_UART=0 -CONFIG_TESTSUIT_UART_BAUDRATE=115200 -# -# Config the drivers of chips. -# -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -# CONFIG_DRIVER_SUPPORT_RTC is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=2 -CONFIG_GPIO0_WIDTH=32 -CONFIG_GPIO1_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_SEC is not set -# CONFIG_DRIVER_SUPPORT_SSI is not set -# CONFIG_DRIVER_SUPPORT_SYSTICK is not set -# CONFIG_DRIVER_SUPPORT_TCXO is not set -# CONFIG_DRIVER_SUPPORT_TIMER is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -# CONFIG_WATCHDOG_ALREADY_START is not set -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_DMA is not set -# CONFIG_DRIVER_SUPPORT_FLASH is not set -# CONFIG_DRIVER_SUPPORT_PINCTRL is not set -# CONFIG_DRIVER_SUPPORT_I2C is not set -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -# CONFIG_SPI_SUPPORT_MASTER is not set -# CONFIG_SPI_SUPPORT_SLAVE is not set -# CONFIG_SPI_SUPPORT_DMA is not set -# CONFIG_SPI_SUPPORT_INTERRUPT is not set -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_PWM is not set - -# CONFIG_DRIVER_SUPPORT_HASH is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_ADC is not set -# CONFIG_DRIVER_SUPPORT_TSENSOR is not set -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -# CONFIG_UART_BAUD_RATE_DIV_8 is not set -# CONFIG_UART_SUPPORT_TX is not set -# CONFIG_UART_SUPPORT_RX is not set -# CONFIG_UART_SUPPORT_DMA is not set -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_USB is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_PMP is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_HASH is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_KM is not set -# CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_SUPPORT_ECC_FIPS_P192R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P224R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P256R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P384R is not set -# CONFIG_PKE_SUPPORT_ECC_FIPS_P521R is not set -CONFIG_PKE_SUPPORT_ECC_BP256R=y -# CONFIG_PKE_SUPPORT_ECC_BP384R is not set -# CONFIG_PKE_SUPPORT_ECC_BP512R is not set -# CONFIG_PKE_SUPPORT_CURVE is not set -# CONFIG_PKE_SUPPORT_EDWARD is not set -CONFIG_PKE_SUPPORT_SM2=y -# CONFIG_PKE_SUPPORT_SM2_SIGN is not set -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -# CONFIG_PKE_SUPPORT_SM2_CRYPTO is not set -# CONFIG_PKE_SUPPORT_RSA is not set -# CONFIG_PKE_SUPPORT_ECC_SIGN is not set -# CONFIG_PKE_SUPPORT_ECC_VERIFY is not set -# CONFIG_PKE_SUPPORT_ECC_ECDH is not set -# CONFIG_PKE_SUPPORT_ECC_GEN_KEY is not set -# CONFIG_PKE_SUPPORT_ECC_CAL is not set -# CONFIG_PKE_SUPPORT_BIG_NUMBER is not set -# CONFIG_ENTROPY_SOURCES_FROM_FRO is not set -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -# CONFIG_SFC_SUPPORT_DMA is not set -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -# CONFIG_SFC_ALREADY_INIT is not set -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -# CONFIG_SFC_DEBUG is not set -# end of SFC Configuration - -# CONFIG_DRIVER_SUPPORT_PM is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -# CONFIG_DRIVER_SUPPORT_LITEOS is not set -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -# CONFIG_MIDDLEWARE_CHIP_WS53 is not set -CONFIG_MIDDLEWARE_CHIP_WS63=y -# CONFIG_MIDDLEWARE_SUPPORT_NV is not set -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_MIDDLEWARE_SUPPORT_FTM=y -CONFIG_MIDDLEWARE_SUPPORT_UPG=y - -# -# UPG Configurations for ws63 -# - -# -# Config UPG -# -# CONFIG_MIDDLEWARE_SUPPORT_UPG_COMPRESS is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG_AB is not set -# end of UPG Configurations for ws63 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -# CONFIG_MIDDLEWARE_SUPPORT_PM is not set -# CONFIG_MIDDLEWARE_SUPPORT_DFX is not set -# CONFIG_MIDDLEWARE_SUPPORT_AT is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt -# - -# -# Config bluetooth. -# -# end of bt - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x1000 -# end of Testsuite Configuration -# end of Test -CONFIG_DMA_SUPPORT_LLI=y -CONFIG_DMA_SUPPORT_LPM=y -CONFIG_SUPPORT_DATA_CACHE=y -CONFIG_DRIVER_SUPPORT_DMA=y -# CONFIG_DMA_SUPPORT_SMDMA is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set diff --git a/build/config/target_config/ws63/menuconfig/document/ws63_doxygen.config b/build/config/target_config/ws63/menuconfig/document/ws63_doxygen.config deleted file mode 100755 index ab92a77..0000000 --- a/build/config/target_config/ws63/menuconfig/document/ws63_doxygen.config +++ /dev/null @@ -1,678 +0,0 @@ -# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! - -# -# Main menu description, show how to use this configuration system. -# - -# -# Targets -# - -# -# Select the target. -# -# end of Targets - -# -# Application -# - -# -# Config the application. -# -# CONFIG_SAMPLE_ENABLE is not set -# end of Application - -# -# Bootloader -# - -# -# Config the bootloader. -# -# CONFIG_BOOT_SUPPORT_SEC is not set -# CONFIG_BOOT_SUPPORT_SECURE_VERIFY is not set -# CONFIG_BOOT_SUPPORT_PARTITION is not set -# end of Bootloader - -# -# Drivers -# - -# -# Config the drivers. -# - -# -# Boards -# - -# -# Config the drivers of boards. -# - -# -# Boards Configurations for ws63 -# - -# -# Config ws63 -# -# CONFIG_MEMORY_CUSTOMIZE_SEC is not set -# end of Boards Configurations for ws63 -# end of Boards - -# -# Chips -# - -# -# Config the drivers of chips. -# -# CONFIG_CHIP_WS53 is not set -CONFIG_CHIP_WS63=y - -# -# Chip Configurations for ws63 -# - -# -# Config ws63 -# -CONFIG_BGLE_RAM_SIZE_16K=y -# CONFIG_BGLE_RAM_SIZE_32K is not set -# CONFIG_BGLE_RAM_SIZE_64K is not set -CONFIG_RADAR_SENSOR_RX_MEM_8K=y -# CONFIG_RADAR_SENSOR_RX_MEM_16K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_24K is not set -# CONFIG_RADAR_SENSOR_RX_MEM_32K is not set -CONFIG_LWIP_COMPILE_PATH="" -CONFIG_PRINTF_BUFFER_DYNAMIC=y -CONFIG_DEBUG_UART=0 -CONFIG_LOG_UART=1 -CONFIG_AT_UART=0 -CONFIG_WVT_UART=2 -CONFIG_TESTSUIT_UART=0 -# end of Chip Configurations for ws63 -# end of Chips - -# -# Drivers -# - -# -# Config the drivers. -# -CONFIG_DRIVER_SUPPORT_ADC=y - -# -# ADC Configuration -# - -# -# Config ADC -# -CONFIG_ADC_SUPPORT_AUTO_SCAN=y -# CONFIG_ADC_SUPPORT_AFE is not set -# CONFIG_ADC_SUPPORT_LONG_SAMPLE is not set -# CONFIG_ADC_SUPPORT_DIFFERENTIAL is not set -# CONFIG_ADC_SUPPORT_AMIC is not set -CONFIG_ADC_SUPPORT_HAFE=y -CONFIG_AFE_SAMPLE_TIMES=3 -# end of ADC Configuration - -# CONFIG_DRIVER_SUPPORT_CAN_FD is not set -# CONFIG_DRIVER_SUPPORT_CPUTRACE is not set -CONFIG_DRIVER_SUPPORT_DMA=y - -# -# DMA Configuration -# - -# -# Config DMA -# -CONFIG_DMA_SUPPORT_LLI=y -# CONFIG_DMA_SUPPORT_LPM is not set -# CONFIG_DMA_USING_V100 is not set -# CONFIG_DMA_USING_V120 is not set -CONFIG_DMA_USING_V150=y -# CONFIG_SUPPORT_DATA_CACHE is not set -# CONFIG_DMA_LLI_NODE_FIX_MEM is not set -# end of DMA Configuration - -# CONFIG_DRIVER_SUPPORT_EDGE is not set -# CONFIG_DRIVER_SUPPORT_EFLASH is not set -CONFIG_DRIVER_SUPPORT_EFUSE=y - -# -# EFUSE Configuration -# - -# -# Config EFUSE -# -CONFIG_EFUSE_USING_V151=y -# CONFIG_EFUSE_SWITCH_EN is not set -CONFIG_EFUSE_REGION_NUM=1 -# end of EFUSE Configuration - -# CONFIG_DRIVER_SUPPORT_FLASH is not set -CONFIG_DRIVER_SUPPORT_GPIO=y - -# -# GPIO Configuration -# - -# -# Config GPIO -# -CONFIG_GPIO_SUPPORT_LPM=y -# CONFIG_GPIO_SELECT_CORE is not set -# CONFIG_GPIO_USING_V100 is not set -CONFIG_GPIO_USING_V150=y -CONFIG_GPIO_BANK_NUM=1 -CONFIG_GPIO0_WIDTH=32 -# end of GPIO Configuration - -# CONFIG_DRIVER_SUPPORT_HASH is not set -CONFIG_DRIVER_SUPPORT_I2C=y - -# -# I2C Configuration -# - -# -# Config I2C. User must choose one of master or slave at least, if support I2C. -# -CONFIG_I2C_SUPPORT_MASTER=y -CONFIG_I2C_SUPPORT_SLAVE=y -CONFIG_I2C_WAIT_CONDITION_TIMEOUT=0x3E8 -CONFIG_I2C_SUPPORT_INT=y -# CONFIG_I2C_SUPPORT_IN_CHIP_LOOPBACK is not set -CONFIG_I2C_SUPPORT_DMA=y -# CONFIG_I2C_SUPPORT_LPC is not set -# CONFIG_I2C_SUPPORT_LPM is not set -CONFIG_I2C_SUPPORT_CONCURRENCY=y -# CONFIG_I2C_SUPPORT_POLL_AND_DMA_AUTO_SWITCH is not set -# CONFIG_I2C_USING_V100 is not set -CONFIG_I2C_USING_V150=y -# CONFIG_I2C_USING_V151 is not set -CONFIG_I2C_ADDR_VALID_CHECK=y -# end of I2C Configuration - -# CONFIG_DRIVER_SUPPORT_I2S is not set -# CONFIG_DRIVER_SUPPORT_IPC is not set -# CONFIG_DRIVER_SUPPORT_KEYSCAN is not set -# CONFIG_DRIVER_SUPPORT_MEM_MONITOR is not set -# CONFIG_DRIVER_SUPPORT_MPU is not set -# CONFIG_DRIVER_SUPPORT_PCM is not set -# CONFIG_DRIVER_SUPPORT_PDM is not set -CONFIG_DRIVER_SUPPORT_PINCTRL=y - -# -# PINCTRL Configuration -# - -# -# Config PINCTRL -# -# CONFIG_PINCTRL_SUPPORT_LPM is not set -# CONFIG_PINCTRL_USING_V150 is not set -CONFIG_PINCTRL_USING_CHIPS=y -# CONFIG_PINCTRL_SUPPORT_IE is not set -# CONFIG_PINCTRL_SUPPORT_ST is not set -# end of PINCTRL Configuration - -# CONFIG_DRIVER_SUPPORT_PM is not set -CONFIG_DRIVER_SUPPORT_PMP=y - -# -# PMP Configuration -# - -# -# Config pmp -# -CONFIG_PMP_USING_RISCV_31=y -# CONFIG_PMP_USING_RISCV_70 is not set -# end of PMP Configuration - -CONFIG_DRIVER_SUPPORT_PWM=y - -# -# PWM Configuration -# - -# -# Config PWM -# -CONFIG_PWM_USING_V151=y -# CONFIG_PWM_USING_V150 is not set -CONFIG_PWM_GROUP_NUM=6 -CONFIG_PWM_CHANNEL_NUM=6 -# end of PWM Configuration - -CONFIG_DRIVER_SUPPORT_RTC=y - -# -# RTC Configuration -# - -# -# Config RTC -# -CONFIG_RTC_MAX_RTCS_NUM=16 -CONFIG_RTC_CLOCK_VALUE=32768 -# CONFIG_RTC_USING_OLD_VERSION is not set -# CONFIG_RTC_SUPPORT_LPM is not set -# CONFIG_RTC_USING_V100 is not set -CONFIG_RTC_USING_V150=y -CONFIG_RTC_MAX_NUM=5 -CONFIG_RTC_0_WIDTH_64=0 -CONFIG_RTC_1_WIDTH_64=0 -CONFIG_RTC_2_WIDTH_64=0 -CONFIG_RTC_3_WIDTH_64=0 -CONFIG_RTC_4_WIDTH_64=1 -# CONFIG_RTC_STOP_DELAY_SUPPORT is not set -# CONFIG_RTC_START_DELAY_SUPPORT is not set -# end of RTC Configuration - -# CONFIG_DRIVER_SUPPORT_SDIO is not set -# CONFIG_DRIVER_SUPPORT_SEC is not set -CONFIG_DRIVER_SUPPORT_SECURITY_UNIFIED=y - -# -# SECURITY_UNIFIED Configuration -# - -# -# Config security_unified -# -# CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP is not set -CONFIG_SECURITY_UNIFIED_SUPPORT_SYMC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_HASH=y -CONFIG_SPACC_IRQ_ENABLE=y -CONFIG_SECURITY_UNIFIED_SUPPORT_TRNG=y -CONFIG_SECURITY_UNIFIED_SUPPORT_KM=y -CONFIG_SECURITY_UNIFIED_SUPPORT_FAPC=y -CONFIG_SECURITY_UNIFIED_SUPPORT_PKE=y -# CONFIG_PKE_IRQ_ENABLE is not set -CONFIG_PKE_SUPPORT_ECC_FIPS_P192R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P224R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P256R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P384R=y -CONFIG_PKE_SUPPORT_ECC_FIPS_P521R=y -CONFIG_PKE_SUPPORT_ECC_BP256R=y -CONFIG_PKE_SUPPORT_ECC_BP384R=y -CONFIG_PKE_SUPPORT_ECC_BP512R=y -CONFIG_PKE_SUPPORT_CURVE=y -CONFIG_PKE_SUPPORT_ECC_CURVE_25519=y -CONFIG_PKE_SUPPORT_ECC_CURVE_448=y -CONFIG_PKE_SUPPORT_EDWARD=y -CONFIG_PKE_SUPPORT_ECC_ED25519=y -# CONFIG_PKE_SUPPORT_ECC_ED448 is not set -CONFIG_PKE_SUPPORT_SM2=y -CONFIG_PKE_SUPPORT_SM2_SIGN=y -CONFIG_PKE_SUPPORT_SM2_VERIFY=y -CONFIG_PKE_SUPPORT_SM2_CRYPTO=y -CONFIG_PKE_SUPPORT_RSA=y -CONFIG_PKE_SUPPORT_ECC_SIGN=y -CONFIG_PKE_SUPPORT_ECC_VERIFY=y -CONFIG_PKE_SUPPORT_ECC_ECDH=y -CONFIG_PKE_SUPPORT_ECC_GEN_KEY=y -CONFIG_PKE_SUPPORT_ECC_CAL=y -CONFIG_PKE_SUPPORT_BIG_NUMBER=y -CONFIG_ENTROPY_SOURCES_FROM_FRO=y -# CONFIG_TRNG_RING_ENABLE is not set -CONFIG_SM_EFUSE_CHECK=y -# end of SECURITY_UNIFIED Configuration - -CONFIG_DRIVER_SUPPORT_SFC=y - -# -# SFC Configuration -# - -# -# Config SFC -# -CONFIG_SFC_SUPPORT_DMA=y -# CONFIG_SFC_ALLOW_ERASE_WRITEBACK is not set -CONFIG_SFC_ALREADY_INIT=y -# CONFIG_SFC_SUPPORT_LPM is not set -# CONFIG_SFC_SUPPORT_SFC_LOCK is not set -# CONFIG_SFC_SUPPORT_DATA_CACHE is not set -CONFIG_SFC_DEBUG=y -# end of SFC Configuration - -CONFIG_DRIVER_SUPPORT_SPI=y - -# -# SPI Configuration -# - -# -# Config SPI -# -CONFIG_SPI_SUPPORT_MASTER=y -CONFIG_SPI_SUPPORT_SLAVE=y -CONFIG_SPI_SUPPORT_DMA=y -CONFIG_SPI_SUPPORT_INTERRUPT=y -# CONFIG_SPI_SUPPORT_CONCURRENCY is not set -# CONFIG_SPI_SUPPORT_LOOPBACK is not set -# CONFIG_SPI_SUPPORT_CRC is not set -CONFIG_SPI_MAX_TIMEOUT=0xFFFFFFFF -CONFIG_SPI_TXFTLR=1 -CONFIG_SPI_RXFTLR=1 -# CONFIG_SPI_SUPPORT_LPC is not set -# CONFIG_SPI_SUPPORT_LPM is not set -# CONFIG_SPI_USING_V100 is not set -CONFIG_SPI_USING_V151=y -# end of SPI Configuration - -# CONFIG_DRIVER_SUPPORT_SSI is not set -CONFIG_DRIVER_SUPPORT_SYSTICK=y - -# -# SYSTICK Configuration -# - -# -# Config SYSTICK -# -# CONFIG_SYSTICK_SUPPORT_LPM is not set -# end of SYSTICK Configuration - -CONFIG_DRIVER_SUPPORT_TCXO=y - -# -# TCXO Configuration -# - -# -# Config TCXO -# -# CONFIG_TCXO_SUPPORT_LPM is not set -# end of TCXO Configuration - -CONFIG_DRIVER_SUPPORT_TIMER=y - -# -# TIMER Configuration -# - -# -# Config TIMER -# -CONFIG_TIMER_MAX_TIMERS_NUM=16 -CONFIG_TIMER_CLOCK_VALUE=32000000 -# CONFIG_TIMER_SUPPORT_LPC is not set -# CONFIG_TIMER_USING_OLD_VERSION is not set -# CONFIG_TIMER_SUPPORT_LPM is not set -# CONFIG_TIMER_USING_V100 is not set -CONFIG_TIMER_USING_V150=y -CONFIG_TIMER_MAX_NUM=8 -CONFIG_TIMER_0_WIDTH_64=0 -CONFIG_TIMER_1_WIDTH_64=0 -CONFIG_TIMER_2_WIDTH_64=0 -CONFIG_TIMER_3_WIDTH_64=0 -CONFIG_TIMER_4_WIDTH_64=1 -CONFIG_TIMER_5_WIDTH_64=1 -CONFIG_TIMER_6_WIDTH_64=1 -CONFIG_TIMER_7_WIDTH_64=1 -# end of TIMER Configuration - -CONFIG_DRIVER_SUPPORT_TSENSOR=y - -# -# TSENSOR Configuration -# - -# -# Config TSENSOR -# -# CONFIG_TSENSOR_USING_V150 is not set -CONFIG_TSENSOR_USING_V151=y -CONFIG_TSENSOR_TEMP_COMPENSATION=y -CONFIG_TSENSOR_DELAY_TIME=1 -CONFIG_TSENSOR_WAIT_TIME_MS=5 -CONFIG_TSENSOR_MULTILEVEL=y -# end of TSENSOR Configuration - -CONFIG_DRIVER_SUPPORT_UART=y - -# -# Uart Configuration -# - -# -# Config uart -# -CONFIG_UART_BAUD_RATE_DIV_8=y -CONFIG_UART_SUPPORT_TX=y -CONFIG_UART_SUPPORT_RX=y -CONFIG_UART_SUPPORT_DMA=y -# CONFIG_UART_SUPPORT_FLOW_CTRL is not set -# CONFIG_UART_SUPPORT_LPM is not set -CONFIG_UART_FIFO_DEPTH=64 -# CONFIG_UART_SUPPORT_LPC is not set -# CONFIG_UART_NOT_SUPPORT_RX_CONDITON_SIZE_OPTIMIZE is not set -CONFIG_UART_DLF_SIZE=4 -# CONFIG_UART_USING_V120 is not set -CONFIG_UART_USING_V151=y -# CONFIG_UART_USING_V100 is not set -# CONFIG_UART_IP_VERSION_V151_PRO is not set -# CONFIG_UART_USING_LP_UART is not set -# end of Uart Configuration - -# CONFIG_DRIVER_SUPPORT_USB is not set -CONFIG_DRIVER_SUPPORT_WDT=y - -# -# Watchdog Configuration -# - -# -# Config watchdog -# -CONFIG_WATCHDOG_ALREADY_START=y -# CONFIG_WATCHDOG_SUPPORT_ULP_WDT is not set -# CONFIG_WATCHDOG_SUPPORT_LPM is not set -CONFIG_WATCHDOG_USING_V151=y -# CONFIG_WATCHDOG_USING_V100 is not set -CONFIG_WATCHDOG_USING_V151_RST_PL=7 -# end of Watchdog Configuration - -# CONFIG_DRIVER_SUPPORT_AUDIO is not set -# end of Drivers -# end of Drivers - -# -# Kernel -# - -# -# Config the kernel. -# -CONFIG_DRIVER_SUPPORT_LITEOS=y -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017_CAT1 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_6_0_B017 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0_B004 is not set -# CONFIG_DRIVER_SUPPORT_LITEOS_208_5_0 is not set -CONFIG_DRIVER_SUPPORT_LITEOS_207_0_0=y -# end of Kernel - -# -# Middleware -# - -# -# Config the middleware. -# - -# -# Chips -# - -# -# Config the middleware of chips. -# -CONFIG_MIDDLEWARE_CHIP_WS53=y -# CONFIG_MIDDLEWARE_CHIP_WS63 is not set - -# -# Chip Configurations for ws53 -# - -# -# Config ws53 -# -# CONFIG_MIDDLEWARE_SUPPORT_FTM is not set -# CONFIG_MIDDLEWARE_SUPPORT_NV is not set -# CONFIG_MIDDLEWARE_SUPPORT_UPG is not set -# end of Chip Configurations for ws53 -# end of Chips - -# -# Services -# - -# -# Config the middleware of service. -# -# end of Services - -# -# Utils -# - -# -# Config the middleware of utils. -# -CONFIG_MIDDLEWARE_SUPPORT_PM=y - -# -# PM Configuration -# - -# -# Config PM -# -CONFIG_PM_SLEEP_RECORD_ENABLE=y -CONFIG_PM_POWER_GATING_ENABLE=y -CONFIG_PM_VETO_TRACK_ENABLE=y -CONFIG_PM_LIGHT_SLEEP_THRESHOLD_MS=10 -CONFIG_PM_DEEP_SLEEP_THRESHOLD_MS=20 -CONFIG_PM_DEBUG=y -CONFIG_PM_FSM_TRACE_NUM=32 -CONFIG_PM_ENABLE_WAKEUP_INTERRUPT=y -# CONFIG_PM_SYS_SUPPORT is not set -CONFIG_PM_SYS_SUPPORT_MSGQUEUE=y -# end of PM Configuration - -CONFIG_MIDDLEWARE_SUPPORT_DFX=y - -# -# Design for Maintainable and Testable Configuration -# - -# -# Config DFM & DFT -# -CONFIG_DFX_SUPPORT_USERS_PRINT=y -# end of Design for Maintainable and Testable Configuration - -CONFIG_MIDDLEWARE_SUPPORT_AT=y - -# -# Config AT -# - -# -# Config AT -# -# CONFIG_AT_SUPPORT_PLT is not set -# end of Config AT - -# CONFIG_MIDDLEWARE_SUPPORT_CODEC is not set -# end of Utils -# end of Middleware - -# -# Protocol -# - -# -# Config the protocol. -# - -# -# bt_host -# - -# -# Config bluetooth. -# -# end of bt_host - -# -# bt_controller -# - -# -# Config bluetooth. -# -# end of bt_controller - -# -# nfc -# - -# -# Config nfc. -# -# end of nfc - -# -# wifi -# - -# -# Config wifi. -# -# end of wifi - -# -# radar -# - -# -# Config radar. -# -# end of radar -# end of Protocol - -# -# Test -# - -# -# Config the test. -# -CONFIG_TEST_SUPPORT_TESTSUITE=y - -# -# Testsuite Configuration -# - -# -# Config Testsuite -# -CONFIG_TEST_SUITE_FUNCTIONS_MAX_FUNCS=200 -CONFIG_TEST_CONSOLE_HISTORY_LEN=10 -CONFIG_TEST_SUITE_TASK_STACK_SIZE=0x800 -# CONFIG_TEST_SUPPORT_SECURITY_UNIFIED is not set -# end of Testsuite Configuration -# end of Test diff --git a/build/config/target_config/ws63/patch_config/acore.cfg b/build/config/target_config/ws63/patch_config/acore.cfg deleted file mode 100755 index 12e23f8..0000000 --- a/build/config/target_config/ws63/patch_config/acore.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址; 如果是短跳转, 必须 1K 对齐; 如果是长跳转, 必须 2K 对齐; -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -####end platform patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -lm_ble_adv_set_rpa_sed lm_ble_adv_set_rpa_sed_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch - -####start bth patch -####end bth patch \ No newline at end of file diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-app-iot.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-app-iot.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-app-iot.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-app.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-app.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-app.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-btc-only-asic.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-btc-only-asic.cfg deleted file mode 100755 index 4d384a2..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-btc-only-asic.cfg +++ /dev/null @@ -1,51 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch -####start wifi patch -####end wifi patch - -####start btc patch -dm_ble_generate_access_address dm_ble_generate_access_address_patch -lm_ble_scan_recv_extended_adv lm_ble_scan_recv_extended_adv_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-hilink.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-hilink.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-hilink.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-mfg.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-mfg.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-mfg.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-perf.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-perf.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-perf.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite-radar.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite-radar.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite-radar.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite.cfg deleted file mode 100755 index aab1974..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-testsuite.cfg +++ /dev/null @@ -1,39 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 -Patch_TBL_Address = 0x00000400 -Patch_TBL_Run_Address = 0x0014c000 -Table_Max_Size = 8 -Table_Reg_Size = 8 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -#max 192 patches -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start btc patch -####end btc patch - -####start bth patch -####end bth patch \ No newline at end of file diff --git a/build/config/target_config/ws63/patch_config/ws63-liteos-xts.cfg b/build/config/target_config/ws63/patch_config/ws63-liteos-xts.cfg deleted file mode 100755 index b055488..0000000 --- a/build/config/target_config/ws63/patch_config/ws63-liteos-xts.cfg +++ /dev/null @@ -1,84 +0,0 @@ -[Patch Info] -Device_Code_Version = Version1 - -Patch_Cpu_Core = APPLICATION - -Patch_File_Address = 0x00000000 - -# patch_remap table 在bin文件中的偏移地址 -Patch_TBL_Address = 0x00000400 - -# patch_remap table 实际的运行地址, 必须 1K 对齐 -Patch_TBL_Run_Address = 0x0014c000 - -# 如果这里配置为 4, 那 remap table 里只能存短跳指令, Patch_TBL_Run_Address 和 patch 函数地址间隔不能超过 1M -# 如果这里配置为 8, 1. init 时需要将 off_region 配置为 true; 2. 对 patch 函数地址则没有限制; -Table_Max_Size = 8 -Table_Reg_Size = 8 - -# patch 数量 = 指令 patch 的数量(192) + 数据 patch 的数量(2) -# 注意: drivers\chips\ws63\arch\riscv\riscv31\flash_patch.h 中的 RISCV31_PATCH_CMP_REG_NUM 宏单指 指令 patch 的数量 -# main.c 中的 PATCH_NUM 宏指 指令 patch + 数据 patch 的数量 -TABLE_REG_CONUT = 194 - -[ROM Info] -ROM_Address = 0x00109000 -ROM_Size = 0x00043000 - -[Output Info] -CMP_Bin_File = cmp.bin -TBL_Bin_File = tbl.bin -RW_Bin_File = patch.bin - -[Function] -####start platform patch -uapi_watchdog_enable uapi_watchdog_enable_patch -uapi_watchdog_kick uapi_watchdog_kick_patch -hal_sfc_v150_reg_write hal_sfc_v150_reg_write_patch -hal_sfc_v150_get_flash_id hal_sfc_v150_get_flash_id_patch -uapi_sfc_reg_read uapi_sfc_reg_read_patch -uapi_sfc_dma_read uapi_sfc_dma_read_patch -do_greedy_erase do_greedy_erase_patch -uapi_sfc_reg_write uapi_sfc_reg_write_patch -####end platform patch - -####start wifi patch -dmac_psm_process_tim_elm dmac_psm_process_tim_elm_patch -dmac_psm_tx_complete_sta dmac_psm_tx_complete_sta_patch -dmac_psm_max_powersave_enable dmac_psm_max_powersave_enable_patch -dmac_scan_channel_statistics_complete_continue dmac_scan_channel_statistics_complete_continue_patch -dmac_get_data_type_from_8023_etc dmac_get_data_type_from_8023_etc_patch -dmac_rx_prepare_data dmac_rx_prepare_data_patch -frw_thread_process_msg frw_thread_process_msg_patch -dmac_mac_error_handle dmac_mac_error_handle_patch -dmac_mac_error_process_event dmac_mac_error_process_event_patch -hh503_dispatch_trig_event_encap hh503_dispatch_trig_event_encap_patch -hh503_rx_alloc_netbuf_and_dscr hh503_rx_alloc_netbuf_and_dscr_patch -hal_rx_add_dscr hal_rx_add_dscr_patch -hal_rx_pre_add_dscr hal_rx_pre_add_dscr_patch -hal_get_tx_q_status_empty hal_get_tx_q_status_empty_patch -dmac_latency_trace_init_proc dmac_latency_trace_init_proc_patch -dmac_latency_stats_init_proc dmac_latency_stats_init_proc_patch -hal_gp_get_mpdu_count hal_gp_get_mpdu_count_patch -hal_get_tx_dscr_pn_msb hal_get_tx_dscr_pn_msb_patch -dmac_tx_complete_ampdu_buffer dmac_tx_complete_ampdu_buffer_patch -dmac_mgmt_switch_channel dmac_mgmt_switch_channel_patch -hal_set_mac_clken hal_set_mac_clken_patch -hh503_clear_rx_pn hh503_clear_rx_pn_patch -hh503_enable_ce hh503_enable_ce_patch -dmac_tx_get_txop_alg dmac_tx_get_txop_alg_patch -dmac_tx_get_baw_remain_num dmac_tx_get_baw_remain_num_patch -alg_tpc_tx_query_vap_special alg_tpc_tx_query_vap_special_patch -dmac_config_tx_addba_rsp_lut_proc dmac_config_tx_addba_rsp_lut_proc_patch -alg_ar_get_phy_protocol_by_rate_info alg_ar_get_phy_protocol_by_rate_info_patch -frw_free_msg_node frw_free_msg_node_patch -hh503_pow_set_user_resp_frm_phy_tx_mode hh503_pow_set_user_resp_frm_phy_tx_mode_patch -hal_device_handle_idle_vap_down hal_device_handle_idle_vap_down_patch -hal_recover_machw_phy_and_pa hal_recover_machw_phy_and_pa_patch -####end wifi patch - -####start btc patch -evt_task_ble_acl_refresh_next_peripheral_time evt_task_ble_acl_refresh_next_peripheral_time_patch -evt_task_ble_adv_set_intv evt_task_ble_adv_set_intv_patch -evt_task_ble_acl_process_rx_content_isr evt_task_ble_acl_process_rx_content_isr_patch -####end btc patch diff --git a/build/config/target_config/ws63/script/copy_files_to_interim.py b/build/config/target_config/ws63/script/copy_files_to_interim.py deleted file mode 100755 index 87ca8a1..0000000 --- a/build/config/target_config/ws63/script/copy_files_to_interim.py +++ /dev/null @@ -1,51 +0,0 @@ - - -import argparse -import os -import shutil - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="copy_files_to_interim") - parser.add_argument('proj_root_dir', help="proj root dir") - - args = parser.parse_args() - - proj_root_dir = args.proj_root_dir - - target_dir = os.path.join(proj_root_dir, "interim_binary", "ws63", "bin", "boot_bin") - if not os.path.isdir(target_dir): - os.makedirs(target_dir) - - hilink_target_dir = os.path.join(proj_root_dir, "interim_binary", "ws63", "bin", "hilink_bin") - if not os.path.isdir(hilink_target_dir): - os.makedirs(hilink_target_dir) - - # key is src file, value is dest file or dir - copy_map = { - 'output/ws63/acore/ws63-loaderboot/loaderboot.bin' : target_dir, - 'output/ws63/acore/ws63-loaderboot/root_loaderboot_sign.bin' : target_dir, - 'output/ws63/acore/ws63-liteos-app/efuse_cfg.bin' : target_dir, - 'output/ws63/acore/ws63-ssb/ssb.bin' : target_dir, - 'output/ws63/acore/ws63-ssb/ssb_sign.bin' : target_dir, - 'output/ws63/acore/ws63-flashboot/flashboot.bin' : target_dir, - 'output/ws63/acore/ws63-flashboot/flashboot_sign.bin' : target_dir, - 'output/ws63/acore/ws63-flashboot/flashboot_backup_sign.bin' : target_dir, - 'output/ws63/acore/ws63-liteos-hilink/ws63-liteos-hilink.bin' : hilink_target_dir, - 'output/ws63/acore/ws63-liteos-hilink/ws63-liteos-hilink-sign.bin' : hilink_target_dir, - } - - for src_file, dest in copy_map.items(): - src_file = os.path.join(proj_root_dir, src_file) - if not os.path.isfile(src_file): - print(f'[!][copy_files_to_interim] File `{src_file}` not found, will skip it !') - continue - filename = src_file.split('/')[-1] - if dest != hilink_target_dir and not os.path.isfile(os.path.join(dest, filename)): - continue - try: - shutil.copy(src_file, dest) - except BaseException as e: - print(e) - exit(-1) - \ No newline at end of file diff --git a/build/config/target_config/ws63/script/efuse.csv b/build/config/target_config/ws63/script/efuse.csv deleted file mode 100755 index 2b965e7..0000000 --- a/build/config/target_config/ws63/script/efuse.csv +++ /dev/null @@ -1,2 +0,0 @@ -burn,name,start_bit,bit_width,value,lock -0,CHIP_ID,0,8,0x00000000,PG0 diff --git a/build/config/target_config/ws63/script/efuse_cfg_gen.py b/build/config/target_config/ws63/script/efuse_cfg_gen.py deleted file mode 100755 index c381cf7..0000000 --- a/build/config/target_config/ws63/script/efuse_cfg_gen.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -import csv -import struct -import hashlib -import os -import re -from sys import version_info - -def str_to_hex(s): - return ' '.join([hex(ord(c)).replace('0x', '') for c in s]) - -def print_bytes(bytes): - if version_info.major == 3: - c = bytes.hex() - print(c) - else: - c = bytes.encode('hex') - print(c) - -number = 0 -value_len = 0 -buf = b'' -csv_dir = os.path.split(os.path.realpath(__file__))[0] -csv_path = os.path.join(csv_dir, "efuse.csv") -bin_path = os.path.join(csv_dir + "/../../../../../output/ws63/acore/ws63-liteos-app/", 'efuse_cfg.bin') - -def get_flash_key_param(): - cfg_file = os.path.join(csv_dir + "/../", 'sign_config', 'encry_config.cfg') - file1 = open(cfg_file) - omrk1="" - for line in file1: - rs = re.search("Omrk1=", line) - if rs: - omrk1 = line[6:-1] - if omrk1 == "": - raise Exception("ERR: get_flash_key_param err, omrk1 is null", cfg_file) - result = "" - for i in range(0, len(omrk1), 4): - result += (" " + omrk1[i:i+4]) - line = ''.join(result[1:].split(" ")[::-1]) - result = "" - for i in range(0, len(line), 8): - result += (" 0x" + line[i+4:i+8] + line[i:i+4]) - file1.close() - return result[1:] - -def get_root_key_hash(): - cfg_file = os.path.join(csv_dir + "/../", 'sign_config', 'root_pubk.bin.hash') - file1 = open(cfg_file) - line = file1.readline() - if line == "": - raise Exception("ERR: get_root_key_hash err, hash is null", cfg_file) - result = "" - for i in range(0, len(line), 8): - result += (" 0x" + line[i+6:i+8] + line[i+4:i+6] + line[i+2:i+4] + line[i:i+2]) - file1.close() - return result[1:] - -def del_old_csv_key(): - with open(csv_path, 'r') as file1: - lines = list(csv.reader(file1)) - for line in lines[::-1]: - if 'sec_verify_enable' in line: - lines.remove(line) - elif 'otp_oem_mrk' in line: - lines.remove(line) - elif 'root_key_hash' in line: - lines.remove(line) - with open(csv_path, 'w') as file2: - writer = csv.writer(file2) - writer.writerows(lines) - -def read_cfg_value(cfg_file, key): - with open(cfg_file) as f: - for line in f: - if not line.startswith('#') and '=' in line: - k, v = line.split('=') - if k.strip() == key: - return v.strip() - return None - -def set_new_csv_key(): - efuse_file = open(csv_path, 'a+', newline='') - root_pubk = os.path.join(csv_dir + "/../", 'sign_config', 'root_pubk.bin.hash') - cfg_file = os.path.join(csv_dir + "/../", 'sign_config', 'flash_bin_ecc.cfg') - sen_en = read_cfg_value(cfg_file, 'SignSuite') - # 安全启动开关&根公钥hash - if os.path.exists(root_pubk) and sen_en == '0': - sec_en = "\n1,sec_verify_enable,960,1,0x1,PG0" - root_key_hash = "\n1,root_key_hash,672,256,", get_root_key_hash() ,",PG5" - efuse_file.writelines(sec_en) - efuse_file.writelines(root_key_hash) - - cfg_file = os.path.join(csv_dir + "/../", 'sign_config', 'liteos_app_bin_ecc.cfg') - encry_en = read_cfg_value(cfg_file, 'SignSuite') - PlainKey = read_cfg_value(cfg_file, 'PlainKey') - demo = '8ABDA082DB74753577FF2D1E7D79DAC7' - # flash加密秘钥 - if encry_en == '1' and PlainKey != demo: - flash_key = "\n1,otp_oem_mrk,352,128,", get_flash_key_param() ,",PG3" - efuse_file.writelines(flash_key) - efuse_file.close() - -def del_null_rows(): - with open(csv_path, 'r') as file1: - reader = csv.reader(file1) - rows = [row for row in reader] - rows = [row for row in rows if any(row)] - with open(csv_path, 'w', newline='') as file2: - writer = csv.writer(file2) - writer.writerows(rows) - -def set_key_to_eufse(): - if os.path.exists(csv_path): - del_old_csv_key() - set_new_csv_key() - del_null_rows() - - -set_key_to_eufse() - -# 用reader读取csv文件 -#Use the reader to read the CSV file. -with open(csv_path, 'r') as csvFile: - reader = csv.reader(csvFile) - for line in reader: - if line and (line[0] == "1"): - size = int(line[3]) - if (size <= 32): - value_len = 4 - elif (size <= 64): - value_len = 8 - else: - value_len = size // 8 - result = struct.pack('BBHHH', 0, 8, int(line[2]), size, value_len) - value_str = line[4] - value_list = value_str.split(" ") - value_struct = b'' - for i in range(value_len // 4): - value = int(value_list[i], 16) - value_struct = value_struct + struct.pack('I', value) - print_bytes(value_struct) - buf = buf + result + value_struct - number = number + 1 -header = struct.pack('BBHIII', 0, 48, number, len(buf) + 48, 0, 0) -data = header + buf -data_len = len(data) -print("data size: ", data_len) -if data_len % 64 != 0: - max_size = int((data_len / 64)+1) * 64 - if data_len < max_size: - data = data + bytes([0] * int(max_size - data_len)) -print("finally size: ", len(data)) - -hash = hashlib.sha256(data).digest() -bin_data = hash + data - -with open(bin_path, 'wb+') as f: - f.write(bin_data) diff --git a/build/config/target_config/ws63/script/entry.py b/build/config/target_config/ws63/script/entry.py deleted file mode 100755 index df19656..0000000 --- a/build/config/target_config/ws63/script/entry.py +++ /dev/null @@ -1,270 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import json -import sys -import platform -import subprocess -import shutil -import re - -from utils.build_utils import root_path, exec_shell, compare_bin, output_root -from utils.indie_upgrade_utils import make_indie_upg_src, dump_indie_upg_check_file - -from typing import Dict, Any - - -SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) - -def do_cmd(target_name: str, hook_name: str, env: Dict[str, Any])->bool: - python_path = sys.executable - print("python path: ", python_path) - - # 生成接口映射表 - if hook_name == 'build_pre' and "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" in env.get("defines"): - if not make_indie_upg_src(): - return False - - - # sdk中执行sample的编译守护 - if hook_name == 'build_pre' and env.get('build_type', '') == 'GuardSDKSample': - print("==================env==================") - for k, v in env.items(): - print(f"{k}:{v}") - print("==================env==================") - # 生成sdk - build_sdk() - # 切换当前工作目录 - cwd = os.getcwd() - in_sdk_root = os.path.join(output_root,'package', 'ws63','sdk') - os.chdir(in_sdk_root) - # 在sdk中按设定的menuconfig配置编译 - guard_sample(target_name, env) - - os.chdir(cwd) - - if target_name == "ws63-liteos-msmart" and hook_name == 'build_pre': # 源码编译 - print("info: start build ws63-liteos-app for msmart in source.") - module_handle_script_path = os.path.join(root_path, "application", "samples", "custom", "ws63", "msmart", "build_module.py") - errcode = exec_shell([python_path, module_handle_script_path], None, True) - return True - - if target_name == "ws63-liteos-app" and not config_check(root_path, "ws63-liteos-msmart") and os.path.isfile(os.path.join(root_path, "application", "samples", "custom", "ws63", "msmart", "build_module.py")) and hook_name == 'build_pre': - # SDK 编译 msmart - print("info: start build ws63-liteos-app for msmart in SDK.") - module_handle_script_path = os.path.join(root_path, "application", "samples", "custom", "ws63", "msmart", "build_module.py") - errcode = exec_shell([python_path, module_handle_script_path], None, True) - return True - - target_array = ['ws63-flashboot', 'ws63-loaderboot'] - - if not os.path.isfile(os.path.join(root_path, "output", "ws63", "acore", "boot_bin", "flashboot.bin")) and target_name not in target_array and hook_name == 'build_pre': - print("flashboot start build .....") - errcode = exec_shell([python_path, 'build.py', 'ws63-flashboot'], None, True) - - if not os.path.isfile(os.path.join(root_path, "output", "ws63", "acore", "boot_bin", "loaderboot.bin")) and target_name not in target_array and hook_name == 'build_pre': - print("loaderboot start build .....") - errcode = exec_shell([python_path, 'build.py', 'ws63-loaderboot'], None, True) - - if hook_name == 'build_pre': - return True - - if target_name == 'ws63-liteos-app' and root_path.endswith('output/sdk') and hook_name == 'build_post': - print("start build ws63-liteos-app-haier target") - # 海尔代码编译 - build_haier_script = os.path.join(root_path, '../../application/samples/custom/ws63/haier/boards/HI3863/GCC/build.sh') - errcode = subprocess.run(['bash', build_haier_script]) - if errcode.returncode != 0: - print("run build.sh failed!") - sys.exit(1) - # 拷贝海尔编译结果 - src_folder = os.path.join(root_path, '../../application/samples/custom/ws63/haier/boards/HI3863/GCC/libs/libhrapplication.a') - dest_folder = os.path.join(root_path, '../../application/samples/custom/ws63/haier/boards/HI3863/sdk/application/ws63-liteos-app/libhrapplication.a') - shutil.copyfile(src_folder, dest_folder) - # 编译最终fwpkg - build_app_script = os.path.join(root_path, '../../application/samples/custom/ws63/haier/boards/HI3863/sdk/build.py') - errcode = exec_shell(['python3', build_app_script, "-c", "ws63-liteos-app"], None, True) - if errcode != 0: - print("build ws63-liteos-app-haier target failed!") - sys.exit(1) - # 拷贝最终编译结果到package目录 - dest_folder = os.path.join(root_path, '../package/ws63/ws63_haier') - if os.path.exists(dest_folder): - print("ws63-liteos-app-haier exist") - return True - src_folder = os.path.join(root_path, '../../application/samples/custom/ws63/haier/boards/HI3863/sdk/output/ws63') - shutil.copytree(src_folder, dest_folder) - print("end build ws63-liteos-app-haier target") - return True - - if target_name == 'ws63-liteos-mfg' and hook_name == 'build_post': - errcode = exec_shell([python_path, "build.py", "ws63-liteos-app"], None, True) - return True - - if hook_name != 'build_post': - return True - - if env.get('gen_mem_bin'): - script_path = os.path.join(SCRIPT_DIR, 'get_mem_bin.sh') - print("gen_mem_bin ing...") - errcode = exec_shell(['bash', script_path, root_path, target_name, env.get('bin_name')], None, True) - if errcode != 0: - print("gen_mem_bin failed!") - return False - print("gen_mem_bin done!") - - if env.get('generate_efuse_bin'): - copy_py = os.path.join(SCRIPT_DIR, 'efuse_cfg_gen.py') - print("generate_efuse_bin ing...") - errcode = exec_shell([sys.executable, copy_py], None, True) - if errcode != 0: - print("generate_efuse_bin failed!") - return False - shutil.copy(os.path.join(root_path, 'output/ws63/acore/ws63-liteos-app/efuse_cfg.bin'), os.path.join(root_path, 'output/ws63/acore/boot_bin')) - print("generate_efuse_bin done!") - - if env.get('copy_files_to_interim'): - # copy_files_to_interim - copy_py = os.path.join(SCRIPT_DIR, 'copy_files_to_interim.py') - print("copy_files_to_interim ing...") - errcode = exec_shell([sys.executable, copy_py, root_path], None, True) - if errcode != 0: - print("copy_files_to_interim failed!") - return False - print("copy_files_to_interim done!") - - if "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" in env.get("defines"): - dump_indie_upg_check_file(os.path.join(root_path, "output", "ws63", "acore", target_name), target_name) - - if env.get('pke_rom_bin'): - # gen pke_rom_bin - gen_pke_rom_bin_sh = os.path.join(SCRIPT_DIR, 'pke_rom.sh') - if os.path.exists(os.path.join(root_path, \ - 'drivers/chips/ws63/rom/rom_boot/drivers/drivers/hal/security_unified/hal_cipher/pke/rom_lib.c')): - print("generate pke_rom_bin ing...") - errcode = exec_shell(['sh', gen_pke_rom_bin_sh, root_path], None, True) - if errcode != 0: - print("generate pke_rom_bin failed!") - return False - print("generate pke_rom_bin done!") - - # verify pke rom bin - if env.get('fixed_pke'): - bin1 = os.path.join(root_path, "output", env.get('chip'), env.get('core'), 'pke_rom', 'pke_rom.bin') - bin2 = env.get('fixed_pke_path', '').replace('', root_path) - if not compare_bin(bin1, bin2): - print(f"Verify pke rom bin ERROR! :{bin1} is not same with {bin2}") - return False - - if env.get('rom_in_one'): - # gen rom_in_one - if "windows" in platform.platform().lower(): - rom_in_one = os.path.join(SCRIPT_DIR, 'rom_in_one.py') - print("generate rom_in_one ing...") - errcode = exec_shell([python_path, rom_in_one, root_path, env.get('bin_name')], None, True) - else: - rom_in_one = os.path.join(SCRIPT_DIR, 'rom_in_one.sh') - print("generate rom_in_one ing...") - errcode = exec_shell(['sh', rom_in_one, root_path, env.get('bin_name')], None, True) - - if errcode != 0: - print("generate rom_in_one failed!") - return False - print("generate rom_in_one done!") - - # verify codepoint bin - bin1 = os.path.join(root_path, "output", env.get('chip'), env.get('core'), \ - target_name, env.get('bin_name')+'_rompack.bin') - if env.get('fixed_rom_in_one') and os.path.isfile(bin1):# only rompack bin exists - bin2 = env.get('fixed_rom_in_one_path', '').replace('', root_path) - if not compare_bin(bin1, bin2): - print(f"Verify rom_in_one bin ERROR! :{bin1} is not same with {bin2}") - return False - - if env.get('fixed_bin_name'): - bin1 = os.path.join(root_path, "output", env.get('chip'), env.get('core'), \ - target_name, env.get('fixed_bin_name')) - bin2 = env.get('fixed_bin_path', '').replace('', root_path) - if not compare_bin(bin1, bin2): - print(f"Verify bin ERROR! :{bin1} is not same with {bin2}") - return False - nv_handle = os.path.join(SCRIPT_DIR, 'nv_handle.py') - exec_shell([python_path, nv_handle], None, True) - return True - - -def config_check(root_path, target_name): - config_file_path = os.path.join(root_path, "build", "config", "target_config", "ws63", "config.py") - with open(config_file_path, "r", encoding="utf-8") as f: - for i in f: - if target_name in i: - print(target_name, " in config.py.") - return True - return False - - -def build_sdk(): - if os.path.isdir(output_root): - shutil.rmtree(output_root) - errcode = exec_shell(["python3", "build.py", "pack_ws63_sdk"], None, True) - if errcode != 0: - print(f"build target pack_ws63_sdk failed!") - sys.exit(1) - else: - print(f"build target pack_ws63_sdk success!") - - -def guard_sample(target_name, env): - cfg_dir = os.path.dirname(SCRIPT_DIR) - build_target = env.get('build_target', '') - build_target_cop = build_target.replace('-', "_") - in_sdk_root = os.path.join(output_root, 'package', 'ws63','sdk') - in_sdk_menuconfig_dir = os.path.join(in_sdk_root, 'build', 'config','target_config', env.get('chip'), 'menuconfig', env.get('core')) - base_cfg_path = os.path.join(in_sdk_menuconfig_dir, f'{build_target_cop}.config') - base_cfg_path_bak = base_cfg_path + ".bak" - shutil.move(base_cfg_path, base_cfg_path_bak) - in_sdk_output_root = os.path.join(in_sdk_root, 'output') - source_fwpkg_dir = os.path.join(in_sdk_output_root, env.get('chip'), 'fwpkg', f'{build_target}') - dest_fwpkg_dir = os.path.join(in_sdk_output_root, env.get('chip'), 'GuardSample', target_name) - os.makedirs(dest_fwpkg_dir, exist_ok=True) - # 汇总结果,编译sample是否成功 - build_result_content = [] - build_result_log_path = os.path.join(dest_fwpkg_dir, "build_result.log") - - for cfg_path in env.get('menuconfigs', []): - cfg_base_name = os.path.splitext(os.path.basename(cfg_path))[0] - cfg_full_path = os.path.join(cfg_dir, cfg_path) - if not os.path.isfile(cfg_full_path): - continue - shutil.copyfile(cfg_full_path, base_cfg_path) - errcode = exec_shell(["python3", "build.py", "-c", build_target], None, True) - if errcode != 0: - print(f"build target:{target_name}\tusing menuconfig:{cfg_full_path} failed!") - build_result_content.append(f"[ERROR] build target:{target_name}\tusing menuconfig:{cfg_full_path} failed!") - else: - print(f"build target:{target_name}\tusing menuconfig:{cfg_full_path} success!") - build_result_content.append(f"[INFO] build target:{target_name}\tusing menuconfig:{cfg_full_path} success!") - - all_in_one_fwpkg_path = os.path.join(source_fwpkg_dir, f'{build_target}_all.fwpkg') - if os.path.isfile(all_in_one_fwpkg_path): - dest_fwpkg = os.path.join(dest_fwpkg_dir, f'{cfg_base_name}_all.fwpkg') - shutil.copyfile(all_in_one_fwpkg_path, dest_fwpkg) - else: - print(f"not find {all_in_one_fwpkg_path}!") - build_result_content.append(f"[ERROR] not find {all_in_one_fwpkg_path}!") - continue - - load_only_fwpkg_path = os.path.join(source_fwpkg_dir,f'{build_target}_load_only.fwpkg') - if os.path.isfile(load_only_fwpkg_path): - dest_fwpkg = os.path.join(dest_fwpkg_dir, f'{cfg_base_name}_load_only.fwpkg') - shutil.copyfile(load_only_fwpkg_path, dest_fwpkg) - else: - print(f"not find {load_only_fwpkg_path}!") - build_result_content.append(f"[ERROR] not find {load_only_fwpkg_path}!") - with open(build_result_log_path, 'w') as w_f: - w_f.write("\r\n".join(build_result_content)) - shutil.move(base_cfg_path_bak, base_cfg_path) - print(f"fwpkg is created in :{dest_fwpkg_dir}") - os._exit(0) \ No newline at end of file diff --git a/build/config/target_config/ws63/script/get_mem_bin.sh b/build/config/target_config/ws63/script/get_mem_bin.sh deleted file mode 100755 index 41673d1..0000000 --- a/build/config/target_config/ws63/script/get_mem_bin.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -set -e - -ROOT_PATH=$(realpath $1) -TARGET_NAME=$2 -BIN_NAME=$3 - -ELF_PATH=${ROOT_PATH}/output/ws63/acore/${TARGET_NAME}/${BIN_NAME}.elf -TOOLCHAIN=${ROOT_PATH}/tools/bin/compiler/riscv/cc_riscv32_musl_105/cc_riscv32_musl_fp/bin/riscv32-linux-musl- -WORK_DIR=${ROOT_PATH}/output/ws63/mem_bins -MEMFILE=${ROOT_PATH}/output/ws63/acore/${TARGET_NAME}/${BIN_NAME}.mem -SRAM_PKT_RAM=${ROOT_PATH}/output/ws63/mem_bins/sram_pkt_ram.bin -SRAM_ALL=${ROOT_PATH}/output/ws63/mem_bins/SRAM_START_ADDR_0xA00000.bin -SRAM=${ROOT_PATH}/output/ws63/mem_bins/sram.bin - -OBJCOPY=${TOOLCHAIN}objcopy -READELF=${TOOLCHAIN}readelf - -get_section_meminfo(){ - local elf_path=$1 - local section_name=$2 - - ${READELF} -S ${elf_path}|grep " ${section_name} "|awk '{if($1=="["){print $5,$6,$7,$4}else{print $4,$5,$6,$3}}' -} - -get_mem_sections(){ - local memfile=$1 - local mem_name=$2 - - cat ${memfile} | grep -Pzo "(?s)\n\s*${mem_name}.+?\n\s*\n"|awk '{print $1}'|grep -aP "^\." -} - -gen_section_to_bin(){ - local elf_path=$1 - local section_name_list=($(echo $2)) - local first_section_name=$3 - local output_bin_path=$4 - local mem_info - local params=() - local lma - local first_mem_info=($(get_section_meminfo $elf_path $first_section_name)) - - for section_name in ${section_name_list[@]};do - if [ "$section_name" = "$first_section_name" ];then - params+="-j ${first_section_name} --change-section-lma=${first_section_name}=0 " - if [ "${first_mem_info[3]}" = "NOBITS" ];then - params+="--set-section-flags=${first_section_name}=contents " - fi - continue - fi - - mem_info=($(get_section_meminfo $elf_path $section_name)) - if [ $((0x${mem_info[2]} - 0)) -eq 0 ];then echo "skip $section_name";continue;fi - - lma=$((0x${mem_info[0]} - 0x${first_mem_info[0]})) - params+="-j $section_name --change-section-lma=${section_name}=${lma} " - if [ "${mem_info[3]}" = "NOBITS" ];then - params+="--set-section-flags=${section_name}=contents " - fi - done - - ${OBJCOPY} --gap-fill 0x00 -O binary ${params[@]} ${elf_path} ${output_bin_path} -} - -dtcm_sections=($(get_mem_sections $MEMFILE DTCM)) -itcm_sections=($(get_mem_sections $MEMFILE ITCM)) -sram_sections=($(get_mem_sections $MEMFILE SRAM)) - -mkdir -p $WORK_DIR -pushd ${WORK_DIR} - gen_section_to_bin ${ELF_PATH} "${dtcm_sections[*]}" ${dtcm_sections[0]} DTCM_START_ADDR_0x180000.bin - gen_section_to_bin ${ELF_PATH} "${itcm_sections[*]}" ${itcm_sections[0]} ITCM_START_ADDR_0x14c000.bin - gen_section_to_bin ${ELF_PATH} "${sram_sections[*]}" ${sram_sections[0]} sram.bin - dd if=/dev/zero of=${ROOT_PATH}/output/ws63/mem_bins/sram_pkt_ram.bin bs=49152 seek=0 count=1 conv=sync - cat ${ROOT_PATH}/output/ws63/mem_bins/sram_pkt_ram.bin ${ROOT_PATH}/output/ws63/mem_bins/sram.bin > ${ROOT_PATH}/output/ws63/mem_bins/SRAM_START_ADDR_0xA00000.bin - dd if=/dev/zero of=${ROOT_PATH}/output/ws63/mem_bins/flash_gap.bin bs=266240 seek=0 count=1 conv=sync - cat ${ROOT_PATH}/output/ws63/mem_bins/flash_gap.bin ${ROOT_PATH}/output/ws63/acore/$3/$3-sign.bin > ${ROOT_PATH}/output/ws63/mem_bins/FLASH.bin - python3 ${ROOT_PATH}/build/config/target_config/ws63/script/process_sfc_hex.py ${ROOT_PATH}/output/ws63/mem_bins/FLASH.bin ${ROOT_PATH}/output/ws63/mem_bins/SFC_DATA 2097152 - rm -rf FLASH.bin flash_gap.bin sram.bin sram_pkt_ram.bin temp.hex -popd \ No newline at end of file diff --git a/build/config/target_config/ws63/script/nv_handle.py b/build/config/target_config/ws63/script/nv_handle.py deleted file mode 100755 index c19906c..0000000 --- a/build/config/target_config/ws63/script/nv_handle.py +++ /dev/null @@ -1,107 +0,0 @@ -import json -from xml.dom.minidom import Document -import re -import os - - -NV_JSON_FILE_DIR = ["./output/ws63/acore/nv_bin/temp/cfg/acore_nv.json"] -NV_TXT_FILE_DIR = ["./output/ws63/acore/nv_bin/temp/acore.etypes"] - -NV_XML_PATH = "./output/ws63/database/cco/system/hdbcfg/mss_nvi_db.xml" -TXT_PATH = "./output/ws63/database/cco/system/nv/nv_struct_def.txt" - - -def nv_json_handle(): - file_dic = {} - for file_path in NV_JSON_FILE_DIR: - if not os.path.isfile(file_path): - print("[!][nv handle]warning: ", file_path, " not found!") - break - nv_dic = {} - with open(file_path, "r") as f: - nv_api = json.load(f) - for i in nv_api["common"].keys(): - if nv_api["common"][i] != 0: - nv_dic[i] = nv_api["common"][i] - file_dic[file_path] = nv_dic - return file_dic - - -def dic_to_nv(nv_dic: dict): - if not nv_dic: - print("[!][nv handle]warning: dic is Null.") - return - nv_data = Document() - root_node = nv_data.createElement("DebugKits") - nv_data.appendChild(root_node) - group_num = 0 - for file_name in nv_dic.keys(): - print("NV file reading: ", file_name) - group_num += 1 - group_id = hex(group_num) - - file_cont = nv_dic[file_name] - - # first node, GROUP attribute - first_son_node = nv_data.createElement("GROUP") - root_node.appendChild(first_son_node) - first_son_node.setAttribute("ID", group_id) - first_son_node.setAttribute("NAME", "NV") - first_son_node.setAttribute("PARAM_DEF_FILE", os.path.relpath(TXT_PATH, os.path.dirname(NV_XML_PATH))) - for nv_name in file_cont.keys(): - son_node = nv_data.createElement("NV") - first_son_node.appendChild(son_node) - son_node.setAttribute("CATEGORY", "FTM") - son_node.setAttribute("DESCRIPTION", "FTM") - son_node.setAttribute("DEV", "CCO") - son_node.setAttribute("ID", file_cont[nv_name]["key_id"]) - son_node.setAttribute("NAME", nv_name) - son_node.setAttribute("PARAM_NAME", file_cont[nv_name]["structure_type"]) - print("nv xml writing in: ", NV_XML_PATH) - try: - f = open(NV_XML_PATH, "w", encoding="utf-8") - f.write(nv_data.toprettyxml()) - f.close() - except FileNotFoundError: - print("[!][nv handle]warning: ", NV_XML_PATH, " not found!") - pass - except: - print("[!][nv handle]warning: NV error!") - pass - -def struct_to_txt(): - struct_list = [] - for file_path in NV_TXT_FILE_DIR: - if not os.path.isfile(file_path): - print("[!][nv handle]warning: ", file_path, " not found!") - break - print("struct file reading: ", file_path) - with open(file_path, "r", encoding="utf-8") as f: - data = f.readlines() - ret = re.findall("(typedef.*?;)", "".join(data)) - ret2 = re.findall("(typedef struct {.*?}.*?;)", "".join(data), re.S) - struct_list.extend(ret) - struct_list.extend(ret2) - print("struct writing in:", TXT_PATH) - try: - with open(TXT_PATH, "w", encoding="utf-8") as t_file: - t_file.write('''#include "base_datatype_def.txt"\n''') - for i in struct_list: - t_file.write(i + "\n") - except FileNotFoundError: - print("[!][nv handle]warning: ", TXT_PATH, " not found!") - pass - except: - print("[!][nv handle]warning: NV error!") - pass - return - - -if __name__ == '__main__': - work_dir = os.getcwd() - print("current work direction: ", work_dir) - dic = nv_json_handle() - if dic: - dic_to_nv(dic) - struct_to_txt() - os.chdir(work_dir) diff --git a/build/config/target_config/ws63/script/pke_rom.sh b/build/config/target_config/ws63/script/pke_rom.sh deleted file mode 100755 index e09b83c..0000000 --- a/build/config/target_config/ws63/script/pke_rom.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -set -e - -root_dir=$1 -out_dir=${root_dir}/output/ws63/acore/pke_rom -create_hex_py=${root_dir}/build/script/utils/create_hex.py -objcopy_tool=${root_dir}/tools/bin/compiler/riscv/cc_riscv32_musl_105/cc_riscv32_musl/bin/riscv32-linux-musl-objcopy -gcc_tool=${root_dir}/tools/bin/compiler/riscv/cc_riscv32_musl_105/cc_riscv32_musl/bin/riscv32-linux-musl-gcc -rom_lib_c=${root_dir}/drivers/chips/ws63/rom/rom_boot/drivers/drivers/hal/security_unified/hal_cipher/pke/rom_lib.c -td_type_h=${root_dir}/drivers/chips/ws63/rom/rom_boot/middleware/utils/common_headers/native/td_type.h - -if [ ! -d ${out_dir} ];then - mkdir ${out_dir} -fi - -cat ${rom_lib_c}|grep -Pzo ".*g_instr_rom\[\]\s*=\s*\{[\s\S]+\}\s*;"|sed 's/\x0//g' > ${out_dir}/rom_lib.c -rom_lib_file_path=${out_dir}/rom_lib.o -${gcc_tool} -include ${td_type_h} -c ${out_dir}/rom_lib.c -o ${rom_lib_file_path} -if [ -f ${rom_lib_file_path} ]; then - ${objcopy_tool} -O binary -j "\.rodata" ${rom_lib_file_path} ${out_dir}/pke_rom_raw.bin - tr '\000' '\377' < /dev/zero|dd of=${out_dir}/pke_rom.bin bs=3k count=1 - dd if=${out_dir}/pke_rom_raw.bin of=${out_dir}/pke_rom.bin seek=0 conv=notrunc - - # generate hex - python3 ${create_hex_py} ${out_dir}/pke_rom.bin ${out_dir}/pke_rom.hex -fi - - -exit 0 diff --git a/build/config/target_config/ws63/script/process_sfc_hex.py b/build/config/target_config/ws63/script/process_sfc_hex.py deleted file mode 100755 index 287f78d..0000000 --- a/build/config/target_config/ws63/script/process_sfc_hex.py +++ /dev/null @@ -1,50 +0,0 @@ -import struct -import sys - -def create_hex_file(target, source): - with open(str(source), "rb") as binfile, open(str(target), "wb") as hexfile: - while True: - bindata = binfile.read(4) - if not bindata: - break - longdata, = struct.unpack("8}'.format(hexstr).upper() - hexfile.write(str.encode(hexstr)) - binfile.close() - hexfile.close() - -def create_sfc_file(target, source, input_len): - len = 0 - with open(str(source), "r") as hexfile, open(str(target), "w") as sfcfile: - for line in hexfile.readlines(): - #print("len is %d" % len(line)) - sfcfile.writelines(line[6:8]) - sfcfile.writelines("\n") - sfcfile.writelines(line[4:6]) - sfcfile.writelines("\n") - sfcfile.writelines(line[2:4]) - sfcfile.writelines("\n") - sfcfile.writelines(line[0:2]) - sfcfile.writelines("\n") - len += 4 - while len < int(input_len) : - sfcfile.writelines('FF') - sfcfile.writelines("\n") - len += 1 - hexfile.close() - sfcfile.close() - -if __name__ == "__main__": - if len(sys.argv) == 4: - bin_file_name = sys.argv[1] - hex_file_name = "temp.hex" - sfc_file_name = sys.argv[2] - len = sys.argv[3] - else: - print('hhhhhhhhhhhhhhhhh') - sys.exit(0) - - create_hex_file(hex_file_name, bin_file_name) - create_sfc_file(sfc_file_name, hex_file_name, len) - print('success') diff --git a/build/config/target_config/ws63/script/rom_in_one.py b/build/config/target_config/ws63/script/rom_in_one.py deleted file mode 100755 index 120b952..0000000 --- a/build/config/target_config/ws63/script/rom_in_one.py +++ /dev/null @@ -1,45 +0,0 @@ -import sys -import os - - -def merge(file_first, file_second, file_out): - ret = open(file_out, 'wb') - with open(file_first, 'rb') as file_1: - for i in file_1: - ret.write(i) - with open(file_second, 'rb') as file_2: - for i in file_2: - ret.write(i) - ret.close() - - -def move_file(src_path, dst_path, file_name): - src_file = os.path.join(src_path, file_name) - if not os.path.exists(dst_path): - os.mkdir(dst_path) - dst_file = os.path.join(dst_path, file_name) - shutil.move(src_file, dst_file) - - -# instead of linux dd -# max_size: number of k -def python_dd(file_name, max_size): - file_size = os.path.getsize(file_name) - print(file_name, "size: ", file_size) - if file_size < max_size * 1024: - file_content = open(file_name, 'wb') - file_content.write(b'0' * (max_size * 1024 - file_size)) - - -root_dir = sys.argv[1] -bin_name = sys.argv[2] - -out_dir = os.path.join(root_dir, "output/ws63/acore/", bin_name) -romboot_bin = os.path.join(root_dir, "/output/ws63/acore/ws63-romboot/romboot.bin") - -if not os.path.isfile(romboot_bin): - print("[*] romboot not found, codepoint files will not be one!") - sys.exit() - -python_dd(romboot_bin, 36) -merge(romboot_bin, romboot_bin + "_rom.bin", romboot_bin + "_rompack.bin") \ No newline at end of file diff --git a/build/config/target_config/ws63/script/rom_in_one.sh b/build/config/target_config/ws63/script/rom_in_one.sh deleted file mode 100755 index a69e172..0000000 --- a/build/config/target_config/ws63/script/rom_in_one.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -set -e - -root_dir=$1 -bin_name=$2 -out_dir=${root_dir}/output/ws63/acore/${bin_name} -romboot_bin_dir=${root_dir}/output/ws63/acore/ws63-romboot -romboot_bin=${root_dir}/output/ws63/acore/ws63-romboot/romboot.bin -create_hex_py=${root_dir}/build/script/utils/create_hex.py - - -if [ ! -f ${romboot_bin} ];then - echo "[*] romboot not found, codepoint files will not be one!" - exit 0 -fi - -pushd ${out_dir} -# Fill romboot bin to 36K -dd if=${romboot_bin} of=romboot.36K.bin bs=36K seek=0 count=1 conv=sync - -# All in one rompack file -cat romboot.36K.bin ${bin_name}_rom.bin > ${bin_name}_rompack.bin -python3 ${create_hex_py} ${bin_name}_rompack.bin ${bin_name}_rompack.hex - -# Split the rompack bin file into three parts: 128k, 128k, 48k -dd bs=128k count=1 if=${bin_name}_rompack.bin of=${bin_name}_rompack_part1.128k.bin -python3 ${create_hex_py} ${bin_name}_rompack_part1.128k.bin ${bin_name}_rompack_part1.128k.hex - -dd bs=128k count=1 skip=1 if=${bin_name}_rompack.bin of=${bin_name}_rompack_part2.128k.bin -python3 ${create_hex_py} ${bin_name}_rompack_part2.128k.bin ${bin_name}_rompack_part2.128k.hex - -dd bs=128k skip=2 if=${bin_name}_rompack.bin of=${bin_name}_rompack_part3.tmp.bin -dd bs=48k count=1 conv=sync if=${bin_name}_rompack_part3.tmp.bin of=${bin_name}_rompack_part3.48k.bin -rm -f ${bin_name}_rompack_part3.tmp.bin -python3 ${create_hex_py} ${bin_name}_rompack_part3.48k.bin ${bin_name}_rompack_part3.48k.hex - -popd diff --git a/build/config/target_config/ws63/script/ws63_mfg_build.py b/build/config/target_config/ws63/script/ws63_mfg_build.py deleted file mode 100755 index 77883a7..0000000 --- a/build/config/target_config/ws63/script/ws63_mfg_build.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import sys -import shutil -import subprocess - -current_path = os.path.dirname(os.path.realpath(__file__)) -sdk_root_path = os.path.realpath(os.path.join(current_path, "../../../../../")) -sys.path.append(os.path.join(sdk_root_path, 'tools/pkg')) -from packet_create import packet_bin - -def get_file_size(file_path: str)->int: - try: - return os.stat(file_path).st_size - except BaseException as e: - print(e) - exit(-1) - -cmd_app = [os.path.join(sdk_root_path, "build.py"), "ws63-liteos-app"] -cmd_mfg = [os.path.join(sdk_root_path, "build.py"), "ws63-liteos-mfg"] - -ret_app = subprocess.run(cmd_app, cwd=sdk_root_path) -ret_mfg = subprocess.run(cmd_mfg, cwd=sdk_root_path) - -if ret_app.returncode != 0 or ret_mfg.returncode != 0: - print("build error!") - exit(-1) - -boot_bin_dir = os.path.join(sdk_root_path, "interim_binary", "ws63", "bin", "boot_bin") -param_bin_dir = os.path.join(sdk_root_path, "output", "ws63", "acore", "param_bin") -nv_bin_dir = os.path.join(sdk_root_path, "output", "ws63", "acore", "nv_bin") - -loadboot_bin = os.path.join(boot_bin_dir, "root_loaderboot_sign.bin") -loadboot_bx = loadboot_bin + "|0x0|0x200000|0" - -# params -params_bin = os.path.join(param_bin_dir, "root_params_sign.bin") -params_bx = params_bin + f"|0x200000|{hex(get_file_size(params_bin))}|1" - -# flash boot -flashboot_bin = os.path.join(boot_bin_dir, "flashboot_sign.bin") -flashboot_bx = flashboot_bin + f"|0x202000|{hex(get_file_size(flashboot_bin))}|1" - -# nv -nv_bin = os.path.join(nv_bin_dir, "ws63_all_nv.bin") -nv_bx = nv_bin + f"|0x224000|{hex(get_file_size(nv_bin))}|1" - -app_bin_path = os.path.join(sdk_root_path, "output/ws63/acore/ws63-liteos-app/ws63-liteos-app-sign.bin") -mfg_app_bin_path = os.path.join(sdk_root_path, "output/ws63/acore/ws63-liteos-mfg/ws63-liteos-mfg-sign.bin") - -app_templat_bx = app_bin_path + f"|0x22D000|{hex(get_file_size(app_bin_path))}|1" -mfg_app_bx = mfg_app_bin_path + f"|0x42D000|{hex(0x1BA000)}|1" - -# 输出目录 -fwpkg_outdir = os.path.join(sdk_root_path, "output", "ws63", "fwpkg", "ws63-liteos-mfg-all") - -if os.path.exists(fwpkg_outdir): - shutil.rmtree(fwpkg_outdir) -os.makedirs(fwpkg_outdir) - -packet_post_agvs = list() -packet_post_agvs.append(loadboot_bx) -packet_post_agvs.append(params_bx) -packet_post_agvs.append(flashboot_bx) -packet_post_agvs.append(nv_bx) -packet_post_agvs.append(app_templat_bx) -packet_post_agvs.append(mfg_app_bx) - -output_fwpkg_path = os.path.join(fwpkg_outdir, "mfg_app_sign.fwpkg") -packet_bin(output_fwpkg_path, packet_post_agvs) \ No newline at end of file diff --git a/build/config/target_config/ws63/sign_config/params_and_bin_sign.py b/build/config/target_config/ws63/sign_config/params_and_bin_sign.py deleted file mode 100755 index 801f156..0000000 --- a/build/config/target_config/ws63/sign_config/params_and_bin_sign.py +++ /dev/null @@ -1,294 +0,0 @@ -import subprocess -import os -import sys -import shutil -import platform -import tarfile -import subprocess - -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..", "..", "..", "..")) -sys.path.append(os.path.join(g_root, 'build', 'script')) -sys.path.append(os.path.join(g_root, "build", "config")) -from enviroment import TargetEnvironment -import param_packet - -current_path = os.getcwd() -cwd_path = os.path.split(os.path.realpath(__file__))[0] -os.chdir(cwd_path) -if "windows" in platform.platform().lower(): - sign_tool = "../../../../../tools/bin/sign_tool/sign_tool_pltuni.exe" -else: - sign_tool = "../../../../../tools/bin/sign_tool/sign_tool_pltuni" -out_put = "../../../../../output/ws63/acore" -pktbin = "../../../../../output/ws63/pktbin" -inter_bin = "../../../../../interim_binary/ws63/bin/boot_bin" -efuse_csv = "../script/efuse.csv" -boot_bin = "../../../../../output/ws63/acore/boot_bin" -mfg_bin = "../../../../../application/ws63/ws63_liteos_mfg" - -def merge(file_first, file_second, file_out): - if "windows" in platform.platform().lower(): - out_path = os.path.normpath(os.path.realpath(file_out)).rsplit('\\' , 1)[0] - else: - out_path = os.path.normpath(os.path.realpath(file_out)).rsplit('/' , 1)[0] - print("merge out path: ", out_path) - if not os.path.exists(out_path): - os.makedirs(out_path) - ret = open(file_out, 'wb') - with open(file_first, 'rb') as file_1: - for i in file_1: - ret.write(i) - with open(file_second, 'rb') as file_2: - for i in file_2: - ret.write(i) - ret.close() - - -def move_file(src_path, dst_path, file_name): - src_file = os.path.join(src_path, file_name) - if not os.path.exists(dst_path): - os.mkdir(dst_path) - dst_file = os.path.join(dst_path, file_name) - shutil.move(src_file, dst_file) - - -def sign_app(file_path, type, cfg_name): - if os.path.isfile(file_path): - print("sign name: ", file_path) - dd64c(file_path) - ret = subprocess.run([sign_tool, type, cfg_name]) - if ret.returncode == 0: - print(file_path, " generated successfully!!!") - else: - print(file_path, " generated failed!!!") - shutil.copy(file_path, pktbin) - else: - pass - - -def generate_fill_bin(file_path, size): - with open(file_path, 'wb') as f: - f.write(bytes([0xFF] * size)) - - -def dd64c(input_file_path): - file_size = os.path.getsize(input_file_path) - print(input_file_path, "size: ", file_size) - if file_size % 64 != 0: - max_size = int((file_size / 64)+1) * 64 - if file_size < max_size: - file_content = open(input_file_path, 'ab') - file_content.write(bytes([0] * int(max_size - file_size))) - - -if os.path.exists(pktbin): - shutil.rmtree(pktbin) -os.makedirs(pktbin) - -# generate params.bin -params_cmd = ["../param_sector/param_sector.json", "params.bin"] -if sys.argv[1] == "ws63-liteos-app-iot" or sys.argv[1] == "ws63-liteos-hilink": - target_env = TargetEnvironment(sys.argv[1]) - defines = target_env.get('defines') - if "CONFIG_SUPPORT_HILINK_INDIE_UPGRADE" in defines: - params_cmd = ["../param_sector/param_sector_hilink_indie_upgrade.json", "params.bin"] -if sys.argv[1] == "ws63-liteos-msmart" or sys.argv[1] == "ws63-liteos-msmart-xts": - params_cmd = ["../param_sector/param_sector_ms.json", "params.bin"] - -print("generate params.bin...") -param_packet.gen_flash_part_bin(params_cmd[0], params_cmd[1]) -if os.path.isfile("params.bin"): - dd64c("params.bin") - print("params.bin generate successfully!!!") - - # generate params_sign.bin - param_bin_ecc_cmd = [sign_tool, "0", "param_bin_ecc.cfg"] - ret = subprocess.run(param_bin_ecc_cmd, cwd=cwd_path) - if ret.returncode == 0: - print("params_sign.bin generate successfully!!!") - else: - print("params_sign.bin generate failed!!!") - - # generate root public key - root_pubk_cmd = [sign_tool, "1", "root_pubk.cfg"] - ret = subprocess.run(root_pubk_cmd, cwd=cwd_path) - if ret.returncode == 0: - print("root_pubk.bin generate successfully!!!") - else: - generate_fill_bin("root_pubk.bin", 0x80) - print("generate fill root_pubk.bin") - - # packet root public key and param.bin - merge("root_pubk.bin", "params_sign.bin", "root_params_sign.bin") - print("root_params_sign.bin generate successfully!!!") - move_file(cwd_path, os.path.join(out_put, "param_bin"), "root_params_sign.bin") - -if not os.path.isdir(boot_bin): - shutil.copytree(inter_bin, boot_bin) - -if not os.path.isfile(os.path.join(boot_bin, "ws63-liteos-mfg.bin")): - shutil.copy(os.path.join(mfg_bin, "ws63-liteos-mfg.bin"), boot_bin) - -#sign ssb -if os.path.isfile(os.path.join(out_put, "ws63-ssb/ssb.bin")): - dd64c(os.path.join(out_put, "ws63-ssb/ssb.bin")) - shutil.copy(os.path.join(out_put, "ws63-ssb/ssb.bin"), pktbin) - ret1 = subprocess.run([sign_tool, "0", "ssb_bin_ecc.cfg"]) - if ret1.returncode == 0: - print("ssb_sign.bin generated successfully!!!") - shutil.copy(os.path.join(out_put, "ws63-ssb/ssb_sign.bin"), boot_bin) - else: - print("ssb_sign.bin generated failed!!!") - -#sign interim ssb -if os.path.isfile(os.path.join(inter_bin, 'ssb.bin')): - jug_ssb = False - if not os.path.isfile(os.path.join(out_put, "ws63-ssb/ssb.bin")): - os.makedirs(os.path.join(out_put, 'ws63-ssb')) - shutil.copy(os.path.join(inter_bin, 'ssb.bin'), os.path.join(out_put, "ws63-ssb")) - sign_app(os.path.join(out_put, "ws63-ssb/ssb.bin"), "0", "ssb_bin_ecc.cfg") - jug_ssb = True - shutil.copy(os.path.join(out_put, "ws63-ssb/ssb_sign.bin"), boot_bin) - print("ssb_sign.bin generated successfully!!!") - if jug_ssb: - shutil.rmtree(os.path.join(out_put, 'ws63-ssb')) - -#sign flash boot -if os.path.isfile(os.path.join(out_put, "ws63-flashboot/flashboot.bin")): - dd64c(os.path.join(out_put, "ws63-flashboot/flashboot.bin")) - shutil.copy(os.path.join(out_put, "ws63-flashboot/flashboot.bin"), pktbin) - ret1 = subprocess.run([sign_tool, "0", "flash_bin_ecc.cfg"]) - ret2 = subprocess.run([sign_tool, "0", "flash_backup_bin_ecc.cfg"]) - if ret1.returncode == 0 and ret2.returncode == 0: - print("flash_sign.bin generated successfully!!!") - else: - print("flash_sign.bin generated failed!!!") - -if os.path.isfile(os.path.join(out_put, "ws63-flashboot/flashboot.bin")): - shutil.copy(os.path.join(out_put, "ws63-flashboot/flashboot.bin"), boot_bin) - shutil.copy(os.path.join(out_put, "ws63-flashboot/flashboot_sign.bin"), boot_bin) - shutil.copy(os.path.join(out_put, "ws63-flashboot/flashboot_backup_sign.bin"), boot_bin) - -if os.path.isfile(os.path.join(out_put, "ws63-ate-flash", "ws63-ate-flash.bin")): - dd64c(os.path.join(out_put, "ws63-ate-flash", "ws63-ate-flash.bin")) - ret1 = subprocess.run([sign_tool, "0", "flash_htol_bin_ecc.cfg"]) - if ret1.returncode == 0: - print("ws63_ate_flash.bin generated successfully!!!") - else: - print("ws63_ate_flash.bin generated failed!!!") - -if os.path.isfile(os.path.join(out_put, "ws63-loaderboot", "loaderboot.bin")): - dd64c(os.path.join(out_put, "ws63-loaderboot", "loaderboot.bin")) - shutil.copy(os.path.join(out_put, "ws63-loaderboot", "loaderboot.bin"), pktbin) - ret1 = subprocess.run([sign_tool, "0", "loaderboot_bin_ecc.cfg"]) - if ret1.returncode == 0: - print("loaderboot_sign.bin generated successfully!!!") - else: - print("loaderboot_sign.bin generated failed!!!") - merge("root_pubk.bin", "loaderboot_sign.bin", os.path.join(out_put, "ws63-loaderboot", "root_loaderboot_sign.bin")) - shutil.copy(os.path.join(out_put, "ws63-loaderboot/root_loaderboot_sign.bin"), boot_bin) - print("root_loaderboot_sign.bin generated successfully!!!") - os.remove("loaderboot_sign.bin") - -#sign loaderboot.bin interim -if os.path.isfile(os.path.join(inter_bin, 'loaderboot.bin')): - jug_loaderboot = False - if not os.path.isfile(os.path.join(out_put, "ws63-loaderboot/loaderboot.bin")): - os.makedirs(os.path.join(out_put, 'ws63-loaderboot')) - jug_loaderboot = True - shutil.copy(os.path.join(inter_bin, 'loaderboot.bin'), os.path.join(out_put, "ws63-loaderboot")) - sign_app(os.path.join(out_put, "ws63-loaderboot/loaderboot.bin"), "0", "loaderboot_bin_ecc.cfg") - if(os.path.isfile("loaderboot_sign.bin")): - print("loaderboot_sign.bin generated successfully!!!") - merge("root_pubk.bin", 'loaderboot_sign.bin', os.path.join(boot_bin, 'root_loaderboot_sign.bin')) - print("root_loaderboot_sign.bin generated successfully!!!") - os.remove('loaderboot_sign.bin') - if jug_loaderboot: - shutil.rmtree(os.path.join(out_put, "ws63-loaderboot")) - - -# sign app -sign_app(os.path.join(out_put, "ws63-liteos-testsuite/ws63-liteos-testsuite.bin"), "0", "testsuit_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-app/ws63-liteos-app.bin"), "0", "liteos_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-hilink/ws63-liteos-hilink.bin"), "0", "liteos_hilink_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-app-gree/ws63-liteos-app-gree.bin"), "0", "liteos_app_gree_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-msmart/ws63-liteos-msmart.bin"), "0", "liteos_msmart_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-msmart-xts/ws63-liteos-msmart-xts.bin"), "0", "liteos_msmart_xts_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-xts/ws63-liteos-xts.bin"), "0", "liteos_xts_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-app-iot/ws63-liteos-app-iot.bin"), "0", "liteos_app_iot_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-btc-only/ws63-liteos-btc-only.bin"), "0", "btc_only_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-btc-only-asic/ws63-liteos-btc-only-asic.bin"), "0", "liteos_btc_only_asic_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-gle-sparklyzer/ws63-liteos-gle-sparklyzer.bin"), "0", "sparklyzer_btc_only_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-mfg/ws63-liteos-mfg.bin"), "0", "liteos_mfg_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-perf/ws63-liteos-perf.bin"), "0", "liteos_perf_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-app-asic/ws63-liteos-app-asic.bin"), "0", "liteos_app_asic_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-freertos-testsuite/ws63-freertos-testsuite.bin"), "0", "freertos_testsuit_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-freertos-app/ws63-freertos-app.bin"), "0", "freertos_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-freertos-wifi-only/ws63-freertos-wifi-only.bin"), "0", "freertos_wifi_only_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-freertos-btc-only/ws63-freertos-btc-only.bin"), "0", "freertos_btc_only_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-alios-app/ws63-alios-app.bin"), "0", "alios_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-alios-testsuite/ws63-alios-testsuite.bin"), "0", "alios_testsuit_app_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-alios-btc-only/ws63-alios-btc-only.bin"), "0", "alios_btc_only_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-bgle-all/ws63-liteos-bgle-all.bin"), "0", "liteos_bgle_all_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-bgle-all-asic/ws63-liteos-bgle-all-asic.bin"), "0", "liteos_bgle_all_asic_bin_ecc.cfg") - -sign_app(os.path.join(out_put, "ws63-liteos-testsuite-radar/ws63-liteos-testsuite-radar.bin"), "0", "liteos_testsuite_radar_bin_ecc.cfg") - -sign_app(os.path.join(boot_bin, "ws63-liteos-mfg.bin"), "0", "liteos_mfg_bin_factory_ecc.cfg") - -move_file(cwd_path, os.path.join(out_put, "param_bin"), "params.bin") -# clean middle files -os.remove("params_sign.bin") -os.remove("root_pubk.bin") - -if os.path.isfile(os.path.join(out_put, "ws63-liteos-app", "ws63-liteos-app.bin")): - shutil.copy(os.path.join(out_put, "ws63-liteos-app", "ws63-liteos-app.bin"), pktbin) - -if os.path.isfile(os.path.join(out_put, "ws63-liteos-hilink", "ws63-liteos-hilink.bin")): - shutil.copy(os.path.join(out_put, "ws63-liteos-hilink", "ws63-liteos-hilink.bin"), pktbin) - -if os.path.isfile(os.path.join(inter_bin, "ssb.bin")): - shutil.copy(os.path.join(inter_bin, "ssb.bin"), pktbin) - -if os.path.isfile(os.path.join(inter_bin, "flashboot.bin")): - shutil.copy(os.path.join(inter_bin, "flashboot.bin"), pktbin) - -if os.path.isfile(os.path.join(inter_bin, "loaderboot.bin")): - shutil.copy(os.path.join(inter_bin, "loaderboot.bin"), pktbin) - -if os.path.isfile(efuse_csv): - shutil.copy(efuse_csv, pktbin) - -if os.path.isfile(os.path.join(out_put, "param_bin", "params.bin")): - shutil.copy(os.path.join(out_put, "param_bin", "params.bin"), pktbin) - -if os.path.isfile(os.path.join(out_put, "nv_bin", "ws63_all_nv.bin")): - shutil.copy(os.path.join(out_put, "nv_bin", "ws63_all_nv.bin"), pktbin) - -if os.path.isfile(os.path.join(out_put, "nv_bin", "ws63_all_nv_factory.bin")): - shutil.copy(os.path.join(out_put, "nv_bin", "ws63_all_nv_factory.bin"), pktbin) - -os.chdir(current_path) diff --git a/build/config/target_config/ws63/target_config.py b/build/config/target_config/ws63/target_config.py deleted file mode 100755 index 34b1615..0000000 --- a/build/config/target_config/ws63/target_config.py +++ /dev/null @@ -1,379 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ========================================================================= -# @brief Target Definitions File -# Copyright HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. -# ========================================================================= -import os -import copy - -codesize_flags = { - 'ccflags':[ - '--short-enums', - "-madjust-regorder", - "-madjust-const-cost", - "-freorder-commu-args", - "-fimm-compare-expand", - "-frmv-str-zero", - "-mfp-const-opt", - "-frtl-sequence-abstract", - "-frtl-hoist-sink", - "-fsafe-alias-multipointer", - "-finline-optimize-size", - "-fmuliadd-expand", - "-mlli-expand", - "-Wa,-mcjal-expand", - "-foptimize-reg-alloc", - "-fsplit-multi-zero-assignments", - "-floop-optimize-size", - "-Wa,-mlli-relax", - "-mpattern-abstract", - "-foptimize-pro-and-epilogue", - ], - 'linkflags':[ - "-Wl,--cjal-relax", - "-Wl,--dslf", - ], - 'rom_ccflags':[ - '--short-enums', - "-madjust-regorder", - "-madjust-const-cost", - "-freorder-commu-args", - "-fimm-compare-expand", - "-frmv-str-zero", - "-mfp-const-opt", - "-frtl-sequence-abstract", - "-frtl-hoist-sink", - "-fsafe-alias-multipointer", - "-finline-optimize-size", - "-fmuliadd-expand", - "-mlli-expand", - "-Wa,-mcjal-expand", - "-foptimize-reg-alloc", - "-fsplit-multi-zero-assignments", - "-floop-optimize-size", - "-foptimize-pro-and-epilogue", - "-fno-inline-functions-called-once", - "-fno-inline-small-functions", - ] -} - -fp_flags = { - '-:-mabi=ilp32', '-:-march=rv32imc', '-mabi=ilp32f', '-march=rv32imfc' -} - -target_template = { - 'target_ws63_app_rom_template': { - 'chip': 'ws63', - 'core': 'acore', - 'arch': 'riscv31', - 'tool_chain': 'riscv32_musl_105_fp', - 'board': 'evb', - 'build_type': 'COMPILE', - 'CONFIG_TIMER_USING_V150': 'y', - 'std_libs': ['m', 'c', 'gcc'], - 'defines': ["SDK_VERSION=\"1.10.102\"", '-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', - 'VERSION_STANDARD', 'LIBBUILD_VERSION', - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", - "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", - "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", - "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', - ], - 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], - - 'ram_component': [ - 'osal', 'osal_adapt', 'common_headers', 'ws63_mem_config', - 'driver_header', 'security_unified_header', - 'efuse', 'hal_efuse_v151', 'efuse_port', - 'tsensor', 'hal_tsensor', 'tsensor_port', - 'pwm', 'hal_pwm', 'pwm_port', 'app_init', - 'adc', 'hal_adc', 'adc_port', - 'dma', 'hal_dma_v151', 'dma_port', - 'spi', 'hal_spi', 'spi_porting', - 'sfc_port_ws63', 'sfc_flash_config_ws63', - 'pmp', 'hal_pmp', 'pmp_port', - 'dyn_mem', - 'plat_patch', 'wifi_rom_data', 'bgtp_rom_data', - 'version_port', 'mac_addr_ws63', - 'partition', 'partition_ws63', - ], - 'ram_component_set': [ - 'i2c', 'uart', 'hso_log', 'security_unified', 'dfx_set', 'sio_v151', 'i2s' - ], - 'rom_component': [ - 'wifi_driver_rom', "wifi_alg_radar_sensor_rom", - 'sfc_rom', 'hal_sfc_rom', - 'watchdog_rom', 'hal_watchdog_rom', 'watchdog_port_rom', - 'pinctrl_rom', 'hal_pinctrl_rom', 'pinctrl_port_ws63_rom', - 'systick_rom', 'systick_port_rom', - 'drv_timer_rom', 'hal_timer_rom', 'timer_port_rom', - 'tcxo_rom', 'hal_tcxo_rom', 'tcxo_port_rom', - 'libboundscheck_rom', 'version_rom', - 'bgtp_rom', 'bt_host_rom', 'bg_common_rom', - ], - 'bin_name': 'application', - 'ccflags': [ - *fp_flags, - *codesize_flags['ccflags'], - ], - 'linkflags': codesize_flags['linkflags'], - 'rom_ccflags': [ - *fp_flags, - *codesize_flags['rom_ccflags'], - "-DCONFIG_ROM_COMPILE", - "-DINLINE_TO_FORCEINLINE", - "-:-Wno-error=main", - "-:-Wno-type-limits", - "-:-Wno-implicit-fallthrough", - "-Wfloat-equal", - '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' - ], - 'arch': 'riscv31', - 'build_rom_callback': True, - 'rom_ram_check': True, - 'rom_ram_compare': True, - 'patch': True, - 'fixed_rom': True, - 'fixed_rom_path': '/interim_binary/ws63/bin/rom_bin/ws63-liteos_rom.bin', - 'rom_sym_path': '/drivers/chips/ws63/rom_config/acore/acore.sym', - "rom_in_one": True, - 'pke_rom_bin': True, - "fixed_pke": True, - "fixed_pke_path": '/interim_binary/ws63/bin/rom_bin/pke_rom.bin', - 'packet': True, - }, - 'target_ws63_boot_template': { - 'chip': 'ws63', - 'core': 'acore', - 'board': 'evb', - 'tool_chain': 'riscv32_musl_105', - 'build_type': 'COMPILE', - 'os': 'non-os', - 'std_libs': ['-:m', '-:c', 'gcc'], - 'defines': ["SDK_VERSION=\"1.10.102\"", 'CHIP_WS63=1', "CONFIG_UART_FIFO_DEPTH=64", "OSAL_NO_PAL", - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", - "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", "CONFIG_TCXO_WITH_TWO_DATA_REGS"], - 'defines_set': ['libsec_defines'], - 'ram_component': ['-:port_pinctrl', 'pinctrl_port_ws63', 'driver_header', 'security_unified_header'], - 'ram_component_set': [], - 'bin_name': 'boot', - 'ccflags': ['--short-enums',], - 'linkflags': [], - 'arch': 'riscv31', - 'copy_files_to_interim': True - }, - 'target_ws63_boot_template': { - 'chip': 'ws63', - 'core': 'acore', - 'board': 'evb', - 'tool_chain': 'riscv32_musl_105', - 'build_type': 'COMPILE', - 'os': 'non-os', - 'std_libs': ['-:m', '-:c', 'gcc'], - 'defines': ["SDK_VERSION=\"1.10.102\"", 'CHIP_WS63=1', "CONFIG_UART_FIFO_DEPTH=64", "OSAL_NO_PAL", - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", - "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", "CONFIG_TCXO_WITH_TWO_DATA_REGS"], - 'defines_set': ['libsec_defines'], - 'ram_component': ['-:port_pinctrl', 'pinctrl_port_ws63', 'driver_header', 'security_unified_header'], - 'ram_component_set': [], - 'bin_name': 'boot', - 'ccflags': ['--short-enums',], - 'linkflags': [], - 'arch': 'riscv31', - 'copy_files_to_interim': True - }, - 'target_ws63_xts_rom_template': { - 'chip': 'ws63', - 'core': 'acore', - 'arch': 'riscv31', - 'tool_chain': 'riscv32_musl_105_fp', - 'board': 'evb', - 'build_type': 'COMPILE', - 'CONFIG_TIMER_USING_V150': 'y', - 'std_libs': ['m', 'c', 'gcc', 'atomic'], - 'defines': ["SDK_VERSION=\"1.10.102\"", '-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', - 'VERSION_STANDARD', 'LIBBUILD_VERSION', - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", - "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", - "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", - "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', - ], - 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], - - 'ram_component': [ - 'osal', 'osal_adapt', 'common_headers', 'ws63_mem_config', - 'driver_header', 'security_unified_header', - 'efuse', 'hal_efuse_v151', 'efuse_port', - 'tsensor', 'hal_tsensor', 'tsensor_port', - 'pwm', 'hal_pwm', 'pwm_port', 'app_init', - 'adc', 'hal_adc', 'adc_port', - 'dma', 'hal_dma_v151', 'dma_port', - 'spi', 'hal_spi', 'spi_porting', - 'sfc_port_ws63', 'sfc_flash_config_ws63', - 'pmp', 'hal_pmp', 'pmp_port', - 'dyn_mem', 'libboundscheck_sscanf_s', - 'plat_patch', 'wifi_rom_data', 'bgtp_rom_data', - 'version_port', 'mac_addr_ws63', - 'partition', 'partition_ws63', - ], - 'ram_component_set': [ - 'i2c', 'uart', 'hso_log', 'security_unified', 'dfx_set', 'sio_v151', 'i2s' - ], - 'rom_component': [ - 'wifi_driver_rom', "wifi_alg_radar_sensor_rom", - 'sfc_rom', 'hal_sfc_rom', - 'watchdog_rom', 'hal_watchdog_rom', 'watchdog_port_rom', - 'pinctrl_rom', 'hal_pinctrl_rom', 'pinctrl_port_ws63_rom', - 'systick_rom', 'systick_port_rom', - 'drv_timer_rom', 'hal_timer_rom', 'timer_port_rom', - 'tcxo_rom', 'hal_tcxo_rom', 'tcxo_port_rom', - 'libboundscheck_rom', 'version_rom', - 'bgtp_rom', 'bt_host_rom', 'bg_common_rom', - ], - 'bin_name': 'application', - 'ccflags': [ - *fp_flags, - *codesize_flags['ccflags'], - ], - 'linkflags': codesize_flags['linkflags'], - 'rom_ccflags': [ - *fp_flags, - *codesize_flags['rom_ccflags'], - "-DCONFIG_ROM_COMPILE", - "-DINLINE_TO_FORCEINLINE", - "-:-Wno-error=main", - "-:-Wno-type-limits", - "-:-Wno-implicit-fallthrough", - "-Wfloat-equal", - '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' - ], - 'arch': 'riscv31', - 'build_rom_callback': True, - 'rom_ram_check': True, - 'rom_ram_compare': True, - 'patch': True, - 'fixed_rom': True, - 'fixed_rom_path': '/interim_binary/ws63/bin/rom_bin/ws63-liteos_rom.bin', - 'rom_sym_path': '/drivers/chips/ws63/rom_config/acore/acore.sym', - "rom_in_one": True, - 'pke_rom_bin': True, - "fixed_pke": True, - "fixed_pke_path": '/interim_binary/ws63/bin/rom_bin/pke_rom.bin', - 'packet': True, - }, - 'target_ws63_app_rom_template': { - 'chip': 'ws63', - 'core': 'acore', - 'arch': 'riscv31', - 'tool_chain': 'riscv32_musl_105_fp', - 'board': 'evb', - 'build_type': 'COMPILE', - 'CONFIG_TIMER_USING_V150': 'y', - 'std_libs': ['m', 'c', 'gcc'], - 'defines': ["SDK_VERSION=\"1.10.102\"", '-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', - 'VERSION_STANDARD', 'LIBBUILD_VERSION', - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", - "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", - "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", - "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', - ], - 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], - - 'ram_component': [ - 'osal', 'osal_adapt', 'common_headers', 'ws63_mem_config', - 'driver_header', 'security_unified_header', - 'efuse', 'hal_efuse_v151', 'efuse_port', - 'tsensor', 'hal_tsensor', 'tsensor_port', - 'pwm', 'hal_pwm', 'pwm_port', 'app_init', - 'adc', 'hal_adc', 'adc_port', - 'dma', 'hal_dma_v151', 'dma_port', - 'spi', 'hal_spi', 'spi_porting', - 'sfc_port_ws63', 'sfc_flash_config_ws63', - 'pmp', 'hal_pmp', 'pmp_port', - 'dyn_mem', - 'plat_patch', 'wifi_rom_data', 'bgtp_rom_data', - 'version_port', 'mac_addr_ws63', - 'partition', 'partition_ws63', - ], - 'ram_component_set': [ - 'i2c', 'uart', 'hso_log', 'security_unified', 'dfx_set', 'sio_v151', 'i2s' - ], - 'rom_component': [ - 'wifi_driver_rom', "wifi_alg_radar_sensor_rom", - 'sfc_rom', 'hal_sfc_rom', - 'watchdog_rom', 'hal_watchdog_rom', 'watchdog_port_rom', - 'pinctrl_rom', 'hal_pinctrl_rom', 'pinctrl_port_ws63_rom', - 'systick_rom', 'systick_port_rom', - 'drv_timer_rom', 'hal_timer_rom', 'timer_port_rom', - 'tcxo_rom', 'hal_tcxo_rom', 'tcxo_port_rom', - 'libboundscheck_rom', 'version_rom', - 'bgtp_rom', 'bt_host_rom', 'bg_common_rom', - ], - 'bin_name': 'application', - 'ccflags': [ - *fp_flags, - *codesize_flags['ccflags'], - ], - 'linkflags': codesize_flags['linkflags'], - 'rom_ccflags': [ - *fp_flags, - *codesize_flags['rom_ccflags'], - "-DCONFIG_ROM_COMPILE", - "-DINLINE_TO_FORCEINLINE", - "-:-Wno-error=main", - "-:-Wno-type-limits", - "-:-Wno-implicit-fallthrough", - "-Wfloat-equal", - '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' - ], - 'arch': 'riscv31', - 'build_rom_callback': True, - 'rom_ram_check': True, - 'rom_ram_compare': True, - 'patch': True, - 'fixed_rom': True, - 'fixed_rom_path': '/interim_binary/ws63/bin/rom_bin/ws63-liteos_rom.bin', - 'rom_sym_path': '/drivers/chips/ws63/rom_config/acore/acore.sym', - "rom_in_one": True, - 'pke_rom_bin': True, - "fixed_pke": True, - "fixed_pke_path": '/interim_binary/ws63/bin/rom_bin/pke_rom.bin', - 'packet': True, - }, - 'target_ws63_hilink_rom_template': { - 'chip': 'ws63', - 'core': 'acore', - 'arch': 'riscv31', - 'tool_chain': 'riscv32_musl_105_fp', - 'board': 'evb', - 'build_type': 'COMPILE', - 'CONFIG_TIMER_USING_V150': 'y', - 'std_libs': ['m', 'c', 'gcc'], - 'defines': ['-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', - 'VERSION_STANDARD', 'LIBBUILD_VERSION', - "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", - "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", - "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", - "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', - ], - 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], - 'bin_name': 'application', - 'ccflags': [ - *fp_flags, - *codesize_flags['ccflags'], - ], - 'linkflags': codesize_flags['linkflags'], - 'rom_ccflags': [ - *fp_flags, - *codesize_flags['rom_ccflags'], - "-DCONFIG_ROM_COMPILE", - "-DINLINE_TO_FORCEINLINE", - "-:-Wno-error=main", - "-:-Wno-type-limits", - "-:-Wno-implicit-fallthrough", - "-Wfloat-equal", - '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' - ], - 'arch': 'riscv31', - }, -} diff --git a/build/config/target_config/ws63/ws63.json b/build/config/target_config/ws63/ws63.json deleted file mode 100755 index 16a7913..0000000 --- a/build/config/target_config/ws63/ws63.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "chipName": "ws63", - "seriesName": "cfbb", - "board": "ws63", - "compile": { - "custom_build_command": "ws63-liteos-app", - "tool_chain": [ - "cfbb" - ], - "map_path": "./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.elf" - }, - "debug": { - "elf_path": "./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.elf", - "breakpoints_limitation": "7", - "client": [ - "gdb" - ], - "tool": [ - "jlink" - ], - "params": [ - { - "name": "jlink", - "param": { - "interface": [ - "swd", - "jtag" - ], - "speed": "5000", - "port": "3333" - } - } - ], - "timeout_list": [ - "15000", - "30000", - "60000", - "120000", - "-1" - ], - "timeout_default": "60000" - }, - "upload": { - "bin_path": "./output/ws63/fwpkg/ws63-liteos-app/ws63-liteos-app_all.fwpkg", - "reset": 1, - "burn_verification": 0, - "protocol": [ - "serial", - "swd" - ], - "baudList": [ - "2400", - "4800", - "9600", - "19200", - "38400", - "57600", - "115200", - "230400", - "460800", - "500000", - "750000", - "921600", - "2000000" - ], - "params": [ - { - "name": "serial", - "param": { - "port": "", - "baud": "921600", - "stop_bit": "0", - "parity": "N", - "inside_protocol": "" - } - } - ] - }, - "console": { - "serial_port": "", - "baud": "115200", - "stop_bit": "0", - "parity": "N" - }, - "need_sdk": true, - "need_project_path": true, - "chip_config": false, - "gui": false, - "platform": "cfbb", - "project_type": [ - { - "name": "cfbb", - "base_on_sdk": true - } - ], - "analysis": { - "elf_path": "./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.elf", - "map_path": "./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.map", - "tool_path": "./tools/bin/compiler/riscv/cc_riscv32_musl_105/cc_riscv32_musl_fp_win/bin" - }, - "kConfig": { - "menu_config_file_path": "config.in", - "menu_config_build_target": "ws63-liteos-app", - "menu_config_core": "acore", - "menu_config_target_path": "build/config/target_config/ws63/menuconfig/acore" - } -} \ No newline at end of file diff --git a/build/script/__pycache__/build_upg_pkg.cpython-37.pyc b/build/script/__pycache__/build_upg_pkg.cpython-37.pyc deleted file mode 100755 index da50300..0000000 Binary files a/build/script/__pycache__/build_upg_pkg.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/build_upg_pkg.cpython-39.pyc b/build/script/__pycache__/build_upg_pkg.cpython-39.pyc deleted file mode 100644 index ef599e8..0000000 Binary files a/build/script/__pycache__/build_upg_pkg.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/cmake_builder.cpython-37.pyc b/build/script/__pycache__/cmake_builder.cpython-37.pyc deleted file mode 100755 index 77ecae4..0000000 Binary files a/build/script/__pycache__/cmake_builder.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/cmake_builder.cpython-39.pyc b/build/script/__pycache__/cmake_builder.cpython-39.pyc deleted file mode 100644 index 3b36229..0000000 Binary files a/build/script/__pycache__/cmake_builder.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/conf_parser.cpython-37.pyc b/build/script/__pycache__/conf_parser.cpython-37.pyc deleted file mode 100755 index c7d5c08..0000000 Binary files a/build/script/__pycache__/conf_parser.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/conf_parser.cpython-39.pyc b/build/script/__pycache__/conf_parser.cpython-39.pyc deleted file mode 100644 index c641c9a..0000000 Binary files a/build/script/__pycache__/conf_parser.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/custom_cmd.cpython-37.pyc b/build/script/__pycache__/custom_cmd.cpython-37.pyc deleted file mode 100755 index 96e89f4..0000000 Binary files a/build/script/__pycache__/custom_cmd.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/custom_cmd.cpython-39.pyc b/build/script/__pycache__/custom_cmd.cpython-39.pyc deleted file mode 100644 index 302f468..0000000 Binary files a/build/script/__pycache__/custom_cmd.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/enviroment.cpython-37.pyc b/build/script/__pycache__/enviroment.cpython-37.pyc deleted file mode 100755 index bb0cd82..0000000 Binary files a/build/script/__pycache__/enviroment.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/enviroment.cpython-39.pyc b/build/script/__pycache__/enviroment.cpython-39.pyc deleted file mode 100644 index 9f17592..0000000 Binary files a/build/script/__pycache__/enviroment.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/pack_tool.cpython-37.pyc b/build/script/__pycache__/pack_tool.cpython-37.pyc deleted file mode 100755 index 9c9372e..0000000 Binary files a/build/script/__pycache__/pack_tool.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/pack_tool.cpython-39.pyc b/build/script/__pycache__/pack_tool.cpython-39.pyc deleted file mode 100644 index c3d20f6..0000000 Binary files a/build/script/__pycache__/pack_tool.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/param_packet.cpython-37.pyc b/build/script/__pycache__/param_packet.cpython-37.pyc deleted file mode 100755 index 44ba64f..0000000 Binary files a/build/script/__pycache__/param_packet.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/param_packet.cpython-39.pyc b/build/script/__pycache__/param_packet.cpython-39.pyc deleted file mode 100644 index 0e5a5b6..0000000 Binary files a/build/script/__pycache__/param_packet.cpython-39.pyc and /dev/null differ diff --git a/build/script/__pycache__/usr_config.cpython-37.pyc b/build/script/__pycache__/usr_config.cpython-37.pyc deleted file mode 100755 index 5e80f72..0000000 Binary files a/build/script/__pycache__/usr_config.cpython-37.pyc and /dev/null differ diff --git a/build/script/__pycache__/usr_config.cpython-39.pyc b/build/script/__pycache__/usr_config.cpython-39.pyc deleted file mode 100644 index c1536a6..0000000 Binary files a/build/script/__pycache__/usr_config.cpython-39.pyc and /dev/null differ diff --git a/build/script/build_nvbin.py b/build/script/build_nvbin.py deleted file mode 100755 index a17828d..0000000 --- a/build/script/build_nvbin.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# @brief Build nvbin -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -# ============================================================================ - -import os -import sys - -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..")) -sys.path.append(os.path.join(g_root, 'build', 'script', 'nv')) -from nv_binary import nv_begin - -if __name__ == '__main__': - args = sys.argv[1:] - if (len(args) != 3) or (not os.path.exists(args[0])): - print("input args is invalid!\r\n") - else: - nv_begin(args[0], args[1], 0, False, args[2]) diff --git a/build/script/build_upg_pkg.py b/build/script/build_upg_pkg.py deleted file mode 100755 index 92918af..0000000 --- a/build/script/build_upg_pkg.py +++ /dev/null @@ -1,924 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -''' -* Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* Description: part of hupg build scripts -''' - -import argparse -import configparser -import os -import re -import hashlib -import sys -import subprocess -import copy -import struct -import platform -from ctypes import * - -###############################Defining Basic Types############################################### -td_char = c_char -td_s8 = c_byte -td_u8 = c_ubyte -td_s16 = c_short -td_u16 = c_ushort -td_s32 = c_int -td_u32 = c_uint - -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..")) - -class fota_key_area_data(Structure): - pass - -class fota_info_area_data(Structure): - pass - -class upg_sha256_sign(Structure): - _fields_ = [ - ("check_sum", td_u8 * 32), - ("padding", td_u8 * 224), - ] - -class fota_image_hash_node(Structure): - _fields_ = [ - ("image_id", td_u32), - ("image_addr", td_u32), - ("image_length", td_u32), - ("image_hash", td_u8 * 32), - ] - -class fota_image_head(Structure): - _fields_ = [ - ("header_magic", td_u32), - ("image_id", td_u32), - ("image_offset", td_u32), - ("image_len", td_u32), - ("image_hash", td_u8 * 32), - ("old_image_len", td_u32), - ("old_image_hash", td_u8 * 32), - ("new_image_len", td_u32), - ("version_ext", td_u32), - ("version_mask", td_u32), - ("decompress_flag", td_u32), - ("re_enc_flag", td_u32), - ("root_key_type", td_u32), - ("enc_pk_l1", td_u8 * 16), - ("enc_pk_l2", td_u8 * 16), - ("iv", td_u8 * 16), - ("padding", td_u8 * 4), - ] - -class image_key_area(Structure): - _fields_ = [ - ("image_id", td_u32), - ("structure_version", td_u32), - ("structure_length", td_u32), - ("signature_length", td_u32), - ("key_owner_id", td_u32), - ("key_id", td_u32), - ("key_alg", td_u32), - ("ecc_curve_type", td_u32), - ("key_length", td_u32), - ("key_version_ext", td_u32), - ("mask_key_version_ext", td_u32), - ("msid_ext", td_u32), - ("mask_msid_ext", td_u32), - ("maintenance_mode", td_u32), - ("die_id", td_u8 * 16), - ("code_info_addr", td_u32), - ("reserved", td_u8 * 52), - ("ext_pulic_key_area", td_u8 * 64), - ("sig_key_area", td_u8 * 64), - ] - -class image_code_area(Structure): - _fields_ = [ - ("image_id", td_u32), - ("structure_version", td_u32), - ("structure_length", td_u32), - ("signature_length", td_u32), - ("version_ext", td_u32), - ("mask_version_ext", td_u32), - ("msid_ext", td_u32), - ("mask_msid_ext", td_u32), - ("code_area_addr", td_u32), - ("code_area_len", td_u32), - ("code_area_hash", td_u8 * 32), - ("code_enc_flag", td_u32), - ("protection_key_l1", td_u8 * 16), - ("protection_key_l2", td_u8 * 16), - ("iv", td_u8 * 16), - ("code_compress_flag", td_u32), - ("code_uncompress_len", td_u32), - ("text_segment_size", td_u32), - ("reserved", td_u8 * 248), - ("sig_code_info", td_u8 * 16), - ("sig_code_info_ext", td_u8 * 16), - ] - -class imageInfo: - def __init__(self, path): - with open(path, 'rb') as fp: - image_bin = fp.read() - key_ver = image_bin[36:40] - key_mask = image_bin[40:44] - key_area_len = sizeof(image_key_area) - code_ver = image_bin[key_area_len + 16:key_area_len + 20] - code_mask = image_bin[key_area_len + 20:key_area_len + 24] - self.key_ver = struct.unpack("I", key_ver) - self.key_mask = struct.unpack("I", key_mask) - self.code_ver = struct.unpack("I", code_ver) - self.code_mask = struct.unpack("I", code_mask) - -def fota_format_init(upg_format_path): - sys.path.append(upg_format_path) - from fota_format_st import fota_key_area_data_fields, fota_info_area_data_fields - fota_key_area_data._fields_ = fota_key_area_data_fields - fota_info_area_data._fields_ = fota_info_area_data_fields - -def hex2dec(string_num): - return int(string_num.upper(), 16) - -def fill_fota_key_area(cf, key_ver, key_mask): - key_area_len = sizeof(fota_key_area_data) - temp_offset = [0] - temp_offset[0] = temp_offset[0] + key_area_len - fota_key_bin_tmp = bytearray(temp_offset[0]) - fota_key_bin = fota_key_bin_tmp[0:key_area_len] - fota_key_head = fota_key_area_data.from_buffer(fota_key_bin) - - fota_key_head.image_id = hex2dec(cf.get('FOTA_KEY_AREA', 'ImageId')) - fota_key_head.struct_version = hex2dec(cf.get('FOTA_KEY_AREA', 'StructVersion')) - fota_key_head.struct_length = key_area_len - fota_key_head.key_owner_id = int(cf.get('FOTA_KEY_AREA', 'KeyOwnerId')) - fota_key_head.key_id = int(cf.get('FOTA_KEY_AREA', 'KeyId')) - fota_key_head.key_alg = hex2dec(cf.get('FOTA_KEY_AREA', 'KeyAlg')) - if (fota_key_head.key_alg == 0x2A13C856 or fota_key_head.key_alg == 0x2A13C867): - fota_key_head.signature_length = 32 - else: - fota_key_head.signature_length = sizeof(fota_key_head.sig_fota_key_area) - fota_key_head.ecc_curve_type = 0 - fota_key_head.key_length = 0 - # fota_key_head.fota_key_version_ext = key_ver # Version of FOTA_External_Public_Key - # fota_key_head.mask_fota_key_version_ext = key_mask - fota_key_head.fota_key_version_ext = hex2dec(cf.get('FOTA_KEY_AREA', 'KeyVersion')) - fota_key_head.mask_fota_key_version_ext = hex2dec(cf.get('FOTA_KEY_AREA', 'KeyVersionMask')) - - fota_key_head.msid_ext = hex2dec(cf.get('FOTA_KEY_AREA', 'Msid')) - fota_key_head.mask_msid_ext = hex2dec(cf.get('FOTA_KEY_AREA', 'MsidMask')) - fota_key_head.maintenance_mode = 0 - # fota_key_head.die_id = 0 - fota_key_head.fota_info_addr = 0 # 相对fota key区末尾的地址,0表示key area后接fota info区 - # 剩下3个:预留区、公钥、签名由签名工具填充 - return key_area_len, fota_key_bin - -def fill_fota_info_area(cf, image_num, fota_obj): - area_len = sizeof(fota_info_area_data) - key_alg = hex2dec(cf.get('FOTA_KEY_AREA', 'KeyAlg')) - temp_offset = [0] - temp_offset[0] = temp_offset[0] + area_len - upg_bin = bytearray(temp_offset[0]) - upg_bin = upg_bin[0:area_len] - fota_info_head = fota_info_area_data.from_buffer(upg_bin) - - fota_info_head.image_id = hex2dec(cf.get('FOTA_INFO_AREA', 'ImageId')) - fota_info_head.struct_version = hex2dec(cf.get('FOTA_INFO_AREA', 'StructVersion')) - fota_info_head.struct_length = area_len - if (key_alg == 0x2A13C856 or key_alg == 0x2A13C867): - fota_info_head.signature_length = 32 - else: - fota_info_head.signature_length = sizeof(fota_info_head.sign_fota_info) - fota_info_head.fota_version_ext = hex2dec(cf.get('FOTA_INFO_AREA', 'Version')) - fota_info_head.mask_fota_version_ext = hex2dec(cf.get('FOTA_INFO_AREA', 'VersionMask')) - fota_info_head.msid_ext = hex2dec(cf.get('FOTA_INFO_AREA', 'Msid')) - fota_info_head.mask_msid_ext = hex2dec(cf.get('FOTA_INFO_AREA', 'MsidMask')) - # fota_info_head.image_hash_table_addr = 0 # 所有镜像处理完后再计算hash - # fota_info_head.image_hash_table_length = 0 - # fota_info_head.image_hash_table_hash = 0 - fota_info_head.image_num = image_num - fota_info_head.hardware_id = int(cf.get('FOTA_INFO_AREA', 'HardwareID')) - if hasattr(fota_obj, 'hardware_id') and fota_info_head.hardware_id == 0: - fota_info_head.hardware_id = fota_obj.hardware_id - - #fota_info_head.reserved = 0 # 预留给用户 - #fota_info_head.sign_fota_info = 0 # 签名 - - return area_len, upg_bin - -def set_fota_info_area(fota_info_len, upg_bin, hash_table_addr, hash_table_length, hash_table_hash): - tmp_bin = upg_bin[0:fota_info_len] - fota_info_head = fota_info_area_data.from_buffer(tmp_bin) - fota_info_head.image_hash_table_addr = hash_table_addr - fota_info_head.image_hash_table_length = hash_table_length - tmp_bin[40:72] = hash_table_hash[0:32] # 填充fota_info_head.image_hash_table_hash - upg_bin[0:fota_info_len] = tmp_bin - return - -def make_sha256_unsecure_signature(content): - # common段非安全签名 - # Non-secure signature of common field - signature_bin = bytearray(sizeof(upg_sha256_sign)) - signature = upg_sha256_sign.from_buffer(signature_bin) - common_head_sh = hashlib.sha256() - common_head_sh.update(content) - common_head_hash = common_head_sh.digest() - signature_bin[0:sizeof(signature.check_sum)] = common_head_hash - return signature_bin - -def fill_fota_image_hash_node(hash_bin, image_id, image_index, tmp_hash, addr_offset, image_length): - hash_node_size = sizeof(fota_image_hash_node) - start_offset = image_index * hash_node_size - tmp_hash_bin = bytearray(hash_node_size) - fota_hash= fota_image_hash_node.from_buffer(tmp_hash_bin) - - fota_hash.image_id = image_id - fota_hash.image_addr = addr_offset - fota_hash.image_length = image_length - tmp_hash_bin[12:44] = tmp_hash[0:32] - - hash_bin[start_offset:start_offset + hash_node_size] = tmp_hash_bin - return - -def lzma_compress_bin(src_file, dst_file, lzma_tool): - # print('lzma compress tool :', lzma_tool) - # print('lzma src file :', src_file) - # print('lzma out file :', dst_file) - cmd_list0 = [] - if platform.system().lower() == "linux": - cmd_list0.append('chmod') - cmd_list0.append('755') - cmd_list0.append(lzma_tool) - elif platform.system().lower() == "windows": - cmd_list0.append('cacls') - cmd_list0.append(lzma_tool) - cmd_list0.append('/p everyone:f /e') - str_cmd=' '.join(cmd_list0) - ret = subprocess.run(str_cmd, shell=True) - if ret.returncode != 0: - sys.exit("chmod lzma tool failed: %s" % ret) - - cmd_list = [] - cmd_list.append(lzma_tool) - cmd_list.append('-d12 -lc0 -lp0 e') - cmd_list.append(src_file) - cmd_list.append(dst_file) - str_cmd=' '.join(cmd_list) - ret = subprocess.run(str_cmd, shell=True) - if ret.returncode != 0: - sys.exit("run lzma tool failed: %s" % ret) - -def build_diff_cfg_file(fota_obj, basename, image_pairs, image_bin_file): - diff_cfg_file = os.path.join(fota_obj.temp_dir, '%s_diff.cfg'%basename) - diff_cfg_content = [ - 'OldVersionFile="%s"' % image_pairs[0], - 'NewVersionFile="%s"' % image_pairs[1], - 'DiffFile="%s"' % image_bin_file - ] - remove_file(diff_cfg_file) - create_dirs(os.path.dirname(diff_cfg_file)) - with open(diff_cfg_file, 'w') as fp: - fp.write('\n'.join(diff_cfg_content)) - return diff_cfg_file - -# 解密要求16byte对齐,将lzma压缩头填充至16字节对齐:[head(13byte) + body(N byte)] -> [head(16byte) + body(N byte)] -def fill_lzma_head(upg_lzma_file, filepath, filename): - temp_offset3 = [0] - dst_bin = bytearray(temp_offset3[0]) - file_sta = os.stat(upg_lzma_file) - image_len = file_sta.st_size - with open(upg_lzma_file, 'rb') as fp: - src_bin= fp.read() - head_len = 13; # lzma压缩头长度 - align_len = 16 # 16byte对齐后的lzma压缩头长度 - - dst_bin[0:head_len] = src_bin[0:head_len] - dst_bin[head_len:align_len] = bytearray(align_len - head_len) - dst_bin[align_len:align_len + image_len - head_len] = src_bin[head_len:image_len] - remove_file(upg_lzma_file) - dst_lzma_file = upg_lzma_file - with open(dst_lzma_file, 'wb') as fp: - fp.write(dst_bin) - return dst_lzma_file - -def get_image_bin_data(fota_image, image_confg_key, fota_obj): - image_bin_file = fota_obj.input_dict.get(image_confg_key) - fota_image.new_image_len = os.stat(image_bin_file).st_size - (filepath, tempfilename) = os.path.split(image_bin_file) - (filename, extension) = os.path.splitext(tempfilename) - if fota_image.image_id == 0xCB9E063C: # NV镜像不做处理,保持原数据 - pass - elif fota_image.decompress_flag == 0x3C7896E1: # 压缩ID - # 制作压缩升级文件 - upg_lzma_file = os.path.join(filepath, '%s.lzma'%filename) - lzma_compress_bin('"%s"' % image_bin_file, '"%s"' % upg_lzma_file, fota_obj.lzma_tool) - image_bin_file = fill_lzma_head(upg_lzma_file, filepath, filename) - elif fota_image.decompress_flag == 0x44494646: # 差分ID - # 制作差分升级文件 - if fota_obj.diff_image_info == None: - sys.exit("[ERROR] diff image dict is None!!!") - image_pairs = fota_obj.diff_image_info.get(image_confg_key) - if image_pairs == None: - sys.exit("[ERROR] diff bin is None!!!") - # 镜像头记录新老镜像长度 - fota_image.old_image_len = os.stat(image_pairs[0]).st_size - fota_image.new_image_len = os.stat(image_pairs[1]).st_size - # 制作旧镜像hash - with open(image_pairs[0], 'rb') as fp: # file为旧镜像 - old_image_bin = fp.read() - old_image_hash = make_sha256_unsecure_signature(old_image_bin) - fota_image.old_image_hash[:] = old_image_hash[0:32] - # 差分后的镜像 - image_bin_file = os.path.join(os.path.dirname(image_pairs[1]), '%s_diff.bin'%filename) - # 差分配置文件 - diff_cfg_file = build_diff_cfg_file(fota_obj, filename, image_pairs, image_bin_file) - cmd = ' '.join([fota_obj.upg_tool, '4', '"%s"' % diff_cfg_file]) - ret = subprocess.run(cmd, shell=True) - if ret.returncode != 0: - sys.exit("run diff tool failed: %d" % ret) - with open(image_bin_file, 'rb') as fp: # 不压缩时新镜像和原镜像一致, file为原镜像 - image_bin= fp.read() - file_stats = os.stat(image_bin_file) - return image_bin, file_stats.st_size - -def fill_fota_image_head(fota_image, cf, image_confg_key, start_offset, image_offset, fota_image_head_size): - fota_image.header_magic = hex2dec(cf.get(image_confg_key, 'HeaderMagic')) - fota_image.image_id = hex2dec(cf.get(image_confg_key, 'ImageId')) - fota_image.image_offset = start_offset + image_offset + fota_image_head_size - fota_image.old_image_len = 0 - fota_image.new_image_len = 0 - # fota_image.version_ext = int(''.join(map(str, info.code_ver))) - # fota_image.version_mask = int(''.join(map(str, info.code_mask))) - fota_image.version_ext = hex2dec(cf.get(image_confg_key, 'version_ext')) - fota_image.version_mask = hex2dec(cf.get(image_confg_key, 'version_mask')) - fota_image.decompress_flag = hex2dec(cf.get(image_confg_key, 'DecompressFlag')) - fota_image.re_enc_flag = hex2dec(cf.get(image_confg_key, 'ReRncFlag')) - fota_image.root_key_type = hex2dec(cf.get(image_confg_key, 'RootKeyType')) - -def get_image_bin_final(image_bin, image_len): - temp_offset1 = [0] - image_bin_1 = bytearray(temp_offset1[0]) - image_bin_1[0:image_len] = image_bin - tmp = image_len % 16 - - if tmp != 0: # 对镜像长度按照16B对齐 - tmp_hash_bin = bytearray(16 - tmp) - image_bin_1[image_len:image_len + 16 - tmp] = tmp_hash_bin - image_len = image_len + 16 - tmp - return image_bin_1, image_len - -def fill_fota_image_secure_head(upg_bin, fota_image, cf, image_confg_key, image_bin): - tmp_hash = make_sha256_unsecure_signature(image_bin) - fota_image.image_hash[0:32] = tmp_hash[0:32] # 填充fota_image.image_hash - # 填充加密字段 - ReRncFlag = cf.get(image_confg_key, 'ReRncFlag') - if ReRncFlag == "0x3C7896E1": - fota_image_head_size = sizeof(fota_image_head) - if cf.get(image_confg_key, 'ProtectionKeyL1') != "": - data_byte1 = bytes.fromhex(cf.get(image_confg_key, 'ProtectionKeyL1')) - fota_image.enc_pk_l1[0:16] = data_byte1 - if cf.get(image_confg_key, 'ProtectionKeyL2') != "": - data_byte2 = bytes.fromhex(cf.get(image_confg_key, 'ProtectionKeyL2')) - fota_image.enc_pk_l2[0:16] = data_byte2 - if cf.get(image_confg_key, 'Iv') != "": - data_byte3 = bytes.fromhex(cf.get(image_confg_key, 'Iv')) - fota_image.iv[0:16] = data_byte3 - -def create_encry_cfg(fota_obj, upg_align_file, upg_encry_file): - remove_file(fota_obj.encry_conf_file) - create_dirs(os.path.dirname(fota_obj.encry_conf_file)) - # 从基础文件中读取SIGN_CFG段,并写入到加密配置文件 - with open(fota_obj.encry_conf_file, 'w') as pro_file: - for item in fota_obj.base_cfg.items("SIGN_CFG"): - if item[0] == 'UpgImagePath': - pro_file.write('SrcFile="%s"\n'%upg_align_file) - elif item[0] == 'UpgSignedImagePath': - pro_file.write('DstFile="%s"\n'%upg_encry_file) - elif item[0] == 'SignSuite': - pro_file.write('SignSuite=1\n') - for item in fota_obj.base_cfg.items("application"): - if item[0] == 'PlainKey': - pro_file.write('PlainKey=%s\n'%item[1]) - if item[0] == 'Iv': - pro_file.write('Iv=%s\n'%item[1]) - -def encry_ota_image(cf, image_confg_key, image_bin_1, fota_obj): - image_bin_file = fota_obj.input_dict.get(image_confg_key) - (filepath, tempfilename) = os.path.split(image_bin_file) - (filename, extension) = os.path.splitext(tempfilename) - - upg_align_file = os.path.join(filepath, '%s.lzma.align'%filename) # 压缩并16字节对齐的文件 - upg_encry_file = os.path.join(filepath, '%s.lzma.encry'%filename) # 加密文件 - with open(upg_align_file, 'wb+') as fp: - fp.write(image_bin_1) - - create_encry_cfg(fota_obj, upg_align_file, upg_encry_file) - cmd = ' '.join([fota_obj.upg_tool, '5', '"%s"' % fota_obj.encry_conf_file]) - subprocess.run(cmd, shell=True) - with open(upg_encry_file, 'rb') as fp: - image_bin_1= fp.read() - return image_bin_1 - -def fill_fota_image(cf, image_confg_key, all_image_bin, fota_obj, start_offset, image_offset): - # 根据对应核的配置填充升级镜像头 - fota_image_head_size = sizeof(fota_image_head) - upg_bin = bytearray(fota_image_head_size) - fota_image = fota_image_head.from_buffer(upg_bin) - fill_fota_image_head(fota_image, cf, image_confg_key, start_offset, image_offset, fota_image_head_size) - - # 根据升级文件方式标志,将当前镜像处理获得新镜像(压缩、差分、原镜像三者之一) - image_bin, image_len= get_image_bin_data(fota_image, image_confg_key, fota_obj) - print("old_image_len: ", fota_image.old_image_len, - "new_image_len: ", fota_image.new_image_len, - "recovery image_len: ", image_len) - - # 最终的镜像本体, 将镜像数据做对齐处理 - image_bin_1, image_bin_1_len = get_image_bin_final(image_bin, image_len) - fota_image.image_len = image_bin_1_len - - # 加密 - ReRncFlag = cf.get(image_confg_key, 'ReRncFlag') - if ReRncFlag == "0x3C7896E1": - image_bin_1 = encry_ota_image(cf, image_confg_key, image_bin_1, fota_obj) - - # 头部安全填充 - fill_fota_image_secure_head(upg_bin, fota_image, cf, image_confg_key, image_bin_1) - - # 组合镜像 - # 1. 头部填充 - head_end = start_offset + fota_image_head_size - all_image_bin[start_offset:head_end] = upg_bin - - # 2. 镜像本体填充 - img_end = head_end + image_bin_1_len - all_image_bin[head_end:img_end] = image_bin_1 - return fota_image_head_size + image_bin_1_len - -def make_upg(fota_obj): - cf = fota_obj.base_cfg - temp_offset = [0] - upg_bin = bytearray(temp_offset[0]) - image_num = len(fota_obj.input_dict) - - # FOTA Key Area 填充 - # version字段暂来自配置文件,因此key area填充放到最前面 - fota_key_len, fota_key_bin_buff = fill_fota_key_area(cf, 0, 0) - # fota_info区填充(除hash以外,hash数据最后再填充) - fota_info_len, fota_info_bin_buff = fill_fota_info_area(cf, image_num, fota_obj) - - hash_node_offset = fota_key_len + fota_info_len - all_hash_node_len = image_num * sizeof(fota_image_hash_node) - tmp = all_hash_node_len % 16 - if tmp != 0: - all_hash_node_len = all_hash_node_len + 16 - tmp - # hash node 尾部多余长度 - tmp_hash_bin = bytearray(16 - tmp) - - image_offset = hash_node_offset + all_hash_node_len - all_image_len = 0 - temp_offset1 = [0] - all_image_bin = bytearray(temp_offset1[0]) - temp_offset2 = [0] - all_hash_bin_buff = bytearray(temp_offset2[0]) - - image_index = 0 - for image_confg_key in fota_obj.input_dict: - #image_confg_key = 'IMAGE_' + str(i + 1) - image_id = hex2dec(cf.get(image_confg_key, 'ImageId')) - - # 填充升级镜像头部结构,返回镜像总长度(压缩后的实际长度,不包含对齐的长度)和头结构的总长度、头部的非安全hash - image_length = fill_fota_image(cf, image_confg_key, all_image_bin, fota_obj, all_image_len, image_offset) - head_hash = make_sha256_unsecure_signature(all_image_bin[all_image_len : all_image_len + sizeof(fota_image_head)]) - # 计算下一个镜像的起始位置和偏移位置 - addr_offset = all_image_len + image_offset - all_image_len = all_image_len + image_length - print(image_confg_key, ':', image_length, ': addr_offset:', addr_offset) - # 将计算出来的镜像头hash放到hash段的bin中,并初始化hash的结构 - fill_fota_image_hash_node(all_hash_bin_buff, image_id, image_index, head_hash, addr_offset, image_length) - image_index += 1 # 镜像索引递增 - - if tmp != 0: - all_hash_bin_buff[all_hash_node_len - len(tmp_hash_bin):all_hash_node_len] = tmp_hash_bin - - # 计算hash table表hash值,填到fota_info_area - hash_table_hash = make_sha256_unsecure_signature(all_hash_bin_buff) - set_fota_info_area(fota_info_len, fota_info_bin_buff, hash_node_offset, all_hash_node_len, hash_table_hash) - - upg_bin[0:fota_key_len] = fota_key_bin_buff - upg_bin[fota_key_len:fota_key_len + fota_info_len] = fota_info_bin_buff - upg_bin[hash_node_offset:hash_node_offset + all_hash_node_len] = all_hash_bin_buff - upg_bin[image_offset:image_offset + all_image_len] = all_image_bin - remove_file(fota_obj.upg_image) - create_dirs(os.path.dirname(fota_obj.upg_image)) - with open(fota_obj.upg_image, 'wb+') as fp: - fp.write(upg_bin) - # print_upg(upg_bin, fota_obj.upg_image) - return - -def print_upg_byte_list(pname, byte_in): - length = len(byte_in) - print("[%s=0x"%pname, end="") - for i in range(0, length): - print("%02x"%byte_in[i], end="") - print("]") - -def print_upg_byte(pname, byte_in): - length = len(byte_in) - print("[%s ="%pname) - for i in range(0, length): - if (i + 1) % 16 != 0: - print("0x%02x, " % byte_in[i], end="") - elif (i + 1) == length: - print("0x%02x]" % byte_in[i]) - else: - print("0x%02x, " % byte_in[i]) - -def print_fota_key_area(fota_key_head): - print("[image_id=0x%x]" % (fota_key_head.image_id)) - print("[struct_version=0x%x]" % (fota_key_head.struct_version)) - print("[struct_length=0x%x]" % (fota_key_head.struct_length)) - print("[signature_length=0x%x]" % (fota_key_head.signature_length)) - print("[key_owner_id=0x%x]" % (fota_key_head.key_owner_id)) - print("[key_id=0x%x]" % (fota_key_head.key_id)) - print("[key_alg=0x%x]]" % (fota_key_head.key_alg)) - print("[ecc_curve_type=0x%x]" % (fota_key_head.ecc_curve_type)) - print("[key_length=0x%x]]" % (fota_key_head.key_length)) - print("[fota_key_version_ext=0x%x]" % (fota_key_head.fota_key_version_ext)) - print("[mask_fota_key_version_ext=0x%x]" % (fota_key_head.mask_fota_key_version_ext)) - print("[msid_ext=0x%x]" % (fota_key_head.msid_ext)) - print("[mask_msid_ext=0x%x]" % (fota_key_head.mask_msid_ext)) - print("[maintenance_mode=0x%x]" % (fota_key_head.maintenance_mode)) - print_upg_byte("die_id", fota_key_head.die_id) - print("[fota_info_addr=0x%x]]" % (fota_key_head.fota_info_addr)) - #print_upg_byte("reserved", fota_key_head.reserved) - print_upg_byte("fota_external_public_key", fota_key_head.fota_external_public_key) - print_upg_byte("sig_fota_key_area", fota_key_head.sig_fota_key_area) - -def print_fota_info_area(fota_info_head): - print("[image_id=0x%x]" % (fota_info_head.image_id)) - print("[struct_version=0x%x]" % (fota_info_head.struct_version)) - print("[struct_length=0x%x]" % (fota_info_head.struct_length)) - print("[signature_length=0x%x]" % (fota_info_head.signature_length)) - print("[fota_version_ext=0x%x]" % (fota_info_head.fota_version_ext)) - print("[mask_fota_version_ext=0x%x]" % (fota_info_head.mask_fota_version_ext)) - print("[msid_ext=0x%x]" % (fota_info_head.msid_ext)) - print("[mask_msid_ext=0x%x]" % (fota_info_head.mask_msid_ext)) - print("[image_hash_table_addr=0x%x]" % (fota_info_head.image_hash_table_addr)) - print("[image_hash_table_length=0x%x]" % (fota_info_head.image_hash_table_length)) - #print_upg_byte("image_hash_table_hash", fota_info_head.image_hash_table_hash) - print_upg_byte_list("image_hash_table_hash", fota_info_head.image_hash_table_hash) - print("[image_num=0x%x]" % (fota_info_head.image_num)) - print("[hardware_id=0x%x]" % (fota_info_head.hardware_id)) - #print_upg_byte("reserved", fota_info_head.reserved) - print_upg_byte("sign_fota_info", fota_info_head.sign_fota_info) - -def print_fota_image_hash_table(fota_image_hash_table): - print("[image_id=0x%x]" % (fota_image_hash_table.image_id)) - print("[image_addr=0x%x]" % (fota_image_hash_table.image_addr)) - print("[image_length=0x%x]" % (fota_image_hash_table.image_length)) - #print_upg_byte("image_hash", fota_image_hash_table.image_hash) - print_upg_byte_list("image_hash", fota_image_hash_table.image_hash) - -def print_fota_image_head(image_head): - print("[header_magic=0x%x]" % (image_head.header_magic)) - print("[image_id=0x%x]" % (image_head.image_id)) - print("[image_offset=0x%x]" % (image_head.image_offset)) - print("[image_len=0x%x]" % (image_head.image_len)) - print("[new_image_len=0x%x]" % (image_head.new_image_len)) - #print_upg_byte("new_image_hash", image_head.new_image_hash) - print_upg_byte_list("image_hash", image_head.image_hash) - print("[old_image_len=0x%x]" % (image_head.old_image_len)) - print_upg_byte_list("old_image_hash", image_head.old_image_hash) - #print_upg_byte("old_image_hash", image_head.old_image_hash) - print("[version_ext=0x%x]" % (image_head.version_ext)) - print("[version_mask=0x%x]" % (image_head.version_mask)) - print("[decompress_flag=0x%x]" % (image_head.decompress_flag)) - print("[root_key_type=0x%x]" % (image_head.root_key_type)) - print("[re_enc_flag=0x%x]" % (image_head.re_enc_flag)) - print_upg_byte("enc_pk_l1", image_head.enc_pk_l1) - print_upg_byte("enc_pk_l2", image_head.enc_pk_l2) - print_upg_byte("iv", image_head.iv) - #print_upg_byte("padding", image_head.padding) - -def print_upg(upg_bin, image_file): - print("upg_bin_len %s"%len(upg_bin)) - print("-------------%s fota_key_area start-------------" % (image_file)) - fota_key_head = fota_key_area_data.from_buffer(upg_bin) - key_area_len = fota_key_head.struct_length - print_fota_key_area(fota_key_head) - print("-------------%s fota_info_area start-------------" % (image_file)) - if fota_key_head.fota_info_addr == 0: - fota_info_offset = key_area_len - else: - fota_info_offset = fota_key_head.fota_info_addr - fota_info_head = fota_info_area_data.from_buffer(upg_bin[fota_info_offset:]) - print_fota_info_area(fota_info_head) - - image_num = fota_info_head.image_num - hash_node_size = sizeof(fota_image_hash_node) - if fota_info_head.image_hash_table_addr == 0: - hash_table_offset = fota_info_offset + key_area_len - else: - hash_table_offset = fota_info_head.image_hash_table_addr - - for i in range(0, image_num): - print("-------------fota hash table start NO.%02d-------------" % (i + 1)) - hash_table_info = fota_image_hash_node.from_buffer(upg_bin[hash_table_offset + i * hash_node_size:]) - print_fota_image_hash_table(hash_table_info) - print("-------------fota image head start NO.%02d-------------" % (i + 1)) - image_head_offset = hash_table_info.image_addr - image_head = fota_image_head.from_buffer(upg_bin[image_head_offset:]) - print_fota_image_head(image_head) - -def get_parameters(): - parser = argparse.ArgumentParser() - - parser.add_argument('-app_name', type=str, default='', - help='生成镜像的应用名') - - parser.add_argument('-upg_format_path', type=str, default='', - help='升级包结构配置文件') - - parser.add_argument('-base', type=str, default='', - help='基础配置文件路径') - - parser.add_argument('-temp_dir', type=str, default='', - help='临时配置文件路径') - - parser.add_argument('-old_images', type=str, default='', - help='老版本镜像文件路径') - - parser.add_argument('-new_images', type=str, default='', - help='新版本镜像文件路径') - - parser.add_argument('-output_dir', type=str, default='', - help='输出文件路径') - - parser.add_argument('-type', type=int, default=0, - help='执行类型') - - parser.add_argument('-sign_tool', type=int, default=0, - help='签名工具选择 0-本地签名工具, 1-在线签名工具') - config = parser.parse_args() - return config - -config_item = ['SignSuite', 'RootKeyFile', 'SubKeyFile', 'SrcFile', 'DstFile'] -class Properties: - def getProperties(self, dir): - # 处理升级配置文件,获取有效配置,将有效配置保存到字典中 - # 各个镜像的配置不一样,这部分也被过滤掉了,后面要怎么区分? - ######################################################################### - properties = {} - with open(dir, 'r', encoding='utf-8') as pro_file: - for line in pro_file: - if line.find('=') > 0 and '#' not in line: - strs = line.replace('\n', '').split('=') - properties[strs[0]] = strs[1] - return properties - - # 获取签名相关的配置 - def setProperties(self, dir, properties): - with open(dir, 'w') as pro_file: - for item in properties: - if item in config_item: - pro_file.write("{}={}\n".format(item, properties[item])) - -def remove_file(path): - if os.path.exists(path): # 如果文件存在 - # 删除文件,可使用以下两种方法。 - os.remove(path) -def create_dirs(path): - os.makedirs(path, exist_ok=True) - -def print_fota_file(image_file): - with open(image_file, 'rb') as fp: - upg_bin = fp.read() - print_upg_byte(image_file, upg_bin) - - -class myconf(configparser.ConfigParser): - def __init__(self, defaults=None): - configparser.ConfigParser.__init__(self, defaults=defaults) - - # 这里重写了optionxform方法,直接返回选项名 - def optionxform(self, optionstr): - return optionstr - -# def create_upg_cfg(base, input, conf_dir): -def create_upg_cfg(fota_obj): - img_cfg = copy.deepcopy(fota_obj.base_cfg) - cf_list = img_cfg.sections() # 获取所有section,返回值为list - - input_cf_key_list = [] - input_cf_key_list.append('FOTA_KEY_AREA') - input_cf_key_list.append('FOTA_INFO_AREA') - - # 将输入的段加入到列表 - for image_confg_key in fota_obj.input_dict: - input_cf_key_list.append(image_confg_key) - - for item in cf_list: - # 将基础配置文件中,和输入无关的段删除 - if item not in input_cf_key_list: - img_cfg.remove_section(item) - - remove_file(fota_obj.image_conf_file) - print(fota_obj.image_conf_file) - print(os.path.dirname(fota_obj.image_conf_file)) - create_dirs(os.path.dirname(fota_obj.image_conf_file)) - with open(fota_obj.image_conf_file, 'w') as configfile: - img_cfg.write(configfile) - -def create_sign_cfg(fota_obj): - remove_file(fota_obj.sign_conf_file) - create_dirs(os.path.dirname(fota_obj.sign_conf_file)) - # 从基础文件中读取SIGN_CFG段,并写入到签名配置文件 - with open(fota_obj.sign_conf_file, 'w') as pro_file: - for item in fota_obj.base_cfg.items("SIGN_CFG"): - if item[0] == 'UpgImagePath': - pro_file.write('SrcFile="%s"\n'%fota_obj.upg_image) - elif item[0] == 'UpgSignedImagePath': - pro_file.write('DstFile="%s"\n'%fota_obj.upg_signed_image) - elif 'KeyFile' in item[0]: - pro_file.write('%s="%s"\n'% (item[0], os.path.join(fota_obj.root_path, item[1]))) - else: - pro_file.write('%s=%s\n'%item) - for item in fota_obj.base_cfg.items("FOTA_KEY_AREA"): - if item[0] == 'ImageId': - pro_file.write('%s=%s\n'%item) - -def check_fota_image_id(fota_file): - # 各个镜像的image_id需保证不一致 - cf = myconf() - cf.read(fota_file, encoding='utf-8') - cf_list = cf.sections() - image_id_dict = {} - no_sections = ['FOTA_KEY_AREA', 'FOTA_INFO_AREA'] - if cf.get('FOTA_KEY_AREA', 'ImageId') != cf.get('FOTA_INFO_AREA', 'ImageId'): - msg = "FOTA_KEY_AREA and FOTA_INFO_AREA have different ImageId.\n" - sys.exit(msg) - for section in cf_list: - if section in no_sections: - continue - image_id = cf.get(section, 'ImageId') - if image_id in image_id_dict: - msg = "The ImageId of %s and %s are the same.\n" % (section, image_id_dict.get(image_id)) - sys.exit(msg) - else: - image_id_dict[image_id] = section - -def check_image_key(input_dict): - # 检查nv是否与主程序一起打包 - pkg_bin_list = input_dict.keys() - if 'nv' in pkg_bin_list and 'application' not in pkg_bin_list: - msg = "The NV cannot be packed separately.It has to be with application!\n" - sys.exit(msg) - - # 检查索引文件与资源文件是否在一起打包 - if 'res_data' in pkg_bin_list and 'res_index' not in pkg_bin_list: - msg = "The res_index file and res_data should be together.\n" - sys.exit(msg) - -def sign_upg_file(fota_obj): - if fota_obj.sign_tool == 1: - # 在线签名,将不会在fota_obj.output_dir下生成最终升级包文件 - # 需usr自行对fota_obj.temp_dir下的未签名文件update_temp.fwpkg进行签名 - return - cmd = ' '.join([fota_obj.upg_tool, '3', '"%s"' % fota_obj.sign_conf_file]) - subprocess.run(cmd, shell=True) - -class fota_info: - def __init__(self, user_input): - self.root_path = g_root - self.app_name = user_input.app_name - self.temp_dir = user_input.temp_dir - self.output_dir = user_input.output_dir - self.image_conf_file = os.path.join(self.temp_dir, '%s.cfg' % user_input.app_name) # 升级镜像的配置文件 - self.sign_conf_file = os.path.join(self.temp_dir, '%s_sign.cfg' % user_input.app_name) # 升级镜像的签名配置文件 - self.encry_conf_file = os.path.join(self.temp_dir, '%s_encry.cfg' % user_input.app_name) # 升级镜像的加密配置文件 - if hasattr(user_input, 'sign_tool'): - self.sign_tool = user_input.sign_tool - else: - self.sign_tool = 0 - - if hasattr(user_input, 'hardware_id'): - self.hardware_id = user_input.hardware_id - - self.base_cfg = myconf() - self.base_cfg.read(user_input.base, encoding='utf-8') - self._set_upg_image_path() - self._set_tool_path() - - self.input_dict = self._split_input_info(user_input.new_images) - self.original_dict = self._split_input_info(user_input.old_images) - print("input_dict:", self.input_dict) - print("original_dict:", self.original_dict) - self.diff_image_info = self._get_image_path_for_diff_image(self.input_dict, self.original_dict) # 差分镜像信息 - - def _set_tool_path(self): - if platform.system().lower() == "linux": - self.upg_tool = self.base_cfg.get('TOOLS', 'UpgToolPath') - self.lzma_tool = self.base_cfg.get('TOOLS', 'LzmaToolPath') - elif platform.system().lower() == "windows": - self.upg_tool = self.base_cfg.get('TOOLS', 'UpgToolWinPath') - self.lzma_tool = self.base_cfg.get('TOOLS', 'LzmaToolWinPath') - self.upg_tool = '"%s"' % os.path.join(self.root_path, self.upg_tool) - self.lzma_tool = '"%s"' % os.path.join(self.root_path, self.lzma_tool) - print(self.upg_tool) - print(self.lzma_tool) - - def _set_upg_image_path(self): - self.upg_image = self.base_cfg.get('SIGN_CFG', 'UpgImagePath') - self.upg_signed_image = self.base_cfg.get('SIGN_CFG', 'UpgSignedImagePath') - if self.upg_image == '': - self.upg_image = os.path.join(self.temp_dir, '%s_temp.fwpkg' % self.app_name) - if self.upg_signed_image == '': - self.upg_signed_image = os.path.join(self.output_dir, '%s.fwpkg' % self.app_name) - - def _split_input_info(self, input): - input = input.replace('\n','').replace('\r','').replace('\t','') - if input == '': - return None - - bin_list = input.split('|') - image_num = len(bin_list) - bin_dict = {} - res_data = "" - for i in range(0, image_num): - bin_file, image_confg_key = bin_list[i].split('=') - if image_confg_key == "res_data": - res_data = bin_file - else: - bin_dict[image_confg_key] = bin_file - - if res_data != "": - bin_dict["res_data"] = res_data - - return bin_dict - - def _get_image_path_for_diff_image(self, new_version_dict, org_version_dict): - # 解析各个镜像的老版本镜像路径、新版本路径,并一一对应 - # 制作差分升级文件的镜像需要提供老版本文件路径,提供老版本的同时也必须提供对应的新版本路径 - if org_version_dict == None: - return None - - image_ref = {} - for image_confg_key in org_version_dict: - if image_confg_key in image_ref: - sys.exit("[ERROR] old_images bin param repeated!!!") - image_ref[image_confg_key] = [ - org_version_dict[image_confg_key], # 存放老镜像路径 - "", # 存放新镜像路径 - "" # 存放镜像路径的前缀,取新路径前缀 - ] - - for image_confg_key in new_version_dict: - if image_confg_key in image_ref: - image_ref[image_confg_key][1] = new_version_dict[image_confg_key] # 后存放新版本镜像到1 - image_ref[image_confg_key][2] = os.path.splitext(os.path.basename(image_ref[image_confg_key][0]))[0] - - for key in image_ref: - if image_ref[key][1] == "": - sys.exit("[ERROR] not find a matched image bin!!!") - return image_ref - -def create_fota_file(user_input): - fota_format_init(user_input.upg_format_path) - fota_obj = fota_info(user_input) - print("root_path:", fota_obj.root_path) - # 检查打包镜像限制 - check_image_key(fota_obj.input_dict) - # 生成镜像配置文件 - create_upg_cfg(fota_obj) - # 镜像ID校验 - check_fota_image_id(fota_obj.image_conf_file) - # 升级文件制作 - make_upg(fota_obj) - # 生成签名配置文件 - create_sign_cfg(fota_obj) - # 升级文件签名 - sign_upg_file(fota_obj) - -def begin(user_input): - if user_input.type == 0: - create_fota_file(user_input) - else: - print_fota_file(user_input.new_images) - -if __name__ == "__main__": - user_input = get_parameters() - begin(user_input) diff --git a/build/script/check_api_format.py b/build/script/check_api_format.py deleted file mode 100755 index a08550e..0000000 --- a/build/script/check_api_format.py +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -# Description: API format check \n -# -# ============================================================================ - -import re -import os -import sys -import logging - -MODULE_LIST = ["driver", "bts", "wifi", "utils"] -ERROR_LIST = ["td_void", "td_u8", "td_u32", " td_", "(td_"] -logging.basicConfig( - filename="check_api_result.txt", - level=logging.NOTSET, - format='[%(asctime)s] [%(levelname)s] - %(message)s') - - -def file_path_list(folder_path): - logging.debug("Start to read file name list...") - file_paths = [] # 存储目录下的所有文件名,含路径 - for root, _, files in os.walk(folder_path): - for file in files: - file_paths.append(os.path.join(root, file)) - return file_paths - - -def api_read(file_path, api_dic): - txt = "" - if os.path.splitext(file_path)[-1] != ".h": - return api_dic - try: - with open(file_path, 'r') as f: - txt = f.read() - # print(txt) - except OSError as e: - logging.error("OSError file name: %s", file_path) - # raise OSError('invalid encoding byte because {}.'.format(e)) - except UnicodeDecodeError as f: - logging.warning("UnicodeDecodeError file name: %s", file_path) - with open(file_path, 'r') as fin: - try: - for line in fin.readlines(): - txt += line.encode('utf-8', 'ignore').decode('utf-8') - except UnicodeDecodeError as f: - logging.error("line:UnicodeDecodeError file name: %s", file_path) - pass - - res = re.findall(r"/\*\*.+? \* @brief(.*?)\n.*?\*/.*?\n(.*?);", txt, re.S | re.M) - - for i in res: - i = list(i) - if "(" in i[1] and "{" not in i[1] and "#define" not in i[1]: - api_dic[i[1]] = file_path - return api_dic - - -def function_handle(name): - class_name = name.split(" ", 1)[0] - function_name = name.split(" ", 1)[1] - return class_name, function_name - - -def count_duplicate_module(count_dict, module, sub_module): - if "total" in count_dict: - count_dict["total"] += 1 - else: - count_dict["total"] = 1 - - if module in count_dict: - count_dict[module]["total"] += 1 - if sub_module in count_dict[module]: - count_dict[module][sub_module] += 1 - else: - count_dict[module][sub_module] = 1 - else: - count_dict[module] = {} - count_dict[module][sub_module] = 1 - count_dict[module]["total"] = 1 - return count_dict - - -g_tabs_indent_bar = 10 * '-' -g_tabs_indent_space = 10 * ' ' - - -def report_module_api(count_dict, detail): - print("CFBB total APIs:", str(count_dict["total"])) - for module in count_dict: - if module in "total": - continue - print(g_tabs_indent_bar, module, " total APIs:", count_dict[module]["total"]) - if not detail: - continue - module_sum = 0 - for sub_module in count_dict[module]: - if sub_module in "total": - continue - module_sum += count_dict[module][sub_module] - print(g_tabs_indent_space, g_tabs_indent_bar, sub_module, " APIs:\t", count_dict[module][sub_module]) - - if count_dict[module]["total"] != module_sum: - raise ImportError("module_sum APIs is not correct") - - -def save_to_excel(dic, save2file): - if save2file: - try: - import openpyxl - except ImportError: - raise ImportError("please install openpyxl") - wb = openpyxl.Workbook() - wb.create_sheet("log", 0) - ws = wb["log"] - ws.append(["API name", "module name", "file path"]) - - count_dict = {} - for i in dic: - class_name, func_name = function_handle(i) - module_name = "unknown" - for m in MODULE_LIST: - if m in dic[i]: - module_name = m - break - d = ("%s %s" % (class_name, func_name)), module_name, dic[i] - sub_module = os.path.basename(dic[i]) - count_dict = count_duplicate_module(count_dict, module_name, sub_module) - if class_name != "typedef": - if func_name.startswith("uapi_") is not True and module_name == "driver": - logging.error("API format is incorrect(don't start with uapi_): %s", func_name) - if save2file: - ws.append(d) - report_module_api(count_dict, True) - if save2file: - filename = "api_list.xlsx" - wb.save(filename) - logging.info("Saved successfully.") - - -def save_to_txt(dic): - with open("error_api.txt", "w+") as f: - for i in dic.keys(): - f.write(dic[i] + ":" + i + "\n") - - -def print_error_type(dic): - error_dic = {} - for i in dic.keys(): - for n in ERROR_LIST: - if n in i: - error_dic[i] = dic[i] - for i in error_dic.keys(): - print("error type: " + i + ":" + error_dic[i]) - return error_dic - - -def main(): - if len(sys.argv) == 2: - curr_path = sys.argv[1] - else: - curr_path = os.getcwd() - print("curr_path:", curr_path) - if os.path.isdir(curr_path): - path_list = file_path_list(curr_path) - result = {} - for k in path_list: - result = api_read(k, result) - logging.info("API count: %s", len(result)) - error_dic = print_error_type(result) - print(error_dic) - save_to_txt(error_dic) - if error_dic: - return -1 - else: - return 0 - else: - logging.error("error path!") - return -1 - - -if __name__ == '__main__': - - ret = main() - if ret == -1: - print(-1) - else: - print(0) diff --git a/build/script/cmake_builder.py b/build/script/cmake_builder.py deleted file mode 100755 index 57f44ca..0000000 --- a/build/script/cmake_builder.py +++ /dev/null @@ -1,471 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import shutil -import sys -import time -import re - -from utils.build_utils import exec_shell, root_path, output_root, sdk_output_path, pkg_tools_path -from utils.build_utils import compare_bin -from enviroment import TargetEnvironment, BuildEnvironment -from pack_tool import packTool -from sdk_generator.sdk_generator import SdkGenerator -from rom_ram_callback.gen_rom_ram_callback import gen_rom_ram_callback -from rom_ram_callback.strip_undef_symbols import strip_undefined_symbols -from usr_config import mconfig -from custom_cmd import run_custom_cmd -from target_config.common_config import CommonConfig -def copy_file(src, dst): - try: - shutil.copy2(src, dst) - except FileNotFoundError: - print(f"error 01") #文件不存在 - except PermissionError: - print(f"error 02") #没有权限复制 - except Exception as e: - print(f"error 03 [{e}]") #复制文件时发生错误 - -class CMakeBuilder(BuildEnvironment): - """ cmake builder, 接收并解析参数,启动构建 - """ - def __init__(self, param_list): - super(CMakeBuilder, self).__init__(param_list) - self.cmake_cmd = [] - self.sdk = None - self.pack_tool = None - - def get_component(self, env): - com_config = CommonConfig(env.get('arch')) - components = [] - if env.get('just_build_components', False): - just_build_components = env.get('just_build_components', False) - else: - just_build_components = self.component - for component in just_build_components: - if component in env.get('ram_component', False): - components.append(component) - continue - if component not in env.get('ram_component_set', False): - continue - for comm in com_config.get_component_set(component): - if comm in env.get('ram_component', False): - components.append(comm) - return components - - def get_build_cmd(self, env): - ext_cmd = [] - components = self.get_component(env) - ext_cmd.extend(components) - if self.generator == 'Ninja': - return ['ninja'] + ext_cmd + ['-j%d' % self.thread] - else: - return ['make'] + ext_cmd + ['-j%d' % self.thread] - - def build(self): - """ - """ - built_targets = [] - for group in self.group_names: - need_pack = False - if group.startswith('pack'): - need_pack = True - chip = self.get_chip_name(group) - if os.path.exists(os.path.join(output_root, 'package', chip, group)): - shutil.rmtree(os.path.join(output_root, 'package', chip, group)) - - for target in self.get_target_names_by_group_name(group): - self.pack_tool = packTool(group, target) - if self.is_group(target): - self.group_names.append(target) - continue - - if self.is_copy_target(target): - self.pack_tool.pack() - continue - - if target == 'fwpkg' and need_pack: - self.pack_fwpkg(chip, group) - continue - - if not self.is_target(target): - print("Invalid target %s" % target) - raise - if not target in built_targets: - self.build_target(target) - built_targets.append(target) - else: - print("%s has built, skip" % target) - target_env = TargetEnvironment(target, self.extr_defines) - if target_env.get('build_type') == 'SDK': - continue - if need_pack: - self.pack_tool.pack() - - if len(self.target_names) == 1 and self.open_kconfig == True: - self.menuconfig_to_build(self.target_names[0]) - return - - for target in self.target_names: - self.build_target(target) - - def menuconfig_to_build(self, target): - env = TargetEnvironment(target) - mconfig(self.kconfig_param, env.get("chip"), env.get("core"), target, None) - - def build_target(self, target): - env = TargetEnvironment(target, self.extr_defines) - if env.get('build_type') == 'SDK': - self.build_sdk(env) - return - if not run_custom_cmd(env, target, 'build_pre'): - self.print_build_result(target, 1) - sys.exit(1) - - self.compile_target(target, env) - - if env.get('just_build_components'): - return - - if env.get("fs_image"): - fs_image_path = os.path.join(root_path, 'build', 'config', 'target_config', env.get('chip'), 'mk_fs_image') - fs_script_path = os.path.join(fs_image_path, 'mkyaffs2tool.py') - output_path = env.get_output_path() - print(output_path) - errcode = exec_shell([self.python_path, fs_script_path, output_path], None, True) - if errcode != 0: - print("creat fs image error!") - self.print_build_result(target, errcode) - sys.exit(1) - print("fs image success!") - - if env.get('upg_pkg'): - self.pack_fota(env.get('chip'), target, env.get('upg_pkg')) - - if not run_custom_cmd(env, target, 'build_post'): - self.print_build_result(target, 1) - sys.exit(1) - - if env.get('packet') : - self.pack_fwpkg(env.get('chip'), target) - - def build_sdk(self, env): - self.sdk = SdkGenerator(env, sdk_output_path) - if os.path.exists(sdk_output_path): - print("Cleaning SDK output path") - shutil.rmtree(sdk_output_path) - sdk_pkg_target_name = env.get('pkg_target_name', cmake_type=False) - - for sdk_target in sdk_pkg_target_name: - sdk_target_env = TargetEnvironment(sdk_target, self.extr_defines) - output_path = sdk_target_env.get_output_path() - self.compile_target(sdk_target, sdk_target_env) - self.sdk.copy_depends('%s/cmake_trace.txt' % output_path) - if self.sdk.env.get('reload_kconfig'): - cwd = os.getcwd() - os.chdir(sdk_output_path) - mconfig('reloadconfig', sdk_target_env.get("chip"), sdk_target_env.get("core"), sdk_target, None, root=sdk_output_path) - os.chdir(cwd) - - if env.get('config') and 'lib_gen' in env.get('config'): - lib_gen_tasks = env.get('config')['lib_gen'] - print(lib_gen_tasks) - for libs in lib_gen_tasks: - task = lib_gen_tasks[libs] - target_name = task['base_target_name'] - defines = task.get("defines", []) - self.component = task['components'] - target_env = TargetEnvironment(target_name, extra_defines=defines) - target_env.add("LIB_GEN_NAME", libs) - target_env.extend("SDK_LIBGEN_COMPONENTS", self.component) - self.compile_target(target_name, target_env) - self.sdk.sdk_build(self.build_time, self.no_hso, self.build_level) - self.sdk = None - self.component = [] - - def compile_target(self, target_name, env): - start_time = time.time() - self.deal_symbol_link(env) - env.add('build_level', self.build_level) - if self.build_level == "debug": - env.extend("ccflags", ['-funwind-tables', '-fasynchronous-unwind-tables']) - env.extend("defines", "NO_TIMEOUT") - if self.build_as_lib: - env.add("GEN_ONLY_LIB_PATH") - self.cmake_cmd = ['cmake', '-G', self.generator, '-Wno-dev', '--no-warn-unused-cli', '-DCMAKE_C_COMPILER_WORKS=TRUE', '-DCMAKE_CXX_COMPILER_WORKS=TRUE'] - if env.get('fp_enable'): - env.append('defines', 'SUPPORT_CALLSTACK') - env.append('ccflags', '-fno-omit-frame-pointer') - self.add_build_param(env) - - output_path = env.get_output_path() - self.pre_sdk(output_path, env) - if env.get('libstd_option'): - self.add_cmake_def(env, 'std_libs') - self.cmake_cmd.append(root_path) - - if env.get('product_type'): - self.cmake_cmd.append('-DPRODUCT_TYPE={0}'.format(env.get('product_type'))) - else: - self.cmake_cmd.append('-DPRODUCT_TYPE=default') - - if self.dump: - env.dump() - - if self.rom_callback(env, target_name, output_path): - if not os.path.exists(output_path): - os.makedirs(output_path) - env.set('build_rom_callback', False) - env.append('defines', '_PRE_FEATURE_VENEER_ROM') - env.append('ram_component', 'rom_callback') - self.redef_cmake_def(env, 'build_rom_callback') - self.redef_cmake_def(env, 'defines') - self.redef_cmake_def(env, 'ram_component') - self.add_cmake_param("-DROM_CHECK=False") - self.start(env, target_name, output_path, clean=self.need_clean, nhso=self.no_hso) - self.rom_check(env, target_name, output_path) - - end_time = time.time() - print("%s takes %f s" % (target_name, end_time - start_time)) - - def deal_symbol_link(self, env): - if "rom_sym_path" not in env.config: - return - if self.no_symbol_link and not self.sdk: - env.config["rom_sym_path"] = "" - else: - env.config["rom_sym_path"] = env.config["rom_sym_path"].replace("", root_path) - if os.path.exists(env.config["rom_sym_path"]): - env.config["linkflags"].append("-Wl,--just-symbols=" + env.config["rom_sym_path"]) - env.config["defines"].append("ROM_SYMBOL_LINK") - else: - print("ERROR: rom_sym_path %s is not exists" % env.config["rom_sym_path"]) - if "bootrom_sym_path" not in env.config: - return - if env.config["bootrom_sym_path"] != "": - env.config["bootrom_sym_path"] = env.config["bootrom_sym_path"].replace("", root_path) - if os.path.exists(env.config["bootrom_sym_path"]): - env.config["linkflags"].append("-Wl,--just-symbols=" + env.config["bootrom_sym_path"]) - env.config["defines"].append("BOOTROM_SYMBOL_LINK") - else: - print("ERROR: bootrom_sym_path %s is not exists" % env.config["bootrom_sym_path"]) - - def add_build_param(self, env): - for item in env.config: - self.add_cmake_def(env, item) - self.add_cmake_param('-DCMAKE_TOOLCHAIN_FILE=%s' % env.get_tool_chain()) - self.add_cmake_param('-DPY_PATH=%s' % self.python_path) - if self.build_time != '': - self.add_cmake_param('-DBUILD_TIME=%s' % self.build_time) - - def pre_sdk(self, output_path, env): - if not self.sdk: - return - - self.sdk.register_org_target_path(output_path) - self.add_cmake_param('-DSDK_OUTPUT_PATH=%s' % sdk_output_path) - self.add_cmake_def(self.sdk.env, 'sdk_type') - # closed_components takes precedence over open_components - closed_components = self.sdk.env.get('closed_components', cmake_type=False) - open_components = self.sdk.env.get('open_components', cmake_type=False) - if None not in (closed_components, open_components): - raise Exception(f'ERROR! closed_components and open_components cannot be set together!') - self.add_cmake_def(self.sdk.env, 'closed_components') - if not closed_components: - self.add_cmake_def(self.sdk.env, 'open_components') - - self.add_cmake_def(env, 'main_component') - - # export trace of cmake invocation - cmake_trace_file = os.path.join(output_path, 'cmake_trace.txt') - self.cmake_cmd.append('--trace-format=json-v1') - self.cmake_cmd.append('--trace-redirect=%s' % cmake_trace_file) - - def print_build_result(self, target_name, fail): - print("######### Build target:%s %s" % (target_name, "failed" if fail else "success")) - if self.sdk: - print("######### Build sdk %s!!" % ("failed" if fail else "success")) - - def rom_callback(self, env, target_name, output_path): - if not env.get('build_rom_callback'): - return False - if env.get('fixed_rom'): - return True - self.start(env, target_name, output_path, nhso=True, clean=self.need_clean) - print("GENERATING AUTO ROM BIN FILE!!!") - chip = env.get("chip") - core = env.get("core") - board = env.get('board') - application = env.get('application') - arch = env.get('arch') - rom_config = os.path.join(root_path, 'drivers', 'chips', chip, 'rom_config', core) - rom_output = os.path.join(rom_config, 'output') - if not os.path.exists(rom_output): - os.makedirs(rom_output) - - shutil.copy(os.path.join(output_path, "rom_bin_raw.undef"), rom_output) - shutil.copy(os.path.join(output_path, "rom_symbol.list"), rom_output) - shutil.copy(os.path.join(output_path, "rom_bin.rel"), rom_output) - shutil.copy(os.path.join(output_path, "image_symbol.list"), rom_output) - shutil.copy(os.path.join(rom_config, "undef_rom_filter.list"), rom_output) - shutil.copy(os.path.join(rom_config, "region.list"), rom_output) - - strip_undefined_symbols(rom_output) - if arch[:5] == "riscv": - target = "riscv32" - elif arch[:3] == "arm": - target = "arm32" - gen_rom_ram_callback(target, rom_output) - print("ROM CALLBACK BUILD SUCCESSFULLY!!!") - shutil.rmtree(output_path) - return True - - def start(self, env, target_name, output_path, nhso=None, clean=None): - # remember the root folder - def _excute(cmd, log_file, is_dump): - errcode = exec_shell(cmd, log_file, is_dump) - if errcode != 0: - self.print_build_result(target_name, errcode) - sys.exit(1) - org_work_path = os.getcwd() - self.cmake_cmd.append('-DPKG_TARGET_NAME=%s' % target_name) - target_name = target_name.replace('-', "_") - if clean and os.path.exists(output_path): - shutil.rmtree(output_path) - if not os.path.exists(output_path): - os.makedirs(output_path) - self.cmake_cmd.append('-DBUILD_TARGET_NAME=%s' % (target_name)) - self.cmake_cmd.append('-DNHSO=%s' %nhso) - chip = env.get('chip') - core = env.get('core') - - # Generate the menuconfig header. - mconfig_file_path = os.path.join(root_path, 'build', 'config', 'target_config', chip, 'menuconfig', core, f"{target_name}.config") - if os.path.exists(mconfig_file_path): - if env.get('reload_kconfig'): - print("build reload %s" %mconfig_file_path) - mconfig("reloadconfig", chip, core, target_name, output_path) - mconfig("savemenuconfig", chip, core, target_name, output_path) - - os.chdir(output_path) - log_file_name = "build_%s.log" % target_name - log_file = os.path.join(output_root, chip, log_file_name) - - # run 'make' - if self.is_command_refresh(output_path): - self.dump_cmake_command(output_path) - _excute(self.cmake_cmd, log_file, self.dump) - _excute(self.get_build_cmd(env), log_file, self.dump) - else: - ext_cmd = [] - components_target = self.get_component(env) - print(components_target) - if components_target: - ext_cmd = ['--target'] + components_target - _excute(["cmake", "--build", output_path, '-j%d' % self.thread] + ext_cmd, log_file, self.dump) - - if len(self.get_component(env)) > 0: - os.chdir(org_work_path) - print("######### Build target:%s, component:[%s] success" % (target_name, ' '.join(self.get_component(env)))) - return 0 - - if env.is_enable_hso() and not nhso: - cmd = self.get_build_cmd(env) - cmd.append("HSO_DB") - _excute(cmd, log_file, self.dump) - - # switch the work folder back - os.chdir(org_work_path) - self.print_build_result(target_name, 0) - return 0 - - def add_cmake_param(self, param): - """ - accept string only - """ - self.cmake_cmd.append(param) - - def add_cmake_def(self, env, item): - if env.get(item) is None or env.get(item) == '': - return - self.cmake_cmd.append('-D%s=%s' % (item.upper(), env.get(item))) - - def redef_cmake_def(self, env, item): - if env.get(item) is None or env.get(item) == '': - return - val = env.get(item) - item = item.upper() - for i, para in enumerate(self.cmake_cmd): - if not para.startswith('-D%s=' % item): - continue - self.cmake_cmd[i] = '-D%s=%s' % (item, val) - break - - def rom_check(self, env, target_name, output_path): - if env.get('rom_sym_path'): - return True - - if env.get('fixed_rom'): - fix_path = env.get('fixed_rom_path').replace('', root_path) - bin1 = os.path.join(output_path, '%s_rom.bin' % env.get('bin_name')) - bin2 = fix_path - if not compare_bin(bin1, bin2): - print(f"ERROR! :{bin1} is not same with {bin2}") - sys.exit(1) - return True - - if env.get('rom_ram_check'): - self.add_cmake_param("-DROM_CHECK=True") - self.start(env, target_name, output_path, clean=False, nhso=True) - if not env.get('rom_ram_compare'): - return True - bin1 = os.path.join(output_path, '%s_rom.bin' % env.get('bin_name')) - bin2 = os.path.join(output_path, '%s_romcheck_rom.bin' % env.get('bin_name')) - if not compare_bin(bin1, bin2): - print(f"ERROR! :{bin1} is not same with {bin2}") - sys.exit(1) - - def pack_fwpkg(self, chip, target_name): - # bin packet all in one - packet_script_path = os.path.join(pkg_tools_path, 'packet.py') - print("packet ing...") - errcode = exec_shell([self.python_path, packet_script_path, chip, target_name, " ".join(self.extr_defines)], None, True) - if errcode != 0: - print("packet error!") - self.print_build_result(target_name, errcode) - sys.exit(1) - - os.system('python3 build/config/target_config/ws63/build_ws63_update.py --pkt=app_iot') #BY _HSF_ Hilink OTA - - copy_file("output/ws63/fwpkg/ws63-liteos-app-iot/ws63-liteos-app-iot_mfg_all.fwpkg", "output/LPT262_hilink_MFG.fwpkg") # ====>BY _HSF - copy_file("output/ws63/fwpkg/ws63-liteos-app-iot/ws63-liteos-app-iot_all.fwpkg", "output/LPT262_hilink.fwpkg") - copy_file("output/ws63/upgrade/update.fwpkg", "output/LPT262_hilink_UPGRADE.bin") - - print("packet success!") - print (time.strftime("%Y年%m月%d日")+" ("+time.strftime("%H:%M:%S")+")") - - - - def pack_fota(self, chip, target_name, option): - fota_script_path = os.path.join(root_path, 'build', 'config', 'target_config', chip, 'build_' + chip + '_update.py') - print("fota packet generating...") - errcode = exec_shell([self.python_path, fota_script_path, target_name, option], None, True) - if errcode != 0: - print("fota packet error!") - self.print_build_result(target_name, errcode) - sys.exit(1) - print("fota packet success!") - - def dump_cmake_command(self, output_path): - with open(os.path.join(output_path, 'cmake_command.txt'), "w") as f: - f.write("\n".join(self.cmake_cmd)) - - def is_command_refresh(self, output_path): - cmd_path = os.path.join(output_path, 'cmake_command.txt') - if not os.path.exists(cmd_path): - return True - with open(cmd_path, "r") as f: - text = f.read() - return text != "\n".join(self.cmake_cmd) diff --git a/build/script/codesize_statistic.py b/build/script/codesize_statistic.py deleted file mode 100755 index ed5b057..0000000 --- a/build/script/codesize_statistic.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -# Description: Provides dma driver source \n -# -# History: \n -# 2023-01-16, Create file. \n -# ============================================================================ -import os -import shutil -import re -import sys -root_dir = os.path.split(os.path.realpath(__file__))[0] -sys.path.append(os.path.join(root_dir, '..', 'config')) -sys.path.append(root_dir) -from enviroment import TargetEnvironment -from utils.build_utils import output_root - -class statistics(object): - def __init__(self, file): - self.name = [] - self.text_size = [] - self.data_size = [] - self.bss_size = [] - self.group = [[0 for i in range(6)] for j in range(100)] - with open(file, encoding="utf-8") as f: - cluster = f.read() - component_name = cluster[cluster.find("[")+1:cluster.find("]")] - component_name = component_name.replace("\n", '') - component_name = component_name.replace(" ", '') - component_name = component_name.replace("'", '') - self.name = component_name.split(",") - for i in range(0, len(self.name)): - self.text_size.append(0) - self.data_size.append(0) - self.bss_size.append(0) - group_name = cluster[cluster.find("group_details = {")+20:cluster.find("}")] - group_name = group_name.split("\n") - for i in range(0, len(group_name)): - name_g = group_name[i].replace("[", '') - name_g = name_g.replace("]", '') - name_g = name_g.replace(" ", '') - name_g = name_g.replace("'", '') - name_g = re.split(':|,', name_g) - if (len(name_g) > 0): - self.group[i] = name_g - - def data_set(self, file_name, index): - cmds = 'size ' + file_name - string = os.popen(cmds).read() - for line in string.splitlines(): - number = re.findall("\d+",line) - if len(number) > 0: - self.text_size[index] = int(self.text_size[index]) + int(number[0]) - self.data_size[index] = int(self.data_size[index]) + int(number[1]) - self.bss_size[index] = int(self.bss_size[index]) + int(number[2]) - - def data_find(self, file_name): - file_name = file_name.replace(".a", '') - file_name = file_name.replace("lib", '') - for i in range(0, len(self.group)): - if len(self.group[i]) == 0: - break - for j in range(1, len(self.group[i])): - if (file_name == self.group[i][j]): - file_name = self.group[i][0] - for i in range(0, len(self.name)): - if self.name[i] == file_name: - return i - return -1 - - def creat(self, path): - with open(path + '/codesize_statistic.html', "w") as f: - f.write('

Codesize Statistics

') - f.write('') - f.write('\n') - - total_text_size = 0 - total_data_size = 0 - total_bss_size = 0 - - for i in range(0, len(self.name)): - - total = self.text_size[i] + self.data_size[i] + self.bss_size[i] - if not self.name[i] == 0 and total > 0: - total_text_size += self.text_size[i] - total_data_size += self.data_size[i] - total_bss_size += self.bss_size[i] - - result = '\n' % \ - (str(self.name[i]), str(self.text_size[i]), str(self.data_size[i]), str(self.bss_size[i])) - f.write(result) - result = '\n' % \ - (str(total_text_size), str(total_data_size), str(total_bss_size)) - f.write(result) - f.write('
driverstextdatabss
%s%s%s%s
Total%s%s%s
') - -def find_listdir(stat, path): - if os.path.exists(path): - file_list = os.listdir(path) - for file in file_list: - fulldir = os.path.join(path, file) - if os.path.isdir(fulldir): - find_listdir(stat, fulldir) - if os.path.isfile(fulldir): - bool = file.endswith(".a") - if bool: - i = stat.data_find(file) - if i >= 0: - org_work_path = os.getcwd() - os.chdir(path) - stat.data_set(file, i) - os.chdir(org_work_path) - -if __name__ == '__main__': - root_dir = os.path.split(os.path.realpath(__file__))[0] - root_dir = os.path.join(root_dir, '..', '..') - os.chdir(root_dir) - sys.path.append(os.path.join(root_dir, 'build', 'config')) - sys.path.append(os.path.join(root_dir, 'build', 'script')) - - env = TargetEnvironment(sys.argv[1]) - chip = env.get('chip') - core = env.get('core') - stat = statistics("./build/config/target_config/%s/codesize_statistic_config.json" % (chip)) - path = os.path.join(output_root, chip, core, sys.argv[1]) - find_listdir(stat, path) - stat.creat(path) - - print('codesize statistics done') diff --git a/build/script/codesize_statistic/codesize_statistic_config.json b/build/script/codesize_statistic/codesize_statistic_config.json deleted file mode 100755 index 90461bd..0000000 --- a/build/script/codesize_statistic/codesize_statistic_config.json +++ /dev/null @@ -1,38 +0,0 @@ -'component_group': [ - 'uart', - 'watchdog', - 'qdec', - 'keyscan', - 'drv_timer', - 'systick', - 'tcxo', - 'dma', - 'pinctrl', - 'gpio', - 'spi', - 'i2c', - 'ipc', - 'pwm', - 'adc', - 'flash', - 'xip', - ], -group_details = { - 'uart': ['uart', 'hal_uart', 'uart_porting', 'test_uart'] - 'watchdog': ['watchdog', 'hal_watchdog', 'watchdog_porting', 'test_watchdog'] - 'qdec': ['qdec', 'hal_qdec', 'qdec_porting', 'test_qdec'] - 'keyscan': ['keyscan', 'hal_keyscan', 'keyscan_porting', 'test_keyscan'] - 'timer': ['drv_timer', 'hal_timer', 'timer_porting', 'test_timer'] - 'systick': ['systick', 'hal_systick', 'systick_porting', 'test_systick'] - 'tcxo': ['tcxo', 'hal_tcxo', 'tcxo_porting', 'test_tcxo'] - 'dma': ['dma', 'hal_dma', 'dma_porting', 'test_dma'] - 'pinctrl': ['pinctrl', 'hal_pinctrl', 'pinctrl_porting', 'test_pinctrl'] - 'gpio': ['gpio', 'hal_gpio', 'gpio_porting', 'test_gpio'] - 'spi': ['spi', 'hal_spi', 'spi_porting', 'test_spi'] - 'i2c': ['i2c', 'hal_i2c', 'i2c_porting', 'test_i2c'] - 'ipc': ['ipc', 'hal_ipc', 'ipc_porting', 'test_ipc'] - 'pwm': ['pwm', 'hal_pwm', 'pwm_porting', 'test_pwm'] - 'adc': ['adc', 'hal_adc', 'adc_porting', 'test_adc'] - 'flash': ['flash', 'flash_porting', 'test_flash'] - 'xip': [ 'hal_xip', 'xip_porting'] -} \ No newline at end of file diff --git a/build/script/concat_bin.py b/build/script/concat_bin.py deleted file mode 100755 index a54df50..0000000 --- a/build/script/concat_bin.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# @brief build system entry, receive param & start to build -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -# ============================================================================ - -import struct -import sys - -def concat_bins(file1, file2, file1_size, output): - # 读取两个bin文件 - with open(file1, 'rb') as f1, open(file2, 'rb') as f2: - data_file1 = f1.read() - data_file2 = f2.read() - - with open(output, 'wb') as out: - out.seek(0, 0) - out.write(data_file1) - out.seek(int(file1_size, 16), 0) - out.write(data_file2) - -def main(): - # 获取命令行传入的参数列表 - args = sys.argv[1:] - # 判断参数是否为文件路径 - if len(args) == 4: - concat_bins(args[0], args[1], args[2], args[3]) - else: - sys.exit(0) - -if __name__ == '__main__': - main() diff --git a/build/script/conf_parser.py b/build/script/conf_parser.py deleted file mode 100755 index faeebd6..0000000 --- a/build/script/conf_parser.py +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import json - -from utils.build_utils import color_red -from utils.build_utils import color_end - -__all__ = ["MconfParser", "BuildConfParser"] - -def nv_repeat_check(pairs): - key_list = [] - for key_temp in pairs: - if key_temp[0] not in key_list: - key_list.append(key_temp[0]) - else: - raise Exception("nv items(%s) repeat"%key_temp[0]) - pairs = dict(pairs) - return pairs - -class ParserError(Exception): - """ - Parse errors, highlight in red. - """ - def __init__(self, err): - emsg = "%s%s%s"%(color_red(), err, color_end()) - Exception.__init__(self, emsg) - pass - -""" -Json format config file parser -""" -class BuildConfParser: - def __init__(self, conf_path): - if not os.path.isfile(conf_path): - raise ParserError("Configration file %s NOT found!"%conf_path) - - with open(conf_path, 'r', encoding='utf-8') as conf: - try: - myread = conf.read() - self.conf_data = json.loads(myread) - self.nvconf_data = json.loads(myread, object_pairs_hook = nv_repeat_check) - except Exception as err: - msg = "%s\nParsing file:%s"%(err, conf_path) - raise ParserError(msg) - - self.conf_data = self._parse(self.conf_data) - self.nvconf_data = self._parse(self.nvconf_data) - - def get_conf_data(self): - return self.conf_data - - def get_nvconf_data(self): - return self.nvconf_data - - def get(self, option): - return self.conf_data.get(option) - - def _parse(self, data): - """ - parse the python sentence starts with ### - """ - for key, value in data.items(): - if isinstance(value, dict): - # Recursion - value = self._parse(value) - if isinstance(value, list): - # Recursion - data[key] = self._parse_list(value) - if isinstance(value, int): - data[key] = value - if isinstance(value, str) and value.startswith('###'): - value = self._exec(value) - data[key] = value - return data - - def _parse_list(self, values): - new_list = [] - for val in values: - if type(val) is str and val.startswith('###'): - value = self._exec(val) - new_list.append(value) - elif isinstance(val, dict): - new_list.append(self._parse(val)) - else: - new_list.append(val) - return new_list - - def _exec(self, code): - """ - Execute the simple python sentence. - For the security reason, only allows 'os.path.join' to be input, as a path string - to support multiple platforms. - If it needs to support more python features, please use compile and eval, but careful about - the security issues. - """ - start = code.find("os.path.join") - if start < 0: - raise ParserError("The input doesn't support!") - lpt = code.find("(") - if lpt < 0 or lpt < start: - raise ParserError("The input doesn't support!") - rpt = code.find(")") - if rpt < 0 or rpt < lpt: - raise ParserError("The input doesn't support!") - path_parts = code[lpt + 1:rpt].split(",") - ret = "" - for part in path_parts: - ret = os.path.join(ret, part.lstrip(" '\"").rstrip(" '\"")) - return ret - -""" -Menuconfig format config file parser -""" -class MconfParser: - def __init__(self, conf_path): - if not os.path.isfile(conf_path): - raise ParserError("Configration file %s NOT found!"%conf_path) - - with open(conf_path, 'r', encoding='utf-8') as conf: - self.conf_data = conf.readlines() - - self.conf_data = self._parse(self.conf_data) - - def get(self, option): - data = self.conf_data.get(option) - if data is None: - # Option not found be treated as false. - return 'n' - # strip " when met string values. - return data.replace('"', '') - - def _parse(self, data): - settings = {} - for option in data: - if self._option_is_valid(option) is True: - key, value = self._parse_option(option) - settings[key] = value.strip().replace('\n', '').replace('\r', '') - return settings - - def _option_is_valid(self, option): - option = option.strip() - if (option is None) or (option == '') or (option.startswith('#') is True): - # skip blanks and comments. - return False - return True - - def _parse_option(self, option): - cfg = option.split('=') - if len(cfg) == 2: - # like "KEY=value", length always be 2. return in KEY, value - return cfg[0], cfg[1] - else: - raise ParserError("Unknow format of the option:%s"%option) - -def test(): - """ - Test only. - """ - parser = BuildConfParser("build/config/riscv32_toolchain.json") - print(parser.get('TargetFolder')) - mparser = MconfParser("build/config/settings.json") - print(mparser.get('CONFIG_TARGET_SOFT_VER')) - -if __name__ == "__main__": - test() diff --git a/build/script/custom_cmd.py b/build/script/custom_cmd.py deleted file mode 100755 index 4e59d54..0000000 --- a/build/script/custom_cmd.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import sys -import json -import importlib -import copy -import traceback - -from enviroment import TargetEnvironment -from utils.build_utils import target_config_path, exec_shell - -def run_custom_cmd(env: TargetEnvironment, target_name: str, hook_name: str)->bool: - chip = env.get('chip') - core = env.get('core') - if chip not in ('ws63', 'ws53'):# only ws63, ws53 - return True - script_entry_path = os.path.join(target_config_path, chip, 'script', 'entry.py') - if os.path.isfile(script_entry_path): - try: - sys.path.insert(0, os.path.dirname(script_entry_path)) - custom_module = importlib.import_module('entry') - importlib.reload(custom_module) - sys.path.pop(0) - if hasattr(custom_module, 'do_cmd'): - if not custom_module.do_cmd(target_name, hook_name, copy.deepcopy(env.config)): - print(f"[{chip}][{core}] run custom cmd failed!") - return False - print(f"[{chip}][{core}] run custom cmd success!") - except: - traceback.print_exc() - print(f"[{chip}][{core}] run custom cmd failed!") - return False - - return True \ No newline at end of file diff --git a/build/script/enviroment.py b/build/script/enviroment.py deleted file mode 100755 index 537cc0e..0000000 --- a/build/script/enviroment.py +++ /dev/null @@ -1,463 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ========================================================================= -# @brief Config Target Definitions File -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -# ========================================================================= -import multiprocessing -import os -import sys -import json -import copy -import importlib -from utils.build_utils import fn_get_subdirs, rm_pyc, target_config_path - -all_target = {} -all_group = {} -all_target_templates = {} -chip_group_target = {} -chip_copy_target = {} - -from target_config.common_config import CommonConfig -from utils.build_utils import exec_shell, root_path, get_platform_name, output_root - -rm_pyc(target_config_path) -for name in fn_get_subdirs(target_config_path): - load_fmt = "target_config.%s.target_config" %name - try: - load_mod = importlib.import_module(load_fmt) - except: - print("[WARN] config/target_config/%s/target_config.py is not exist, you can delete it" % name) - continue - all_target_templates.update(load_mod.target_template) - - load_fmt = "target_config.%s.config" %name - load_mod = importlib.import_module(load_fmt) - if "target_copy" in load_mod.__dict__: - chip_copy_target[name] = load_mod.target_copy - all_target.update(load_mod.target) - all_group.update(load_mod.target_group) - chip_group_target[name] = list(load_mod.target.keys()) + list(load_mod.target_group.keys()) - -# 判断key_list中的关键字是否都在string中 -def is_list_in_str(key_list, string): - for item in key_list: - if item not in string: - return False - return True - - -class TargetEnvironment: - def __init__(self, target_name, extra_defines=None): - - self.config = {} - self.is_implement_target = False - if extra_defines is None: - extra_defines = [] - org_target = copy.deepcopy(all_target[target_name]) - # sdk target不需要和template合并 - if org_target.get('build_type', None) == 'SDK': - self.config = copy.deepcopy(org_target) - if extra_defines: - self.config['defines'] = extra_defines - return - - self.merge_target_config(target_name, extra_defines) - - com_config = CommonConfig(self.config['arch']) - - self.merge_common_config(com_config) - self.merge_component_set(com_config) - self.merge_defines_set(com_config) - - if self.is_enable_hso(): - self.config["defines"].append("HSO_SUPPORT") - - for key, value in self.config.items(): - if isinstance(value, list): - self.deal_with_delete_symbol(key) - - self.config["build_platform"] = get_platform_name() - self.config['target_command'] = target_name - if org_target.get('product_type'): - self.config['product_type'] = org_target.get('product_type') - - def merge_target_config(self, target_name, extra_defines): - """ 将target_name对应的diff配置同diff配置中base_target_name对应的template配置合并 - Args: - target_name: diff配置的key - extra_defines: 从命令-def=XXX,YYY,ZZZ=x中接收的额外宏 - """ - org_target = copy.deepcopy(all_target[target_name]) - base_target_name = org_target.pop('base_target_name') - if base_target_name in all_target: - temp_target = copy.deepcopy(all_target[base_target_name]) - self.is_implement_target = True - org_target = self.merge_dict(temp_target, org_target) - base_target_name = temp_target['base_target_name'] - - self.config = copy.deepcopy(all_target_templates[base_target_name]) - - for key, value in org_target.items(): - if not isinstance(value, list): - self.config[key] = value - continue - if key == 'defines': - self.merge_defines(value) - continue - self.extend(key, value) - self.merge_defines(extra_defines) - - def merge_dict(self, dict1, dict2): - res = copy.deepcopy(dict2) - for key, value in dict1.items(): - if not isinstance(value, list): - res[key] = value - continue - if key not in res: - res[key] = [] - res[key].extend(value) - return res - - def merge_common_config(self, com_config): - """ 将公共配置项合并到config中 - Args: - com_config: 公共配置实例 - """ - self.pretend('ccflags', com_config.get_ram_ccflags()) - self.extend('rom_ccflags', com_config.get_rom_ccflags()) - self.extend('linkflags', com_config.get_linkflags()) - self.extend('std_libs', com_config.get_std_libs()) - self.add('arch_family', com_config.get_arch_family()) - - def merge_defines(self, defines, extend=True): - """ - 将参数defines合并到config的defines项中, 对于XXX=y这种宏会被替换 - 例: - config的defines项中有:XXX=y - 参数defines中有:XXX=z - 则合并后config的defines项中:XXX=y => XXX=z - """ - if extend: - self.extend('defines', defines) - special_define = {} - for define in defines: - if '=' in define: - key = define.split('=')[0] - val = define.split('=')[1] - special_define[key] = val - for idx, define in enumerate(self.config['defines']): - if '=' not in define: - continue - key = define.split('=')[0] - if key in special_define: - self.config['defines'][idx] = '%s=%s' % (key, special_define[key]) - if extend: - self.config['defines'].extend(defines) - self.config['defines'] = list({}.fromkeys(self.config['defines']).keys()) - - def merge_component_set(self, com_config): - """ - 处理ram/rom_component_set项中的删除标识, 并将其value合并到ram/rom_component中 - """ - self.deal_with_delete_symbol('ram_component_set') - self.deal_with_delete_symbol('rom_component_set') - - for ram_set in self.config['ram_component_set']: - self.extend('ram_component', com_config.get_component_set(ram_set)) - - for rom_set in self.config['rom_component_set']: - self.extend('rom_component', com_config.get_component_set(rom_set)) - - def merge_defines_set(self, com_config): - """ - 处理ram/rom_component_set项中的删除标识, 并将其value合并到ram/rom_component中 - """ - self.deal_with_delete_symbol('defines_set') - - for defines_set in self.config['defines_set']: - self.extend('defines', com_config.get_definse(defines_set)) - - def deal_with_delete_symbol(self, key): - """ - 处理self.config中key项中的删除标识 - """ - - if key not in self.config: - self.config[key] = [] - return - lst = self.config[key] - normal_lst = [] - reserve_lst = [] - delete_lst = [] - define_replace = [] - for item in lst: - if item.startswith("[r]"): - reserve_lst.append(item[3:]) - continue - if not item.startswith("-:"): - normal_lst.append(item) - continue - if key == 'defines' and "=" in item: - define_replace.append(item[2:]) - continue - delete_lst.append(item[2:]) - - normal_lst = list({}.fromkeys(normal_lst).keys()) - for del_item in delete_lst: - if del_item in normal_lst: - normal_lst.remove(del_item) - self.config[key] = normal_lst - self.merge_defines(define_replace, False) - self.config[key].extend(reserve_lst) - - def add_component_defines(self): - self.config["target_component_defines"] = [] - if 'ram_component' in self.config: - self.config["target_component_defines"].extend( - ["SUPPORT_" + x.upper() for x in self.config['ram_component']] - ) - if 'rom_component' in self.config: - self.config["target_component_defines"].extend( - ["SUPPORT_" + x.upper() for x in self.config['rom_component']] - ) - def is_enable_hso(self): - return self.get("hso_enable") - - def get_tool_chain(self): - toolchain_dir = os.path.join(root_path, 'build', 'toolchains') - toolchain_file = "%s.cmake" % (self.get('tool_chain')) - return os.path.join(toolchain_dir, toolchain_file) - - def get(self, key, cmake_type=True): - """ - 返回self.config中item项的值, - 若此值为list类型且cmake_type为True则用";"连接为字符串再返回(cmake中列表中元素用;隔开) - """ - if key not in self.config: - return None - if isinstance(self.config[key], list) and cmake_type: - return ";".join(self.config[key]) - return self.config[key] - - def set(self, key, val): - if key not in self.config: - raise f'{key} not in ' + self.config['target_command'] - if not isinstance(self.config[key], type(val)): - raise 'type of value is not same with ' + self.config['target_command'] + 'config' - self.config[key] = val - - def get_output_path(self): - chip = self.get('chip') - core = self.get('core') - target_name = self.get('target_command') - return os.path.join(output_root, chip, core, target_name) - - def get_target_template(self): - if self.is_implement_target: - temp = all_target[self.config['target_command']]['base_target_name'] - res = all_target[temp]['base_target_name'] - else: - res = all_target[self.config['target_command']]['base_target_name'] - return res - - def add(self, key, value): - if key in self.config: - raise - self.config[key] = value - - def extend(self, key, value): - if not isinstance(value, list): - return - if key not in self.config: - self.config[key] = [] - self.config[key].extend(value) - - def pretend(self, key, value): - if not isinstance(value, list): - return - if key not in self.config: - self.config[key] = [] - value.extend(self.config[key]) - self.config[key] = copy.deepcopy(value) - - def append(self, key, value): - if key not in self.config: - self.config[key] = [] - if not isinstance(self.config[key], list): - return - if value in self.config[key]: - return - self.config[key].append(value) - - def remove(self, key, value): - if key not in self.config: - return - if not isinstance(self.config[key], list): - return - if value not in self.config[key]: - return - self.config[key].remove(value) - - def dump(self, dump_file=False): - info = json.dumps(self.config, indent=4, ensure_ascii=False) - if not dump_file: - print(info) - return info - with open(os.path.join(self.get_output_path(), "env_config.json"), "w") as f: - f.write(info) - return info - - def is_config_refresh(self): - config_file = os.path.join(self.get_output_path(), "env_config.json") - if not os.path.exists(config_file): - return True - with open(config_file, "r") as f: - config = json.load(f) - return config != self.config - -class BuildEnvironment: - """ command line param handler - receive param and parse it - """ - - def __init__(self, param_list): - self.python_path = sys.executable - param_list = param_list[1:] - self.extr_defines = [] - self.thread = multiprocessing.cpu_count() - self.need_clean = False - self.no_symbol_link = False - self.component = [] - self.build_level = 'normal' - self.build_as_lib = False - self.build_as_lib_output_file = '' - self.target_names = [] - self.group_names = [] - self.generator = 'Unix Makefiles' - self.no_hso = False - self.open_kconfig = False - if get_platform_name() == "windows": - self.generator = "Ninja" - self.dump = False - self.build_time = '' - self.parse_cmd(param_list) - - def parse_cmd(self, param_list): - """ parse param - """ - keys_of_target_name = [] - for param in param_list: - if param.startswith('-j'): - self.thread = int(param[2:]) - elif param.startswith('-def='): - self.extr_defines.extend(param[5:].split(',')) - elif param.startswith('-build_time='): - self.build_time = param[12:].split(',')[0] - elif param.startswith('-component='): - self.component.extend(param[11:].split(',')) - elif param.startswith('-out_libs='): - self.build_as_lib = True - self.build_as_lib_output_file = param[10:] - elif param == '-c': - self.need_clean = True - elif param == '-ninja': - self.generator = 'Ninja' - elif param == '-release' or param == '-debug' or param == '-normal': - self.build_level = param[1:] - elif param == '-dump': - self.dump = True - elif param == '-nhso': - self.no_hso = True - elif param == '-nsymlink': - self.no_symbol_link = True - elif param == 'menuconfig' or param == 'defconfig' or param == 'allyesconfig' or param == 'allnoconfig': - self.open_kconfig = True - self.kconfig_param = param - else: - keys_of_target_name.append(param) - self.match_target_names(keys_of_target_name) - - def get_target_names_by_group_name(self, group_name): - targets = [] - items = all_group[group_name] - return items - - def is_group(self, item): - return item in all_group - - def is_target(self, item): - return item in all_target - - def is_copy_target(self, item): - for chip in chip_copy_target: - if item in chip_copy_target[chip]: - return True - return False - - def get_chip_name(self, item): - for chip, targets in chip_group_target.items(): - if item in targets: - return chip - return None - - def add_target_names(self, target_name): - if target_name in all_group: - self.group_names.append(target_name) - if target_name in all_target: - self.target_names.append(target_name) - - def match_target_names(self, keys_of_target_name): - """ 根据匹配关键字在all_target和all_group中匹配target_name以供选择 - """ - if len(keys_of_target_name) == 1: - temp_name = keys_of_target_name[0] - if temp_name in all_group or temp_name in all_target: - self.add_target_names(temp_name) - return - - normal_match_list = [] - group_match_list = [] - for key in all_target: - if is_list_in_str(keys_of_target_name, key): - normal_match_list.append(key) - for key in all_group: - if is_list_in_str(keys_of_target_name, key): - group_match_list.append(key) - - all_match_list = normal_match_list + group_match_list - # all_match_list为空, 报错 - if not all_match_list: - print("Target_name invalid and No matching target_name exists!") - for item in all_target.keys(): - print(item) - sys.exit(1) - # 匹配项只有一个, 无需选择直接返回 - if len(all_match_list) == 1: - self.add_target_names(all_match_list[0]) - return - # 按序号打印匹配的target_name - print("Target_name invalid") - print("Here are the matching target_names") - cur_index = 0 - for index in range(len(normal_match_list)): - print("%-3d : %s" % (cur_index, normal_match_list[index])) - cur_index += 1 - print("\nHere are the matching aliases target_name") - for index in range(len(group_match_list)): - print("%-3d : %s" % (cur_index, group_match_list[index])) - cur_index += 1 - print("\nDo you want to build them?") - print("Input index numbers for build or q for quit(num/q):", end='') - - # 输入序号或q/Q - select_index = input() - if select_index.lower() == 'q': - sys.exit(0) - try: - select_indexes = [int(x) for x in select_index.split()] - for index in select_indexes: - self.add_target_names(all_match_list[index]) - except: - print("ERROR INPUT!!") - sys.exit(1) diff --git a/build/script/hdbxml/base_datatype_def.txt b/build/script/hdbxml/base_datatype_def.txt deleted file mode 100755 index 3b4a6a5..0000000 --- a/build/script/hdbxml/base_datatype_def.txt +++ /dev/null @@ -1,54 +0,0 @@ -uint32_t 32 0 -uint16_t 16 0 -uint8_t 8 0 - -int32_t 32 1 -int16_t 16 1 -int8_t 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -TD_U32 32 0 -TD_U16 16 0 -TD_U8 8 0 -TD_S32 32 1 -TD_S16 16 1 -TD_S8 8 1 -TD_BOOL 8 0 -TD_CHAR 8 1 1 -char 8 1 1 - -long 32 1 -TD_PVOID 32 0 -TD_PBYTE 32 0 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 - -td_pvoid 32 0 -td_pbyte 32 0 -uintptr_t 32 0 - -td_u64 64 0 -td_uintptr_t 32 0 -td_void 32 0 \ No newline at end of file diff --git a/build/script/hdbxml/bt_status_to_hso_prim_xml.py b/build/script/hdbxml/bt_status_to_hso_prim_xml.py deleted file mode 100755 index 2eaf85a..0000000 --- a/build/script/hdbxml/bt_status_to_hso_prim_xml.py +++ /dev/null @@ -1,313 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import time -import json -import xml.etree.ElementTree as ET - -py_version = platform.python_version() - -G_PARAMS = {} -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" - -g_fsm_status = "" -enum_dict = {} -stuct_dict = {} - -def print_enum_dict(dict_info): - for name in dict_info: - print(" %s" % name) - xx = dict_info[name] - for key in xx: - print(" %s" % key) - -def print_struct_dict(dict_info): - for msg_id in dict_info: - print(" %s" % msg_id) - msg_dict = dict_info[msg_id] - for key in msg_dict: - print(" %s" % key) - if key != "struct_para_list": - print(" %s" % msg_dict[key]) - else: - for para in msg_dict[key]: - print(" %s" % para) - -def gen_enum_dict_fun(datalines): - global g_fsm_status - global enum_dict - enum_name = "" - g_fsm_status = "FIND_ENUM_START" - # 遍历行内容 - for line in datalines: - line = line.replace('\r\n', '') - line = line.replace('\t', ' ') - if len(line) == 0: - continue - m = re.search(r'^\/\/', line.strip()) - if m is not None: - continue - if g_fsm_status == "FIND_ENUM_START": - m = re.search(r'\{\s*(.*)\s*START\s*\}', line.strip()) - if m is not None: - enum_name = m.groups()[0].strip().replace(" ", "_") - g_fsm_status = "FIND_ENUM_MEMBER" - if enum_name not in enum_dict: - enum_dict[enum_name] = [] - elif g_fsm_status == "FIND_ENUM_MEMBER": - m = re.search(r'\{\s*PUBLIC\s*END\s*\}', line.strip()) - if m is not None: - g_fsm_status = "FIND_ENUM_START" - else: - member = line.strip().split(" ") - if len(member) == 2: - temp = (" %s = %s," % (member[1].split(".")[0], member[0])) - if enum_dict[enum_name].count(temp) == 0: - enum_dict[enum_name].append(temp) - g_fsm_status = "" - #print_enum_dict(enum_dict) - -def add_enum_dict_fun(msg_id, para_index, enum_list): - enum_name = ("bt_status_enum_msg_id_%x_%d" % (msg_id, para_index)) - if enum_name not in enum_dict: - enum_dict[enum_name] = [] - for item in enum_list: - member = item.strip().split(" ") - if len(member) == 2: - temp = (" %s = %s," % (member[1], member[0])) - if enum_dict[enum_name].count(temp) == 0: - enum_dict[enum_name].append(temp) - return enum_name - -def merge_enum_dict_fun(msg_id, para_index, enum_list): - enum_name = ("bt_status_enum_msg_id_%x_%d_" % (msg_id, para_index)) - for item in enum_list: - enum_name = ("%s%s_" % (enum_name, item.strip()[2:].replace(" ", "_"))) - - if enum_name not in enum_dict: - enum_dict[enum_name] = [] - - for item in enum_list: - temp = item.strip()[2:].replace(" ", "_") - enum_dict[enum_name] += enum_dict[temp] - return enum_name - -def gen_struct_dict_fun(datalines): - global g_fsm_status - g_fsm_status = "FIND_STRUCT_START" - para_count = 0 - msg_id = 0 - msg_fmt = "" - - for line in datalines: - line = line.replace('\r\n', '') - line = line.replace('\t', ' ') - line = line.replace('\\r', "") - line = line.replace('\\n', "") - line = line.replace('\r', "") - line = line.replace('\n', "") - line = line.replace("\\", "") - if len(line) == 0: - continue - m = re.search(r'^\/\/(.*)', line.strip()) - if m is not None: - continue - if g_fsm_status == "FIND_STRUCT_START": - m = re.search(r'(MsgID=\S*)\s*;\s*(Parameter Number=[0-9]*)\s*;\s*(.*)\]', line.strip()) - if m is not None: - para_count = int(m.groups()[1].strip().split("=")[1], 10) - msg_id = int(m.groups()[0].strip().split("=")[1], 16) - msg_fmt = m.groups()[2].strip() - if msg_id not in stuct_dict: - temp = { } - temp["full_str"] = line - temp["para_count"] = para_count - temp["msg_id"] = msg_id - temp["msg_fmt"] = msg_fmt - temp["struct_para_list"] = [] - stuct_dict[msg_id] = temp - g_fsm_status = "FIND_STRUCT_MEM" - elif g_fsm_status == "FIND_STRUCT_MEM": - temp = ("Parameter%d_CommandList\s*End" % (para_count)) - m = re.search(temp, line.strip()) - if m is not None: - g_fsm_status = "FIND_STRUCT_START" - stuct_dict[msg_id]["struct_para_list"].append(line) - #print_struct_dict(stuct_dict) - -def parse_struct_para_list(msg_id, struct_para_list): - global g_fsm_status - g_fsm_status = "FIND_PARA_START" - index = 0 - para_mem_dict = {} - struct_str = "typedef struct {\n" - while len(struct_para_list) > 0: - para_str = struct_para_list.pop(0) - if g_fsm_status == "FIND_PARA_START": - m = re.search(r'CommandList\s*Start', para_str) - if m is not None: - g_fsm_status = "FIND_PARA_MEM" - index += 1 - if index not in para_mem_dict: - para_mem_dict[index] = [] - elif g_fsm_status == "FIND_PARA_MEM": - m = re.search(r'CommandList\s*End', para_str) - if m is not None: - g_fsm_status = "FIND_PARA_START" - else: - m = re.search(r'Index\s*Show', para_str) - if m is None: - para_mem_dict[index].append(para_str) - - for item in para_mem_dict: - need_enum_ref = 0 - if len(para_mem_dict[item]) == 0: - struct_str += (" td_u32 para_%s;\n" % (item)) - else: - for str in para_mem_dict[item]: - if str.find("$$") != -1: - need_enum_ref = 1 - break - if need_enum_ref == 0: - enum_name = add_enum_dict_fun(msg_id, item, para_mem_dict[item]) - struct_str += (" %s para_%s;\n" % (enum_name, item)) - else: - if len(para_mem_dict[item]) > 1: - enum_name = merge_enum_dict_fun(msg_id, item, para_mem_dict[item]) - struct_str += (" %s para_%s;\n" % (enum_name, item)) - else: - enum_name = para_mem_dict[item][0].strip()[2:].replace(" ", "_") - struct_str += (" %s para_%s;\n" % (enum_name, item)) - - - struct_str += ("} bt_status_msg_id_%x;\n\n" % (msg_id)) - return struct_str - -def get_struct_def_string(): - struct_str = "" - for msg_id in stuct_dict: - msg_dict = stuct_dict[msg_id] - for key in msg_dict: - if key == "struct_para_list": - struct_str += parse_struct_para_list(msg_id, list(msg_dict[key])) - return struct_str - -def get_enum_def_string(): - enum_str = "" - for item in enum_dict: - enum_str = "%stypedef enum {\n" % enum_str - for i in enum_dict[item]: - enum_str = ("%s%s\n" % (enum_str, i)) - enum_str = ("%s} %s;\n\n" % (enum_str, item)) - return enum_str - -def write_bt_status_def_file(): - global G_PARAMS - txt_dst_dir = G_PARAMS["HDB_TXT_DST_DIR"] - - struct_str = get_struct_def_string() - enum_str = get_enum_def_string() - - dst_file = os.path.join(txt_dst_dir, "bt_status_hso_msg_struct_def.txt") - - with open(dst_file, 'w') as dst_f: - dst_f.write('#include "base_datatype_def.txt"' + '\n') - dst_f.write(enum_str) - dst_f.write(struct_str) - -def add_content_to_xml(data, msg_root_element): - new_element = ET.Element('') - new_element.tag = 'MSG' - new_element.attrib['STRUCTURE'] = ("bt_status_msg_id_%x" % (data["msg_id"])) - new_element.attrib['NAME'] = data["msg_fmt"] - new_element.attrib['ID'] = hex((31 << 16) | (0xffff & data["msg_id"])) # OM_MSG_TYPE_STATUS = 31 - new_element.tail = '\n\t\t\t' - msg_root_element.append(new_element) - -def write_bt_status_prim_xml_file(): - global G_PARAMS - - base_file_dir = os.path.join(G_PARAMS['HDB_XML_TEMP_BASE_DIR'], "bt_status") - if not os.path.isdir(base_file_dir): - os.makedirs(base_file_dir) - - dst_xml_full_name = os.path.join(base_file_dir, "bt_status.xml") - - msg_root_element = ET.Element('MSG_LOG') - for msg_id in stuct_dict: - add_content_to_xml(stuct_dict[msg_id], msg_root_element) - - tree = ET.ElementTree(msg_root_element) - tree.write(dst_xml_full_name) - -def generate_db_file(): - global G_PARAMS - bt_status_dir = G_PARAMS["BT_STATUS_DIR"] - - bt_status_file = os.path.join(bt_status_dir, "STATUS_CommandList.txt") - try: - if py_version.startswith("3"): - try: - with open(bt_status_file, 'r', encoding="UTF-8") as fd_src: - datalines = [line for line in fd_src] - except Exception: - with open(bt_status_file, 'r', encoding="ISO-8859-1") as fd_src: - datalines = [line for line in fd_src] - else: - with open(bt_status_file, 'r') as fd_src: - datalines = [line for line in fd_src] - except Exception: - print("open file %s failed." % cfilepath) - return - - gen_enum_dict_fun(datalines) - gen_struct_dict_fun(datalines) - - write_bt_status_def_file() - write_bt_status_prim_xml_file() - -def generate_db(): - global G_PARAMS - root = sys.argv[1] - chip = sys.argv[2] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - G_PARAMS = {} - G_PARAMS['HDB_XML_TEMP_BASE_DIR'] = os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]) - G_PARAMS["HDB_TXT_DST_DIR"] = os.path.join(root, db_conf["HDB_TXT_DST_DIR"]) - G_PARAMS["HDB_TXT_BASE_DATATYPE"] = os.path.join(root, db_conf["HDB_TXT_BASE_DATATYPE"]) - G_PARAMS["HDB_TXT_SRC_DIR"] = os.path.join(root, db_conf["HDB_TXT_SRC_DIR"]) - G_PARAMS["BT_STATUS_DIR"] = os.path.join(root, db_conf["BT_STATUS_DIR"]) - - txt_src_dir = G_PARAMS["HDB_TXT_SRC_DIR"] - txt_dst_dir = G_PARAMS["HDB_TXT_DST_DIR"] - base_datatype_def_txt = G_PARAMS["HDB_TXT_BASE_DATATYPE"] - bt_status_dir = G_PARAMS["BT_STATUS_DIR"] - - if not os.path.exists(txt_src_dir): - return - if not os.path.exists(base_datatype_def_txt): - return - if not os.path.exists(bt_status_dir): - return - if not os.path.exists(txt_dst_dir): - os.makedirs(txt_dst_dir) - - generate_db_file() - -# main -if __name__ == "__main__": - generate_db() diff --git a/build/script/hdbxml/database_create.py b/build/script/hdbxml/database_create.py deleted file mode 100755 index 7e0e34e..0000000 --- a/build/script/hdbxml/database_create.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import sys -import json -import shutil - -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" -G_PARAMS = {} - -# 生成database -def database_create(): - database_base = G_PARAMS["DATABASE_BASE"] # 获取database目录路径 - - # 判断对应版本,用于生成out下database目录后缀 - target_cus = G_PARAMS.get("DATABASE_VERSION", "").split() - if not target_cus: - target_cus = [""] - for cus in set(target_cus): - if cus: - database_target_name = '_'.join(['database', cus]) - else: - database_target_name = 'database' - database_target = os.path.join(G_PARAMS["OUT_DIR"], database_target_name) - # 生成database - shutil.rmtree(database_target, ignore_errors=True, onerror=None) - shutil.copytree(database_base, database_target) - mss_prim_path = G_PARAMS["DATABASE_MSS_PRIM_PATH"] - diag_dir_path = G_PARAMS["DATABASE_DIAG_DIR_PATH"] - cores = G_PARAMS["DATABASE_VERSION_CORE"].split() - for core in cores: - if os.path.exists(mss_prim_path): - shutil.copy(mss_prim_path, os.path.join(database_target, core, 'system', 'hdbcfg')) - if os.path.exists(diag_dir_path): - filelist = os.listdir(diag_dir_path) - for f in filelist: - shutil.copy(os.path.join(diag_dir_path, f), os.path.join(database_target, core, 'system', 'diag')) - # 暂时修改out目录下生成的database的目录为cco - if core == 'acore': - try: - os.rename(os.path.join(database_target, core), os.path.join(database_target, 'cco')) - except: - print("[WARN] rename %s exception" % os.path.join(database_target, core)) - continue - -def create(): - global G_PARAMS - root = sys.argv[1] - chip = sys.argv[2] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - G_PARAMS["DATABASE_BASE"] = os.path.join(root, db_conf["DATABASE_BASE"]) - G_PARAMS["DATABASE_MSS_PRIM_PATH"] = os.path.join(root, db_conf["DATABASE_MSS_PRIM_PATH"]) - G_PARAMS["DATABASE_DIAG_DIR_PATH"] = os.path.join(root, db_conf["DATABASE_DIAG_DIR_PATH"]) - G_PARAMS["OUT_DIR"] = os.path.join(root, db_conf["OUT_DIR"]) - G_PARAMS["DATABASE_VERSION"] = db_conf["DATABASE_VERSION"] - G_PARAMS["DATABASE_VERSION_CORE"] = db_conf["DATABASE_VERSION_CORE"] - - database_create() - -if __name__ == "__main__": - create() \ No newline at end of file diff --git a/build/script/hdbxml/hso_prim_xml_merge.py b/build/script/hdbxml/hso_prim_xml_merge.py deleted file mode 100755 index 191b935..0000000 --- a/build/script/hdbxml/hso_prim_xml_merge.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import time -import json -import xml.etree.ElementTree as ET -from xml.etree.ElementTree import ElementTree - -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" - -def get_msg_root(subsystem): - msg_root_element = ET.Element('') - for child in subsystem: - if child.tag == 'MSG_LOG': - msg_root_element = child - break - if msg_root_element.tag == 'MSG_LOG': - temp_attrib = msg_root_element.attrib - temp_text = msg_root_element.text - temp_tail = msg_root_element.tail - msg_root_element.attrib = temp_attrib - msg_root_element.text = temp_text - msg_root_element.tail = temp_tail - return msg_root_element - -def get_subsystem_by_name(tree, name): - root = tree.getroot() - for child in root: - if child.attrib["NAME"] == name: - return child - return None - -def merge_db_xml(root, chip, core_name): - - xml_src_file = G_PARAMS['HDB_PRIM_XML_SRC_FILE'].strip() - dst_xml_file = G_PARAMS['HDB_PRIM_XML_DST_FILE'].strip() - base_dir = G_PARAMS['HDB_XML_TEMP_BASE_DIR'] - - mod_list = [] - if core_name == 'bt_core': - mod_list = ['bt_core', 'bt_status', 'ota_msg'] #bt_status.xml、ota_msg.xml目前都是在bt编译时生成 - else: - mod_list = [core_name] - - dst_xml_dir = os.path.abspath(os.path.join(dst_xml_file, "..")) - if not os.path.isdir(dst_xml_dir): - os.makedirs(dst_xml_dir) - - if not os.path.exists(dst_xml_file): - shutil.copy(xml_src_file, dst_xml_file) - - for mod in mod_list: - if not os.path.isdir(os.path.join(base_dir, mod)): - continue - tree_dst = ET.parse(dst_xml_file) - subsystem = get_subsystem_by_name(tree_dst, mod) - if subsystem is None: - print("Error: subsystem %s is not in %s" %(mod, dst_xml_file)) - continue - - msg_root_element = get_msg_root(subsystem) - msg_root_element.clear() - - filelist = os.listdir(os.path.join(base_dir, mod)) - for filename in filelist: - tmp_xml_file = os.path.join(os.path.join(base_dir, mod), filename) - tree = ElementTree() - tree.parse(tmp_xml_file) - root = tree.getroot() - if root.tag == 'MSG_LOG': - for child in root: - msg_root_element.append(child) - else: - subsystem_src = get_subsystem_by_name(tree, mod) - msg_element_src = get_msg_root(subsystem_src) - for child in msg_element_src: - msg_root_element.append(child) - tree_dst.write(dst_xml_file) - -# main -if __name__ == "__main__": - global G_PARAMS - - root = sys.argv[1] - chip = sys.argv[2] - core_name = sys.argv[3] - if len(sys.argv) == 5: - hso_en_bt = sys.argv[4] - else: - hso_en_bt = "" - - in_path = XML_PATH - in_path = in_path.replace('', chip) - - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - G_PARAMS = {} - G_PARAMS['HDB_XML_TEMP_BASE_DIR'] = os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]) - G_PARAMS['HDB_PRIM_XML_DST_FILE'] = os.path.join(root, db_conf["HDB_PRIM_XML_DST_FILE"]) - G_PARAMS['HDB_PRIM_XML_SRC_FILE'] = os.path.join(root, db_conf["HDB_PRIM_XML_SRC_FILE"]) - - merge_db_xml(root, chip, core_name) - if hso_en_bt == "True": - merge_db_xml(root, chip, 'bt_core') - - if ("HDB_XML_PRE_GENERATED_CORE" in db_conf): - G_PARAMS['HDB_XML_PRE_GENERATED_CORE'] = db_conf["HDB_XML_PRE_GENERATED_CORE"] - core_list = [] - core_list = G_PARAMS['HDB_XML_PRE_GENERATED_CORE'] - - for core in core_list: - merge_db_xml(root, chip, core) diff --git a/build/script/hdbxml/mk_hso_prim_xml.py b/build/script/hdbxml/mk_hso_prim_xml.py deleted file mode 100755 index 3522e2c..0000000 --- a/build/script/hdbxml/mk_hso_prim_xml.py +++ /dev/null @@ -1,658 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import time -import json -import xml.etree.ElementTree as ET - - -py_version = platform.python_version() - -def timestamp(): - return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) - -########################################################################## -# -# 日志内容提取函数 -# -########################################################################## -# 日志状态机处理流程: -# LOG_ENTRY_FINDING -- 查找日志接口 -# LOG_ENTRY_FOUNDED -- 日志接口匹配,查找日志内容 -# LOG_CONT_ENTRY_FINDING -- 日志内容入口匹配,以“号开关,以”号结束 -# LOG_CONT_END_FOUNING -- 日志内容查找 -# LOG_EXIT_FINDING -- 日志线束符匹配 - -# 全局变量 -aich_name = "" -log_info_list = [] # 日志信息列表,【文件号, 行号, 日志内容】 -g_undefine_id = [] # 保存未定义的FileId -g_fsm_status = "LOG_ENTRY_FINDING" -g_log_key_find = 0 # (状态位)判断是否查找到日志关键字,0否1是 -g_log_str = "" -g_log_str_full = "" -g_log_entry = [ - r"LOG_PRINT[0-4](\s*)\(", - r"log_print[0-4](\s*)\(", - r"acore_log[0-4](\s*)\(", - r"[printlog]{3,5}_alter(\s*)\(", - r"[PRINTLOG]{3,5}_ALTER(\s*)\(", - r"_LOG[0-4]{1,2}(\s*)\(", - r"(DBG|INFO|ERR|WARN)_LOG(\s*)\(", - # BTH - r"(dbg|info|err|warn)_log(\s*)\(", - r"(dbg|info|err|warn)_log[0-4](\s*)\(", - # diag common - r"diag_(error|warning|info|debug)_log(\d*)(\s*)\(", - r"PRINT_(DEBUG|INFO|ERR|WARN)(\s*)\(", - r"print_(debug|info|err|warn)(\s*)\(", - r"_log_(err|warn|info|debug)(\s*)\(", - # GPU - r"(vau|dpu|jpeg|gmmu|vg)_(err|info|dbg|print)(\s*)\(", - # WIFI - r"oam_(error|warning|info)_log[0-4](\s*)\(", - r"alg_ar_dbg_log[0-4](\s*)\(", - r"common_log_dbg[0-4](\s*)\(", - # GPU - r"GRAPHIC_LOG(F|E|W|I|D|P)(\s*)\(", - r"DISP_LOG(E|W|I|D)(\s*)\(", - r"LV_LOG(E|W|I)(\s*)\(", - # Meida - r"ALOG(V|D|I|W|E)(\s*)\(", - r"MEDIA_(DEBUG|ERR|WARNING|INFO|FATAL)_LOG(\s*)\(", - r"HMF_LOG(F|E|W|I)(\s*)\(", - r"MEDIA_HAL_LOG(V|D|I|W|E)(\s*)\(", - r"CHECK_NULL_(RETURN|RETURN_NONE)(\s*)\(", - r"CHECK_FAILED_(RETURN|RETURN_NONE|PRINT|RETURN_WITH_UNLOCK)(\s*)\(", - r"CHK_NULL_(RETURN|RETURN_NONE|RETURN_WITH_UNLOCK)(\s*)\(", - r"CHK_FAILED_(RETURN|NO_RETURN)(\s*)\(", - r"(CHK_COND_RETURN|CHK_FALSE_RETURN|CHECK_STATE_SAME_RETURN)(\s*)\(", - # OHOS - r"HILOG_(DEBUG|ERROR|FATAL|INFO|WARN)(\s*)\(", - r"SAMGR_LOG_(ERROR|FATAL|INFO|WARN)(\s*)\(", - # app - r"WEARABLE_LOG(D|I|W|E)(\s*)\(", - # plat - r"hcc_printf_err_log(\s*)\(", - # audio - r"audio_log[0-4](\s*)\(", -] # 日志关键字规则 - -# DSP日志关键字规则,不要改变顺序,慎重修改 -g_audio_log_entry = [ - r"sap_(alert|fatal|err|warn|dbg|trace)_log_(s32|bool)(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_u32(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_h32(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_float(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_void(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_ret(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_fun(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_null_pointer(\s*)\(", - r"audio_func_enter(\s*)\(", - r"audio_func_exit(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_info(\s*)\(", - r"audio_log_(alert|fatal|err|warn|dbg|trace)(\s*)\(", -] # DSP日志关键字规则,不要改变顺序,慎重修改 - -g_audio_log_key_index = -1 -g_audio_log_addition_info = [" = %d", - " = %u", - " = 0x%08X", - " = %f", - " = %p", - "Error Code: [0x%08X]", - " Failed, Error Code: [0x%08X]", - " = %p, Null Pointer!\\n", - "enter...", - "exit..."] - -g_log_full_cont = '\"(.*)\"\s*[,|)]' -# 用于记录日志行数,日志多行时可能是第一行,有可能是最后一行; -# 0 表示第一行 1表示最后一行 -g_log_entry_or_end_flag = -1 - -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" - -def get_log_level(str): - m = re.search(r'LOG_LEVEL_ERROR|ERR_LOG|err_log|(GRAPHIC|DISP|LV)_LOGF|(GRAPHIC|DISP|LV)_LOGE|WEARABLE_LOGE|_ERR|print_err|ERROR|FATAL', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'(CHK|CHECK)_NULL_RETURN|(CHK|CHECK)_NULL_RETURN_NONE|(CHK|CHECK)_FAILED_RETURN|CHECK_FAILED_RETURN_NONE', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'CHECK_FAILED_PRINT|CHECK_FAILED_RETURN_WITH_UNLOCK|CHK_NULL_RETURN_WITH_UNLOCK|CHK_FAILED_NO_RETURN', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'CHK_COND_RETURN|CHK_FALSE_RETURN', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'LOG_LEVEL_WARNING|WARN_LOG|warn_log|warning_log|(GRAPHIC|DISP|LV)_LOGW|WEARABLE_LOGW|_WARN|print_warn', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'alg_ar_dbg|common_log_dbg', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'LOG_LEVEL_INFO|INFO_LOG|info_log|(GRAPHIC|DISP|LV)_LOGI|GRAPHIC_LOGP|WEARABLE_LOGI|_INFO|print_info', str) - if m is not None: - return 5,'INFO' - m = re.search(r'CHECK_STATE_SAME_RETURN', str) - if m is not None: - return 5,'INFO' - m = re.search(r'LOG_LEVEL_DBG|(DBG|DEBUG)_LOG|(dbg|debug)_log|(GRAPHIC|DISP|LV)_LOGD|WEARABLE_LOGD|_DEBUG|print_debug', str) - if m is not None: - return 6,'DBG' - - m = re.search(r'_error_log|_log_err|_ERROR_|(vau|dpu|jpeg|gmmu|vg)_err|ALOGE|MEDIA_(ERR|FATAL)_LOG|HMF_LOG(F|E)|MEDIA_HAL_LOGE', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'_warning_log|_log_warn|_WARNING_|ALOGW|HMF_LOGW|MEDIA_HAL_LOGW', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'_info_log|_log_info|_INFO_|(vau|dpu|jpeg|gmmu|vg)_info|ALOGI|MEDIA_INFO_LOG|HMF_LOGI|MEDIA_HAL_LOGI', str) - if m is not None: - return 5,'INFO' - m = re.search(r'_debug_log|_log_debug|(vau|dpu|jpeg|gmmu|vg)_(dbg|print)|ALOG(V|D)|MEDIA_DEBUG_LOG|MEDIA_HAL_LOG(V|D)', str) - if m is not None: - return 6,'DBG' - - print("no match for :%s" % str) - return 7, 'no match' - -# DSP日志级别识别,慎重修改 -def get_audio_log_level(str): - m = re.search(r'_alert|_err|_fatal', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'_warn', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'_trace', str) - if m is not None: - return 5,'INFO' - m = re.search(r'_dbg', str) - if m is not None: - return 6,'DBG' - m = re.search(r'_enter|_exit', str) - if m is not None: - return 5,'INFO' - print("audio log no match for :%s" % str) - return 7, 'no match' - -def add_content_to_xml(data, msg_root_element): - prim_pri = data["LEVEL_STR"] - prim_sz = data["FMT"] - prim_line = data["LINE_NUM"] - prim_file = data["FILE_NAME"] - prim_file_id = data["FILE_ID"] - args_count = data["ARGS_COUNT"] - mod_id = data["MOD_ID"] - level = data["LEVEL_NUM"] - - new_element = ET.Element('') - new_element.tag = 'MSG' - new_element.attrib['STRUCTURE'] = "%s%d" % ("diag_log_msg", args_count) - new_element.attrib['NAME'] = "%s @%s(%d),%s" % (prim_sz, prim_file, prim_line, prim_pri) - - #sdt log_id to hso msg_id - #log_flg mod_id file_id line_num level - #1bit 4bit 10bit 14bit 3bit - msg_id = (1 << 31) | (mod_id << 27) | (prim_file_id << 17) | (prim_line << 3) | level - new_element.attrib['ID'] = hex(msg_id) - new_element.tail = '\n\t\t\t' - msg_root_element.append(new_element) - -# 根据日志状态机流程逐行解析日志内容 -def parse_log_from_line(line): - global g_fsm_status - global g_log_str - global g_log_str_full - global g_log_str_full_flag - global g_log_entry - global g_log_full_cont - global g_log_entry_or_end_flag - global g_log_key_find - global g_audio_log_key_index - findkey = 0 - # 匹配日志接口 - if "LOG_ENTRY_FINDING" == g_fsm_status: - g_log_entry_or_end_flag = -1 - g_audio_log_key_index = -1 - g_log_str = "" - g_log_str_full = "" - for x in g_log_entry: - m = re.search(x, line.strip()) - if m is not None: - findkey = 1 - break - if 1 == findkey: - g_fsm_status = "LOG_ENTRY_FOUNDED" - g_log_str_full += line - g_log_entry_or_end_flag = 0 - g_log_key_find = 1 - parse_log_from_line(line) - - # SAP log - find_audio_key = 0 - index = 0 - for x in g_audio_log_entry: - m = re.search(x, line.strip()) - if m is not None: - find_audio_key = 1 - break - index = index + 1 - if 1 == find_audio_key: - g_fsm_status = "LOG_ENTRY_FOUNDED" - g_log_str_full += line - g_log_entry_or_end_flag = 0 - g_audio_log_key_index = index - g_log_key_find = 1 - parse_log_from_line(line) - else: - return - - # 日志接口匹配,确认是否完整日志;确认日志是否正常结束 - elif "LOG_ENTRY_FOUNDED" == g_fsm_status: - if g_audio_log_key_index >= 0 and g_audio_log_key_index <= 4: # such as "sap_alert_log_u32" - m1 = re.search("\(\s*(\S+)\s*\)", line) - if m1 is not None: - g_log_str = m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 5: # such as "sap_fatal_log_err_code" - m1 = re.search("\(\s*(\w+)\s*\)", line) - if m1 is not None: - g_log_str = g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 6: # such as "sap_err_log_fun_err" - m1 = re.search("\(\s*(\w+)\s*,", line) - if m1 is not None: - g_log_str = "Call " + m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 7: # such as "sap_err_log_null_pointer" - m1 = re.search("\(\s*(\S+)\s*\)", line) - if m1 is not None: - g_log_str = m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 8 or g_audio_log_key_index == 9: # such as "audio_func_enter" - m1 = re.search("\(\)", line) - if m1 is not None: - g_log_str = g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - else: - m1 = re.search(g_log_full_cont, line) # 完整日志格式 - m2 = re.search("\"(.+)", line) # 部分日志格式 ,引号开头 - if m1 is not None: - g_log_str = m1.groups()[0] + '\0' - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif m2 is not None: - g_fsm_status = "LOG_CONT_END_FINDING" - g_log_str = m2.groups()[0] # 引号后面的内容为日志内容 - m1 = re.search(r'(.+)"\s*[,|)]', line) - if m1 is not None: - g_fsm_status = "LOG_EXIT_FINDING" - if "LOG_ENTRY_FOUNDED" == g_fsm_status: - m3 = re.search(r"\)[\s]*\;", line.strip()) - if m3 is not None: - g_fsm_status = "LOG_ENTRY_FINDING" - g_log_entry_or_end_flag = -1 - g_audio_log_key_index = -1 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - # 匹配部分日志接口 - elif "LOG_CONT_END_FINDING" == g_fsm_status: - m = re.search(r"[\s]+(.+)\"", line) - if m is not None: - temp = m.groups()[0] - m1 = re.search(r'(.+)"\s*[,|)]', line) #部分日志可以跨多行 - if m1 is None: - g_log_str += temp - else: - g_log_str += (temp + '\0') - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - else: - g_log_str += line.strip() # 纯日志内容 ,继续找日志 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - # 匹配日志结束符 - elif "LOG_EXIT_FINDING" == g_fsm_status: - m = re.search(r"\)[\s]*\;", line.strip()) - if m is not None: - g_fsm_status = "LOG_ENTRY_FINDING" # 继续逐行扫描下一条日志入口 - g_log_entry_or_end_flag = 1 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - -g_file_id_dict = {} # file_id_str file_id_num -g_last_file_id_num = 0 -g_moudle_id = { - 'wifi' : 0, - 'bt' : 1, - 'gnss' :2, - 'dsp' : 3, - 'pf' : 4, - 'media' : 5, - 'nfc': 6, - 'app' : 7, - 'gpu': 8, - 'gui' : 9, - 'slp' : 10, - 'bth' : 11, - 'ohos' : 12, -} - -def parse_single_source_file(cfilepath, auto_def, module_name): - global g_log_key_find - global g_log_str - global g_fsm_status - global log_info_list - global g_audio_log_key_index - curr_line_num = 0 # 当前行行号 - file_id_num = 0 # 本文件号 - line_num_save = 0 - log_info_list = [] - - m = re.search(r"\w.[cC|hH]", cfilepath) - if m is None: - print("Error!%s is not C or H File" % cfilepath) - return - - # 增加对文件中换行符的处理 - destfile = cfilepath + "_temp" - modify_newline_on_linux(cfilepath, destfile) - # 打开源文件,读取文件内容 - try: - if py_version.startswith("3"): - try: - with open(destfile, 'r', encoding="UTF-8") as fd_src: - datalines = [line for line in fd_src] - except Exception: - with open(destfile, 'r', encoding="ISO-8859-1") as fd_src: - datalines = [line for line in fd_src] - else: - with open(destfile, 'r') as fd_src: - datalines = [line for line in fd_src] - except Exception: - print("open file %s failed." % cfilepath) - return - - os.remove(destfile) - if module_name not in g_file_id_dict: - return - _, filename = os.path.split(cfilepath) - if auto_def: - file_id_str = filename.replace('.' , '_').upper() - if file_id_str not in g_file_id_dict[module_name]: - return - g_fsm_status = "LOG_ENTRY_FINDING" - else: - m = re.search(r"#define[\s]+THIS_FILE_ID[\s]+([\w]*)", '\n'.join(datalines)) - if m is None: - return 0 - file_id_str = m.group(1) - g_fsm_status = "LOG_ENTRY_FINDING" - - # 遍历行内容 - for line in datalines: - # 行号加1 - curr_line_num += 1 - - m = re.search(r'^\/\/', line.strip()) - if m is not None: - continue - # 判断是否可识别的普通日志文件 - parse_log_from_line(line) - if 1 == g_log_key_find: - try: - file_id_num = g_file_id_dict[module_name][file_id_str] - moudle_id_num = g_moudle_id[module_name] - except KeyError: - #print( - # "warning: Moudle:%s, %s not defined. fileName[%s]." % - # (moudle_name, file_id_str, filename)) - g_undefine_id.append((file_id_str, filename)) - break - g_log_key_find = 0 - line_num_save = curr_line_num - # 解析日志,判断是否找到,如果找到写入文件 - if 1 == g_log_entry_or_end_flag: - g_log_str = g_log_str.replace('\\r', "") # 清除\r,\n,空格 - g_log_str = g_log_str.replace('\\n', "") - g_log_str = g_log_str.replace('\r', "") # 清除\r,\n,空格 - g_log_str = g_log_str.replace('\n', "") - g_log_str = g_log_str.replace("\\", "") - g_log_str = g_log_str.replace('""', "") - g_log_str = g_log_str.replace("\000", "") - g_log_str.strip() - if (g_audio_log_key_index != -1): - level_num, level_str = get_audio_log_level(g_log_str_full) - else: - level_num, level_str = get_log_level(g_log_str_full) - data = { } - data["MOD_ID"] = moudle_id_num - data["FILE_ID"] = file_id_num - if (aich_name == "cortex_m7"): - data["LINE_NUM"] = line_num_save - else: - data["LINE_NUM"] = curr_line_num - data["FMT"] = g_log_str - data["LEVEL_NUM"] = level_num - data["LEVEL_STR"] = level_str - data["ARGS_COUNT"] = g_log_str.count("%") - data["FILE_NAME"] = cfilepath.split('/')[-1] - log_info_list.append(data) - g_log_key_find = 0 - g_audio_log_key_index = -1 - return 0 - - -# 保存FILD_ID -def save_file_id_dict(line_str, moudle_name): - global g_file_id_dict - global g_last_file_id_num - - file_id_str = '' - file_id_num = 0 - if line_str == '': - return 0 - - m2 = re.search("[^A-Za-z0-9_=]", line_str) - if m2 is None: - m1 = line_str.split('=') # XXXXXXX = dddd, - if len(m1) == 2: - file_id_str = m1[0] # 获取file id字符串 - file_id_num = m1[1] - g_file_id_dict[moudle_name][file_id_str] = int(file_id_num) - g_last_file_id_num = int(file_id_num) + 1 - else: - file_id_str = line_str - g_file_id_dict[moudle_name][file_id_str] = g_last_file_id_num - g_last_file_id_num += 1 - else: - return -1 - return 0 - - -# 打印fileid的映射字典 -def print_file_id_dict(): - print(timestamp() + " start to print FileIdDict::") - for system_name in g_file_id_dict: - for key in g_file_id_dict[system_name]: - print(timestamp() + " key:%s value:%d" % (key,\ - g_file_id_dict[system_name][key])) - - -# 获取FILE_ID枚举值 -def get_file_id_enum_in_file(h_file_path): - global g_file_id_dict - global g_last_file_id_num - g_last_file_id_num = 0 - - moudle_name = os.path.basename(h_file_path).split('_')[-1][:-2] - # btc将file_id头文件迁移后取名为log_def_btc.h 实际moudle_name任是bt - # bth将file_id头文件迁移后取名为log_def_bth.h 实际moudle_name任是bt - if moudle_name == 'btc': - moudle_name = 'bt' - if chip == 'bs25' and core_name == 'bt_core' and moudle_name == "bth": - moudle_name = 'bt' - if moudle_name not in g_file_id_dict: - g_file_id_dict[moudle_name] = {} - m = re.search(r'\w+\.h$', h_file_path) - if m is None: - print(timestamp() + ' Wrong type file, please input head file path.') - return -1 - - if not os.path.exists(h_file_path): - print(timestamp() + ' Head file [%s] did not exist.' % (h_file_path)) - return 0 - try: - if py_version.startswith("3"): - with open(h_file_path, 'r', encoding="UTF-8") as fd: - id_file = fd.read() - else: - with open(h_file_path, 'r') as fd: - id_file = fd.read() - except Exception as e: - print(e) - return -1 - id_list = re.search(r"typedef enum[\s]*\{([\d\D]*?)\}", id_file).group(1) - id_list = id_list.replace(',', '').replace(' ', '').split('\n') - for line_str in id_list: - line_str = line_str.strip().split("/")[0] - save_file_id_dict(line_str, moudle_name) - - return 0 - -def get_file_id_enum_in_paths(h_file_paths): - for h_file in h_file_paths: - if not h_file: - continue - if get_file_id_enum_in_file(h_file) != 0: - return -1 - return 0 - - -# 文件换行符处理 -def modify_newline_on_linux(srcfile, destfile): - with open(srcfile, "rb") as fsrc, open(destfile, "wb") as fdest: - while True: - cs = fsrc.read(1) - if len(cs) > 0: - if cs == "\r": - fdest.write(cs) - cs = fsrc.read(1) - if cs != "\n": - fdest.write("\n") - fdest.write(cs) - else: - fdest.write(cs) - else: - fdest.write(cs) - else: - break - -#mkdir ${target} ${root} ${chip} ${core} -def generate_db_temp_dir(sys_argv): - root = sys_argv[2] - chip = sys_argv[3] - core_name = sys_argv[4] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - # get global settings - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - base_file_dir = os.path.join(os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]), core_name) - if not os.path.exists(base_file_dir): - os.makedirs(base_file_dir) - -#${target} ${root} ${chip} ${core} ${src_file} ${file_id_dir} -def generate_db_xml(root, core_name, auto_def, module_name, src_file, closed_flag): - global log_info_list - if not os.path.isfile(src_file): - return - - # get global settings - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - parse_single_source_file(src_file, auto_def, module_name) - if len(log_info_list) == 0: - return - - _, filename = os.path.split(src_file) - filename = filename + ".xml" - if (closed_flag != True): - base_file_dir = os.path.join(os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]), core_name) - else: - base_file_dir = os.path.join(os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]), "closed_comp") - if not os.path.exists(base_file_dir): - os.makedirs(base_file_dir) - - dst_xml_full_name = os.path.join(base_file_dir, filename) - - msg_root_element = ET.Element('MSG_LOG') - for data in log_info_list: - add_content_to_xml(data, msg_root_element) - - tree = ET.ElementTree(msg_root_element) - tree.write(dst_xml_full_name) - -# main -if __name__ == "__main__": - if (sys.argv[1] == "mkdir"): - generate_db_temp_dir(sys.argv) - sys.exit(0) - root = sys.argv[1] - chip = sys.argv[2] - core_name = sys.argv[3] - aich_name = sys.argv[4] - in_path = XML_PATH - in_path = in_path.replace('', chip) - auto_def = sys.argv[5] - if auto_def == "TRUE" or auto_def == "True": - auto_def = True - else: - auto_def = False - module_name = sys.argv[6] - closed_flag = sys.argv[7] - if closed_flag == "TRUE" or closed_flag == "True": - closed_flag = True - else: - closed_flag = False - info_file = sys.argv[8] - - try: - with open(info_file, 'r') as f: - text = f.read() - file_id_dir = text.split("####")[0].split(',') - src_files = text.split("####")[1].split(',') - - if file_id_dir != None and get_file_id_enum_in_paths(file_id_dir) != 0: - sys.exit(1) - - for src_file in src_files: - src_file = src_file.strip() - generate_db_xml(root, core_name, auto_def, module_name, src_file, closed_flag) - except: - print("[WARN] open %s exception" % info_file) diff --git a/build/script/hdbxml/mk_hso_prim_xml_dsp.py b/build/script/hdbxml/mk_hso_prim_xml_dsp.py deleted file mode 100755 index d0ddbec..0000000 --- a/build/script/hdbxml/mk_hso_prim_xml_dsp.py +++ /dev/null @@ -1,556 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import time -import json -import xml.etree.ElementTree as ET - - -py_version = platform.python_version() - -def timestamp(): - return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) - -########################################################################## -# -# 日志内容提取函数 -# -########################################################################## -# 日志状态机处理流程: -# LOG_ENTRY_FINDING -- 查找日志接口 -# LOG_ENTRY_FOUNDED -- 日志接口匹配,查找日志内容 -# LOG_CONT_ENTRY_FINDING -- 日志内容入口匹配,以“号开关,以”号结束 -# LOG_CONT_END_FOUNING -- 日志内容查找 -# LOG_EXIT_FINDING -- 日志线束符匹配 - -# 全局变量 -log_info_list = [] # 日志信息列表,【文件号, 行号, 日志内容】 -g_undefine_id = [] # 保存未定义的FileId -g_fsm_status = "LOG_ENTRY_FINDING" -g_log_key_find = 0 # (状态位)判断是否查找到日志关键字,0否1是 -g_log_str = "" -g_log_str_full = "" -g_log_entry = [ - r"LOG_PRINT[0-4](\s*)\(", - r"log_print[0-4](\s*)\(", - r"[printlog]{3,5}_alter(\s*)\(", - r"[PRINTLOG]{3,5}_ALTER(\s*)\(", - r"_LOG[0-4]{1,2}(\s*)\(", - r"[DBG|INFO|ERR|WARN]+_LOG(\s*)\(", - r"audio_log[0-4](\s*)\(", -] # 日志关键字规则 - -g_audio_log_entry = [ - r"sap_(alert|fatal|err|warn|dbg|trace)_log_(s32|bool)(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_u32(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_h32(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_float(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_void(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_ret(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_fun(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_null_pointer(\s*)\(", - r"audio_func_enter(\s*)\(", - r"audio_func_exit(\s*)\(", - r"sap_(alert|fatal|err|warn|dbg|trace)_log_info(\s*)\(", - r"audio_log_(alert|fatal|err|warn|dbg|trace)(\s*)\(", -] # DSP日志关键字规则,不要改变顺序 -g_audio_log_key_index = -1 -g_audio_log_addition_info = [" = %d", - " = %u", - " = 0x%08X", - " = %f", - " = %p", - "Error Code: [0x%08X]", - " Failed, Error Code: [0x%08X]", - " = %p, Null Pointer!\\n", - "enter...", - "exit..."] - -g_log_full_cont = '\"(.*)\"\s*[,|)]' -# 用于记录日志行数,日志多行时可能是第一行,有可能是最后一行; -# 0 表示第一行 1表示最后一行 -g_log_entry_or_end_flag = -1 - -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" - -def get_log_level(str): - m = re.search(r'LOG_LEVEL_ERROR|ERR_LOG|AUDIO_LOG_LEVEL_FATAL|AUDIO_LOG_LEVEL_ERROR', str) - if m is not None: - return 2,'ERROR' - m = re.search(r'LOG_LEVEL_WARNING|WARN_LOG|AUDIO_LOG_LEVEL_WARN', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'LOG_LEVEL_INFO|INFO_LOG|AUDIO_LOG_LEVEL_INFO|AUDIO_LOG_LEVEL_DBG|AUDIO_LOG_LEVEL_TRACE', str) - if m is not None: - return 5,'INFO' - m = re.search(r'LOG_LEVEL_DBG|DBG_LOG|DEBUG_LOG', str) - if m is not None: - return 6,'DBG' - print("no match for :%s" % str) - return 6, 'no match' - -def get_audio_log_level(str): - m = re.search(r'_enter|_exit', str) - if m is not None: - return 5,'INFO' - m = re.search(r'_dbg', str) - if m is not None: - return 6,'DBG' - m = re.search(r'_trace', str) - if m is not None: - return 5,'INFO' - m = re.search(r'_warn', str) - if m is not None: - return 3,'WARNING' - m = re.search(r'_alert|_err|_fatal', str) - if m is not None: - return 2,'ERROR' - print("audio log no match for :%s" % str) - return 6, 'no match' - -def add_content_to_xml(data, msg_root_element): - prim_pri = data["LEVEL_STR"] - prim_sz = data["FMT"] - prim_line = data["LINE_NUM"] - prim_file = data["FILE_NAME"] - prim_file_id = data["FILE_ID"] - args_count = data["ARGS_COUNT"] - mod_id = data["MOD_ID"] - level = data["LEVEL_NUM"] - - new_element = ET.Element('') - new_element.tag = 'MSG' - new_element.attrib['STRUCTURE'] = "%s%d" % ("diag_log_msg", args_count) - new_element.attrib['NAME'] = "%s @%s(%d),%s" % (prim_sz, prim_file, prim_line, prim_pri) - - #sdt log_id to hso msg_id - #log_flg mod_id file_id line_num level - #1bit 4bit 10bit 14bit 3bit - msg_id = (1 << 31) | (mod_id << 27) | (prim_file_id << 17) | (prim_line << 3) | level - new_element.attrib['ID'] = hex(msg_id) - new_element.tail = '\n\t\t\t' - msg_root_element.append(new_element) - -# 根据日志状态机流程逐行解析日志内容 -def parse_log_from_line(line): - global g_fsm_status - global g_log_str - global g_log_str_full - global g_log_str_full_flag - global g_log_entry - global g_log_full_cont - global g_log_entry_or_end_flag - global g_log_key_find - global g_audio_log_key_index - findkey = 0 - audio_hifi_tag = "[hifi]" - # 匹配日志接口 - if "LOG_ENTRY_FINDING" == g_fsm_status: - g_log_entry_or_end_flag = -1 - g_audio_log_key_index = -1 - g_log_str = "" - g_log_str_full = "" - for x in g_log_entry: - m = re.search(x, line.strip()) - if m is not None: - findkey = 1 - break - if 1 == findkey: - g_fsm_status = "LOG_ENTRY_FOUNDED" - g_log_str_full += line - g_log_entry_or_end_flag = 0 - g_log_key_find = 1 - parse_log_from_line(line) - - # SAP log - find_audio_key = 0 - index = 0 - for x in g_audio_log_entry: - m = re.search(x, line.strip()) - if m is not None: - find_audio_key = 1 - break - index = index + 1 - if 1 == find_audio_key: - g_fsm_status = "LOG_ENTRY_FOUNDED" - g_log_str_full += line - g_log_entry_or_end_flag = 0 - g_audio_log_key_index = index - g_log_key_find = 1 - parse_log_from_line(line) - else: - return - - # 日志接口匹配,确认是否完整日志;确认日志是否正常结束 - elif "LOG_ENTRY_FOUNDED" == g_fsm_status: - if g_audio_log_key_index >= 0 and g_audio_log_key_index <= 4: # such as "sap_alert_log_u32" - m1 = re.search("\(\s*(\S+)\s*\)", line) - if m1 is not None: - g_log_str = audio_hifi_tag + m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 5: # such as "sap_fatal_log_err_code" - m1 = re.search("\(\s*(\w+)\s*\)", line) - if m1 is not None: - g_log_str = audio_hifi_tag + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 6: # such as "sap_err_log_fun_err" - m1 = re.search("\(\s*(\w+)\s*,", line) - if m1 is not None: - g_log_str = audio_hifi_tag + "Call " + m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 7: # such as "sap_err_log_null_pointer" - m1 = re.search("\(\s*(\S+)\s*\)", line) - if m1 is not None: - g_log_str = audio_hifi_tag + m1.groups()[0] + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif g_audio_log_key_index == 8 or g_audio_log_key_index == 9: # such as "audio_func_enter" - m1 = re.search("\(\)", line) - if m1 is not None: - g_log_str = audio_hifi_tag + g_audio_log_addition_info[g_audio_log_key_index] + '\0'; - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - else: - m1 = re.search(g_log_full_cont, line) # 完整日志格式 - m2 = re.search("\"(.+)", line) # 部分日志格式 ,引号开头 - if m1 is not None: - g_log_str = audio_hifi_tag + m1.groups()[0] + '\0' - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - elif m2 is not None: - g_fsm_status = "LOG_CONT_END_FINDING" - g_log_str = audio_hifi_tag + m2.groups()[0] # 引号后面的内容为日志内容 - m1 = re.search(r'(.+)"\s*[,|)]', line) - if m1 is not None: - g_fsm_status = "LOG_EXIT_FINDING" - if "LOG_ENTRY_FOUNDED" == g_fsm_status: - m3 = re.search(r"\)[\s]*\;", line.strip()) - if m3 is not None: - g_fsm_status = "LOG_ENTRY_FINDING" - g_log_entry_or_end_flag = -1 - g_audio_log_key_index = -1 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - # 匹配部分日志接口 - elif "LOG_CONT_END_FINDING" == g_fsm_status: - m = re.search(r"[\s]+(.+)\"", line) - if m is not None: - temp = m.groups()[0] - m1 = re.search(r'(.+)"\s*[,|)]', line) #部分日志可以跨多行 - if m1 is None: - g_log_str += temp - else: - g_log_str += (temp + '\0') - g_fsm_status = "LOG_EXIT_FINDING" - parse_log_from_line(line) - else: - g_log_str += line.strip() # 纯日志内容 ,继续找日志 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - # 匹配日志结束符 - elif "LOG_EXIT_FINDING" == g_fsm_status: - m = re.search(r"\)[\s]*\;", line.strip()) - if m is not None: - g_fsm_status = "LOG_ENTRY_FINDING" # 继续逐行扫描下一条日志入口 - g_log_entry_or_end_flag = 1 - if g_log_str_full.find(line) == -1: - g_log_str_full += line - - -g_file_id_dict = {} # file_id_str file_id_num -g_last_file_id_num = 0 -g_moudle_id = { - 'wifi' : 0, 'bt' : 1, 'gnss' :2, 'dsp' : 3, 'pf' : 4, 'nfc': 6, 'app' : 7, -} - -def parse_single_source_file(cfilepath, auto_def, module_name): - global g_log_key_find - global g_log_str - global g_fsm_status - global log_info_list - global g_audio_log_key_index - curr_line_num = 0 # 当前行行号 - file_id_num = 0 # 本文件号 - log_info_list = [] - - m = re.search(r"\w.[cC|hH]", cfilepath) - if m is None: - print("Error!%s is not C or H File" % cfilepath) - return - - # 增加对文件中换行符的处理 - destfile = cfilepath + "_temp" - modify_newline_on_linux(cfilepath, destfile) - # 打开源文件,读取文件内容 - try: - if py_version.startswith("3"): - try: - with open(destfile, 'r', encoding="UTF-8") as fd_src: - datalines = [line for line in fd_src] - except Exception: - with open(destfile, 'r', encoding="ISO-8859-1") as fd_src: - datalines = [line for line in fd_src] - else: - with open(destfile, 'r') as fd_src: - datalines = [line for line in fd_src] - except Exception: - print("open file %s failed." % cfilepath) - return - - os.remove(destfile) - if module_name not in g_file_id_dict: - return - _, filename = os.path.split(cfilepath) - filename = '.'.join(filename.split('.')[:-1]) - if auto_def: - file_id_str = filename.replace('.' , '_').upper() + '_C' - if file_id_str not in g_file_id_dict[module_name]: - return - g_fsm_status = "LOG_ENTRY_FINDING" - else: - m = re.search(r"#define[\s]+THIS_FILE_ID[\s]+([\w]*)", '\n'.join(datalines)) - if m is None: - return 0 - file_id_str = m.group(1) - g_fsm_status = "LOG_ENTRY_FINDING" - - # 遍历行内容 - for line in datalines: - # 行号加1 - curr_line_num += 1 - - m = re.search(r'^\/\/', line.strip()) - if m is not None: - continue - # 判断是否可识别的普通日志文件 - parse_log_from_line(line) - if 1 == g_log_key_find: - try: - file_id_num = g_file_id_dict[module_name][file_id_str] - moudle_id_num = g_moudle_id[module_name] - except KeyError: - #print( - # "warning: Moudle:%s, %s not defined. fileName[%s]." % - # (moudle_name, file_id_str, filename)) - g_undefine_id.append((file_id_str, filename)) - break - g_log_key_find = 0 - # 解析日志,判断是否找到,如果找到写入文件 - if 1 == g_log_entry_or_end_flag: - g_log_str = g_log_str.replace('\\r', "") # 清除\r,\n,空格 - g_log_str = g_log_str.replace('\\n', "") - g_log_str = g_log_str.replace('\r', "") # 清除\r,\n,空格 - g_log_str = g_log_str.replace('\n', "") - g_log_str = g_log_str.replace("\\", "") - g_log_str = g_log_str.replace('""', "") - g_log_str = g_log_str.replace("\000", "") - g_log_str.strip() - if (g_audio_log_key_index != -1): - level_num, level_str = get_audio_log_level(g_log_str_full) - else: - level_num, level_str = get_log_level(g_log_str_full) - data = { } - data["MOD_ID"] = moudle_id_num - data["FILE_ID"] = file_id_num - data["LINE_NUM"] = curr_line_num - data["FMT"] = g_log_str - data["LEVEL_NUM"] = level_num - data["LEVEL_STR"] = level_str - data["ARGS_COUNT"] = g_log_str.count("%") - data["FILE_NAME"] = cfilepath.split('/')[-1] - log_info_list.append(data) - g_log_key_find = 0 - g_audio_log_key_index = -1 - return 0 - - -# 保存FILD_ID -def save_file_id_dict(line_str, moudle_name): - global g_file_id_dict - global g_last_file_id_num - - file_id_str = '' - file_id_num = 0 - if line_str == '': - return 0 - - m2 = re.search("[^A-Za-z0-9_=]", line_str) - if m2 is None: - m1 = line_str.split('=') # XXXXXXX = dddd, - if len(m1) == 2: - file_id_str = m1[0] # 获取file id字符串 - file_id_num = m1[1] - g_file_id_dict[moudle_name][file_id_str] = int(file_id_num) - g_last_file_id_num = int(file_id_num) + 1 - else: - file_id_str = line_str - g_file_id_dict[moudle_name][file_id_str] = g_last_file_id_num - g_last_file_id_num += 1 - else: - return -1 - return 0 - - -# 打印fileid的映射字典 -def print_file_id_dict(): - print(timestamp() + " start to print FileIdDict::") - for system_name in g_file_id_dict: - for key in g_file_id_dict[system_name]: - print(timestamp() + " key:%s value:%d" % (key,\ - g_file_id_dict[system_name][key])) - - -# 获取FILE_ID枚举值 -def get_file_id_enum_in_file(h_file_path): - global g_file_id_dict - global g_last_file_id_num - g_last_file_id_num = 0 - - moudle_name = os.path.basename(h_file_path).split('_')[-1][:-2] - # btc将file_id头文件迁移后取名为log_def_btc.h 实际moudle_name任是bt - # bth将file_id头文件迁移后取名为log_def_bth.h 实际moudle_name任是bt - if moudle_name == 'btc' or moudle_name == 'bth': - moudle_name = 'bt' - if moudle_name == 'sdk': - moudle_name = 'pf' - if moudle_name not in g_file_id_dict: - g_file_id_dict[moudle_name] = {} - m = re.search(r'\w+\.h$', h_file_path) - if m is None: - print(timestamp() + ' Wrong type file, please input head file path.') - return -1 - - if not os.path.exists(h_file_path): - print(timestamp() + ' Head file [%s] did not exist.' % (h_file_path)) - return 0 - try: - if py_version.startswith("3"): - with open(h_file_path, 'r', encoding="UTF-8") as fd: - id_file = fd.read() - else: - with open(h_file_path, 'r') as fd: - id_file = fd.read() - except Exception as e: - print(e) - return -1 - id_list = re.search(r"typedef enum[\s]*\{([\d\D]*?)\}", id_file).group(1) - id_list = id_list.replace(',', '').replace(' ', '').split('\n') - for line_str in id_list: - line_str = line_str.strip().split("/")[0] - save_file_id_dict(line_str, moudle_name) - - return 0 - -def get_file_id_enum_in_paths(h_file_paths): - for h_file in h_file_paths: - if not h_file: - continue - if get_file_id_enum_in_file(h_file) != 0: - return -1 - return 0 - - -# 文件换行符处理 -def modify_newline_on_linux(srcfile, destfile): - with open(srcfile, "rb") as fsrc, open(destfile, "wb") as fdest: - while True: - cs = fsrc.read(1) - if len(cs) > 0: - if cs == "\r": - fdest.write(cs) - cs = fsrc.read(1) - if cs != "\n": - fdest.write("\n") - fdest.write(cs) - else: - fdest.write(cs) - else: - fdest.write(cs) - else: - break - -#mkdir ${target} ${root} ${chip} ${core} -def generate_db_temp_dir(sys_argv): - root = sys_argv[2] - chip = sys_argv[3] - core_name = sys.argv[4] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - # get global settings - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - base_file_dir = os.path.join(os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]), core_name) - if not os.path.exists(base_file_dir): - os.makedirs(base_file_dir) - -#${target} ${root} ${chip} ${core} ${src_file} ${file_id_dir} -def generate_db_xml(root, core_name, auto_def, module_name, src_file): - global log_info_list - if not os.path.isfile(src_file): - return - - # get global settings - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - parse_single_source_file(src_file, auto_def, module_name) - if len(log_info_list) == 0: - return - - _, filename = os.path.split(src_file) - filename = filename + ".xml" - base_file_dir = os.path.join(os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]), core_name) - dst_xml_full_name = os.path.join(base_file_dir, filename) - - msg_root_element = ET.Element('MSG_LOG') - for data in log_info_list: - add_content_to_xml(data, msg_root_element) - - tree = ET.ElementTree(msg_root_element) - tree.write(dst_xml_full_name) - -# main -if __name__ == "__main__": - if (sys.argv[1] == "mkdir"): - generate_db_temp_dir(sys.argv) - sys.exit(0) - root = sys.argv[1] - chip = sys.argv[2] - core_name = sys.argv[3] - in_path = XML_PATH - in_path = in_path.replace('', chip) - auto_def = sys.argv[4] - if auto_def == "TRUE": - auto_def = True - else: - auto_def = False - module_name = sys.argv[5] - info_file = sys.argv[6] - with open(info_file, 'r') as f: - text = f.read() - file_id_dir = text.split(" ")[0].split(',') - src_files = text.split(" ")[1].split(',') - - if file_id_dir != None and get_file_id_enum_in_paths(file_id_dir) != 0: - sys.exit(1) - - for src_file in src_files: - generate_db_xml(root, core_name, auto_def, module_name, src_file) diff --git a/build/script/hdbxml/ota_msg_to_hso_prim_xml.py b/build/script/hdbxml/ota_msg_to_hso_prim_xml.py deleted file mode 100755 index 57620e7..0000000 --- a/build/script/hdbxml/ota_msg_to_hso_prim_xml.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import time -import json -import xml.etree.ElementTree as ET - -py_version = platform.python_version() - -G_PARAMS = {} -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" -ota_msg_list = [] - -def gen_ota_msg_dict_fun(datalines): - global ota_msg_list - # 遍历行内容 - for line in datalines: - line = line.replace('\r\n', '') - line = line.replace('\t', ' ') - line = line.replace('\\r', "") - line = line.replace('\\n', "") - line = line.replace('\r', "") - line = line.replace('\n', "") - line = line.replace("\\", "") - if len(line) == 0: - continue - m = re.search(r'^\/\/', line.strip()) - if m is not None: - continue - m = re.search(r'\[.*(START|END)\]', line.strip()) - if m is not None: - continue - - member = line.strip().split(" ") - if len(member) == 2: - data = {} - data["NAME"] = member[1] - data["ID"] = member[0] - ota_msg_list.append(data) - -def add_content_to_xml(data, msg_root_element): - new_element = ET.Element('') - new_element.tag = 'MSG' - new_element.attrib['NAME'] = data["NAME"] - new_element.attrib['ID'] = hex((2 << 16) | (0xffff & int(data["ID"], 16))) # OM_MSG_TYPE_OTA = 2 - new_element.tail = '\n\t\t\t' - msg_root_element.append(new_element) - -def write_ota_msg_prim_xml_file(): - global G_PARAMS - - base_file_dir = os.path.join(G_PARAMS['HDB_XML_TEMP_BASE_DIR'], "ota_msg") - if not os.path.isdir(base_file_dir): - os.makedirs(base_file_dir) - - dst_xml_full_name = os.path.join(base_file_dir, "ota_msg.xml") - - msg_root_element = ET.Element('MSG_LOG') - for ota_msg in ota_msg_list: - add_content_to_xml(ota_msg, msg_root_element) - - tree = ET.ElementTree(msg_root_element) - tree.write(dst_xml_full_name) - -def generate_db_file(): - global G_PARAMS - ota_msg_dir = G_PARAMS["OTA_MSG_DIR"] - - ota_msg_file = os.path.join(ota_msg_dir, "OTA_MSG_List.txt") - try: - if py_version.startswith("3"): - try: - with open(ota_msg_file, 'r', encoding="UTF-8") as fd_src: - datalines = [line for line in fd_src] - except Exception: - with open(ota_msg_file, 'r', encoding="ISO-8859-1") as fd_src: - datalines = [line for line in fd_src] - else: - with open(ota_msg_file, 'r') as fd_src: - datalines = [line for line in fd_src] - except Exception: - print("open file %s failed." % cfilepath) - return - - gen_ota_msg_dict_fun(datalines) - write_ota_msg_prim_xml_file() - -def generate_db(): - global G_PARAMS - root = sys.argv[1] - chip = sys.argv[2] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - G_PARAMS = {} - G_PARAMS['HDB_XML_TEMP_BASE_DIR'] = os.path.join(root, db_conf["HDB_XML_TEMP_BASE_DIR"]) - G_PARAMS["OTA_MSG_DIR"] = os.path.join(root, db_conf["OTA_MSG_DIR"]) - - generate_db_file() - -# main -if __name__ == "__main__": - generate_db() diff --git a/build/script/hdbxml/process_pregenerated_xml.py b/build/script/hdbxml/process_pregenerated_xml.py deleted file mode 100755 index a0ffc45..0000000 --- a/build/script/hdbxml/process_pregenerated_xml.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import os -import re -import sys -import platform -import string -import shutil -import json - -XML_PATH="build/config/target_config//hdb_config/database_cfg/mk_hdb_xml.json" - -def recursive_copy_overwrite(src, dest, ignore=None): - if os.path.isdir(src): - if not os.path.isdir(dest): - os.makedirs(dest) - files = os.listdir(src) - if ignore is not None: - ignored = ignore(src, files) - else: - ignored = set() - for f in files: - if f not in ignored: - recursive_copy_overwrite(os.path.join(src, f), os.path.join(dest, f), ignore) - else: - shutil.copyfile(src, dest) - -def xml_ignore(path, names): - ignored_names = [] - for name in names: - if name.endswith('mss_prim_db.xml'): - ignored_names.append(name) - return set(ignored_names) - -def process_pre_generated_db_xml(): - global G_PARAMS - root = sys.argv[1] - chip = sys.argv[2] - in_path = XML_PATH - in_path = in_path.replace('', chip) - - db_conf = None - conf = os.path.join(root, in_path) - with open(conf, 'r') as f: - db_conf = json.load(f) - - if ("HDB_XML_PRE_GENERATED_DIR" not in db_conf): - print("HDB_XML_PRE_GENERATED_DIR NOT in json") - return - - G_PARAMS = {} - G_PARAMS['BUILD_TEMP_PATH'] = os.path.join(root, db_conf["BUILD_TEMP_PATH"]) - G_PARAMS['HDB_XML_PRE_GENERATED_DIR'] = db_conf["HDB_XML_PRE_GENERATED_DIR"] - - src_dir = [] - src_dir = G_PARAMS['HDB_XML_PRE_GENERATED_DIR'] - dst_dir = G_PARAMS['BUILD_TEMP_PATH'].strip() - - for dir in src_dir: - full_dir = os.path.join(root, dir) - if(os.path.exists(full_dir)): - recursive_copy_overwrite(full_dir, dst_dir, xml_ignore) - -# main -if __name__ == "__main__": - process_pre_generated_db_xml() diff --git a/build/script/hdbxml_custom/MessageXmlGen/MessageRules_acore.xml b/build/script/hdbxml_custom/MessageXmlGen/MessageRules_acore.xml deleted file mode 100755 index 1286c66..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/MessageRules_acore.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/script/hdbxml_custom/MessageXmlGen/MessageRules_protocol_core.xml b/build/script/hdbxml_custom/MessageXmlGen/MessageRules_protocol_core.xml deleted file mode 100755 index 08918c9..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/MessageRules_protocol_core.xml +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py b/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py deleted file mode 100755 index 5207c94..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py +++ /dev/null @@ -1,396 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -#=============================================================================== -# @brief XML tools -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. -#=============================================================================== -import ctypes -import sys -import inspect -import os -import re -from xml.etree import ElementTree -from xml.dom import minidom - -sys.path.append(os.path.join("build", "script", "hdbxml_custom", "parse")) -import parse_msgdefs - - -def isStackmessage(id, core): - if (core in ['protocol_core']) and ((id >> 26) != 0x10): - return True - return False - -def swap16(x): - return (((x << 8) & 0xFF00) | - ((x >> 8) & 0x00FF)) - -def swap32(x): - return (((x << 24) & 0xFF000000) | - ((x << 8) & 0x00FF0000) | - ((x >> 8) & 0x0000FF00) | - ((x >> 24) & 0x000000FF)) - -def getIdFromParts(core, msg_class, msg_module, msg_id): - return (((core << 30) & 0xC0000000) | ((msg_class << 29) & 0x20000000) | ((msg_module << 16) & 0x00FF0000) | (swap16(msg_id) & 0x0000FFFF)) - -def getIdForMessage(id, core): - if isStackmessage(id, core): - # A stack message needs to be dissasembled and put back together - msg_module = (((id) >> 24) & 0xFF) - msg_log = (((id) >> 21) & 0x1) - msg_verbosity = (((id) >> 22) & 0x3) - msg_id = (((id) & 0x3ff) | (msg_log << 13) | (msg_verbosity << 14)) - messageIDOut = getIdFromParts(1, 1, msg_module, msg_id) - else: - # All other messages need their low two bytes swapped - messageIDOut = ((id) & 0xFFFF0000) | (((id) & 0x0000FF00) >> 8) | (((id) & 0x000000FF) << 8) - - messageIDOut = swap32(messageIDOut) - - return messageIDOut - -def getFirmwareVersion(): - versionfile = os.path.join("build_scons", "VERSION_STRING") - if os.path.exists(versionfile): - with open(versionfile) as f: - firmware_version = f.read().strip() - else: - # This can happen when the messagexml generation is used outside the build. - # The DSP build uses this via tools/scripts/messagesxml.bat - firmware_version = "UNKNOWN" - return firmware_version - -# just used to include comments from rules files. -class CommentedTreeBuilder(ElementTree.TreeBuilder): - def __init__(self, *args, **kwargs): - super(CommentedTreeBuilder, self).__init__(*args, **kwargs) - - def comment(self, data): - self.start(ElementTree.Comment, {}) - self.data(data) - self.end(ElementTree.Comment) - -class messageTree(object): - def __init__(self, distribution, firmware_version, coreName, imageName): - self.parser = ElementTree.XMLParser(target=CommentedTreeBuilder()) - ElementTree.register_namespace("","http://tempuri.org/xmlDefinition.xsd" ) - debugInformationAttributes = { \ - 'Distribution': distribution, \ - 'FirmwareVersion':firmware_version, \ - 'MulticoreLoggingSupported':"true", \ - 'SocXMLVersion':"2", \ - 'SequenceNumbersSupported':"true", \ - 'xmlns':"http://tempuri.org/xmlDefinition.xsd", \ - } - if imageName in ['SEBoot', 'SERecovery', 'updater']: - isBootImage = 'true' - else: - isBootImage = 'false' - coreAttributes = { \ - 'CoreName': str(coreName), \ - 'ImageName': str(imageName), \ - 'BootImage': isBootImage, \ - } - - self.top = ElementTree.Element('DebugInformation', debugInformationAttributes) - self.tree = ElementTree.ElementTree(element=self.top, file=None) - loghdr = ElementTree.SubElement(self.top, 'CommonLogHeader', {'LogIndexMask': '0x0000001F'}) - coreEntry = ElementTree.SubElement(self.top, 'Core', coreAttributes) - - self.messages = ElementTree.SubElement(coreEntry, 'Messages') - self.structs_dict = ElementTree.SubElement(coreEntry, 'StructureDictionary') - self.enums_dict = ElementTree.SubElement(coreEntry, 'EnumsDictionary') - - def addMessageHeader(self, messageEnumName, messageId, core, elemName): - messageAttributes = { \ - 'Name': messageEnumName, \ - 'MessageID': "0x"+str(hex(messageId))[2:].zfill(8), \ - 'Type': 'structure', \ - } - if isStackmessage(messageId, core): - messageAttributes['MessageType'] = 'StackMessage' - message = ElementTree.SubElement(self.messages, "Message",messageAttributes) - return message - - def addStructure(self, nodeTypeName, fieldElementType, elementSize): - structureAttributes = { \ - 'Type': nodeTypeName, \ - 'FieldType': fieldElementType, \ - } - fieldEntry = ElementTree.SubElement(self.structs_dict, 'Structure', structureAttributes) - return fieldEntry - - def structureInDictionary(self, structName): - found = False - for i in self.structs_dict: - nameEntry = i.attrib["Type"] - if structName == nameEntry: - found = True - return found - - def addField(self, parent, fieldName, nodeTypeName, fieldElementType, elementSize, length, enumName): - fieldAttributes = { \ - 'FieldName': fieldName, \ - 'Type': nodeTypeName, \ - 'FieldType': fieldElementType, \ - 'Size': str(elementSize), \ - 'Length': str(length), \ - } - if enumName is not None: - fieldAttributes['Enum'] = enumName - fieldSubEntry = ElementTree.SubElement(parent, 'Field', fieldAttributes) - return fieldSubEntry - - def addEnum(self, enum_type_name, enumList): - found = False - for i in self.enums_dict: - nameEntry = i.find("Name").text - if enum_type_name == nameEntry: - found = True - - if not found: - enumsEntry = ElementTree.SubElement(self.enums_dict, 'EnumsEntry') - enumName = ElementTree.SubElement(enumsEntry, 'Name') - enumName.text = enum_type_name - #enumsArray = ElementTree.SubElement(enumsEntry, 'Enums') - for name, val in enumList: - self.addEnumEntry(enumsEntry, name, val) - - def addEnumEntry(self, parent, name, val): - enumAttributes = { \ - 'Name': name, \ - 'Value': str(val), \ - } - enumValueEntry = ElementTree.SubElement(parent, 'Enum', enumAttributes) - - def dump(self): - return ElementTree.dump(self.top) - - def prettify(self, elem, encoding = 'utf-8'): - """Return a pretty-printed XML string for the Element. - """ - initial_string = ElementTree.tostring(elem, encoding=encoding, method='xml') - reparsed_string = minidom.parseString(initial_string) - return reparsed_string.toprettyxml(indent=" ") - - def write_xml_file (self, file, xml_root_element, xml_declaration=False, pretty_print=False, encoding='unicode', indent='\t'): - if xml_declaration: - file.write('') - pretty_printed_xml = self.prettify(xml_root_element, encoding = 'utf-8') - file.write(pretty_printed_xml) - - def outputMessageTree(self, regexp, rulesfilename, outfilename): - if regexp: - matcher = re.compile(regexp) - - # Filter out any messages we don't want to publish, then add the rules and write it out - internal_message_list = [] - for message in self.messages: - name = message.attrib['Name'] - internal = regexp and matcher.search(name) is not None - if internal: - internal_message_list.append(message) - - for message in internal_message_list: - name = message.attrib['Name'] - self.messages.remove(message) - - if rulesfilename != None: - rules_data = ElementTree.parse(rulesfilename, self.parser) - if rules_data is None: - raise SystemExit('Error: failed to parse %s' % rulesfilename) - rules_root = rules_data.getroot() - if rules_root is None: - raise SystemExit('Error: failed to find root section in %s' % rulesfilename) - rulesEntry = self.top.find('Core') - if rulesEntry is None: - raise SystemExit('Error: failed to find "Core" section') - rulesEntry.extend(rules_root) - - with open(outfilename, 'w') as outfile: - self.write_xml_file(outfile, self.top, xml_declaration=False, pretty_print=True, encoding='unicode', indent='\t') - - -# Taking some ctypes element, recursively analyse it, and build a tree of nodes representing it -def buildTree(xmlTree, message_fields, elem): - if hasattr(elem, "_fields_"): - for field in elem._fields_: - structAlreadyPopulated = False - current_message_fields = message_fields - fieldType = field[1] - arrayItemNamePostfix='' - - # This is potentiallay a multi-dimensional array that must be descended into so do so until an actual type is encountered - while True: - # If this is an array there will be some kind of length - length = fieldType._length_ if hasattr(fieldType, "_length_") else 1 - # This size includes all the different elements (if this is an array) or just the size of the single field if not - size = ctypes.sizeof(fieldType) - # Deduce the size of a single element - elementSize = size // length - # Pointers have a "contents" attribute - isPointer = hasattr(fieldType, "contents") - - # Simple single dimension arrays can be handled using the length - isSomeKindOfArray = issubclass(fieldType, ctypes.Array) - if isSomeKindOfArray: - # This is some kind of array so get the element within the array - the fieldType from now onwards is within the array - fieldType = fieldType._type_ - - # Base types have no fields in their "type" (note - arrays of base types are considered to be base types) - isBaseType = not hasattr(fieldType, "_fields_") - isUnion = isinstance(fieldType, ctypes.Union) - isEnum = hasattr(fieldType, "members") - - if isEnum: - for class_ in inspect.getmro(fieldType): - if issubclass(class_, ctypes._SimpleCData) and class_ is not fieldType: - fullTypeName = class_ - break - else: - raise TypeError("Can't find a ctypes class to use for enum %s" % fieldType) - else: - fullTypeName = fieldType - - # Extract a useful type name from the verbose name in CTypes - (junk, separator, fullTypeName) = str(fullTypeName).partition(".") - (fullTypeName, separator, junk) = fullTypeName.partition("'") - - # Check to see if there are further array dimensions that need to be unwrapped and if not exit to actually - if not issubclass(fieldType, ctypes.Array): - break - - # This is a multi-dimensional array so use a fake struct here to hold the next dimensionality - arrayItemNamePostfix='_item' - nodeTypeName = ''.join(["struct_", fullTypeName]) - fieldEntry = xmlTree.addField(current_message_fields, field[0], nodeTypeName, 'struct', elementSize, length, enum_type_name) - - # If the fake structure has already been populated then stop here - if xmlTree.structureInDictionary(nodeTypeName): - structAlreadyPopulated = True - break - - # Add the fake struct definition and start populating it during the next iteration - current_message_fields = xmlTree.addStructure(nodeTypeName, 'struct', elementSize) - - # Only need to do anything if a struct has not already been populated - if not structAlreadyPopulated: - # Now dealing with something that is not an array - (friendlyTypeName, separator, junk) = fullTypeName.partition("_Array_") - nodeTypeName = friendlyTypeName - if 'struct' in nodeTypeName and not isPointer: - fieldElementType = 'struct' - elif 'union' in nodeTypeName: - fieldElementType = 'union' - else: - fieldElementType = 'base' - - if isEnum: - enum_type_name = inspect.getmro(fieldType)[0].__name__ - xmlTree.addEnum(enum_type_name, sorted(fieldType.members.items())) - else: - enum_type_name = None - - # write the message entry in all cases. - fieldEntry = xmlTree.addField(current_message_fields, field[0] + arrayItemNamePostfix, nodeTypeName, fieldElementType, elementSize, length, enum_type_name) - - # if it's a structure add to structure dict etc, if not it's a base type and go to the next one - if fieldElementType == 'struct': - if not xmlTree.structureInDictionary(nodeTypeName): - fields_SubEntry = xmlTree.addStructure(nodeTypeName, fieldElementType, elementSize) - buildTree(xmlTree, fields_SubEntry, fieldType) - else: - if not isBaseType and not isPointer: - buildTree(xmlTree, fieldEntry, fieldType) - - -def xml_gen_main(outputBasepath, source, cfgfilename, core, image, rulesfilename): - messages = parse_msgdefs.parse_preprocessed_headers(source, core) - # Load the configuration file - with open(cfgfilename) as cfgfile: - if cfgfile == None: - raise SystemExit("Error: Could not find configuration file %s." % cfgfilename) - - # Load the core - if core not in ['acore', 'protocol_core', 'security_core']: - raise SystemExit("Error: Invalid core %s." % core) - - if rulesfilename is not None: - with open(rulesfilename) as rulesfile: - if rulesfile == None: - raise SystemExit("Error: Could not find rules file %s." %rulesfilename) - - # List of filenames and regular expressions - if not os.path.isdir(outputBasepath): - # If given an output filename rather than base directory, - # strip off the filename and keep the path - outputBasepath = os.path.dirname(outputBasepath) - - outputs = [] - - # Parse the pairs of filenames and regular expressions - for line in cfgfile.readlines(): - if not line.startswith("#"): # Exclude comments - if line.strip() != "": # Exclude empty lines - # Format is: filename , regexp - distribution, filename, regexp = line.split(",", 2) - # Remove regexp whitespace - regexp = regexp.strip() - # Remove whitespace and add base path - filename = filename.strip() - filename = os.path.join(outputBasepath, filename) - outputs.append((distribution, filename, regexp)) - - firmware_version = getFirmwareVersion() - - for distribution, outfilename, regexp in outputs: - #with messageTree(distribution, firmware_version, core) as xmlTree: - xmlTree = None - xmlTree = messageTree(distribution, firmware_version, core, image) - - # And a list of message IDs already used - # (These should ideally be stored in a tree for scalable search speed, but the number of messages is small so the wasted time isn't a problem) - messageIdList = [] - - for messageEnumName, structname, messageId, struct in messages: - # If not a stack xml then convert the IDs to the log IDs - # - # if distribution != "stack": - # messageId = getIdForMessage(messageId, core) - fieldsEntry = xmlTree.addMessageHeader(messageEnumName, messageId, core, structname) - buildTree(xmlTree, fieldsEntry, struct) - - xmlTree.outputMessageTree(regexp, rulesfilename, outfilename) - del xmlTree - - -if len(sys.argv) < 6: - raise SystemExit("Usage: python MessageXmlGen.py []") - -source = sys.argv[1] -outputBasepath = sys.argv[2] -cfgfilename = sys.argv[3] -corename = sys.argv[4] -imagename = sys.argv[5] - -# Optional Rules File -if len(sys.argv) == 7: - rulesfilename = sys.argv[6] -else: - rulesfilename = None - -# 删除.i文件中的#pragma预编译指令 -with open(source, "rb+") as f: - write_lines = [] - for line in f.readlines(): - if not re.match("#pragma", line.decode("utf-8", errors="replace").strip()): - write_lines.append(line) - f.seek(0, 0) - f.truncate() - - for line in write_lines: - f.write(line) - -xml_gen_main(outputBasepath, source, cfgfilename, corename, imagename, rulesfilename) diff --git a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_acore.cfg b/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_acore.cfg deleted file mode 100755 index 5f4e954..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_acore.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# The format of the configuration file is: -# , -# If the regular expression is blank, NO filtering will be performed. -# -# Lines starting # are not processed. - - -# Default for INTERNAL use only - NO messages are removed. -soc,acore_messages.xml, - -# Customer facing file -customer,acore_messages_external.xml, diff --git a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_protocol_core.cfg b/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_protocol_core.cfg deleted file mode 100755 index 9b84b5d..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_protocol_core.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# The format of the configuration file is: -# , -# If the regular expression is blank, NO filtering will be performed. -# -# Lines starting # are not processed. - - -# Default for INTERNAL use only - NO messages are removed. -soc,protocol_core_messages.xml, - -# Stack messages - No stack ID to log ID conversions are performed for "stack" -stack,stack.xml, - -# Customer facing file - REMOVE all DSP and RF related events. -customer,protocol_core_messages_external.xml,DSP|LL1_RF|LL1_WARNING_RF|LL1_LOG_RF|FSM|DUMP_PDU|LL1_LOG_DEBUG_VALUE|LPM_VETO|VALID_SUBFRAMES|SCHEDULER_SLEEP|TIME_CONVERSION|MEM_STATS|NPDCCH_CANCELLED|LL1_SLEEP_TIMER_EXPIRY_IND|FREQ_ERROR|LL1_READ_NVCONFIG_DATA - diff --git a/build/script/hdbxml_custom/MessageXmlGen/Messages.xsd b/build/script/hdbxml_custom/MessageXmlGen/Messages.xsd deleted file mode 100755 index 47a940e..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/Messages.xsd +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/script/hdbxml_custom/MessageXmlGen/merge_messages.py b/build/script/hdbxml_custom/MessageXmlGen/merge_messages.py deleted file mode 100755 index c8b8e40..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/merge_messages.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -#=============================================================================== -# @brief Merge per-core messages xml files. -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. -#=============================================================================== - -# Note: The merged messages file must be written in a separate process to -# SCons to avoid file-in-use errors on Windows where the SCons python -# process fails to call CloseFile even though close() is called in python. - -import os -import sys -from xml.etree import ElementTree - -merged_messages_xml_filename = sys.argv[1] -messages_xml_list = sorted(sys.argv[2:]) - -def combine_messages_xml(files, output_file): - ElementTree.register_namespace("","http://tempuri.org/xmlDefinition.xsd" ) - tree = ElementTree.parse(files[0]) - root = tree.getroot() - for filename in files[1:]: - data = ElementTree.parse(filename).getroot() - core_data = data.findall("{http://tempuri.org/xmlDefinition.xsd}Core") - root.extend(core_data) - - with open(output_file, 'wb') as output_file_handle: - tree.write(output_file_handle, encoding='utf-8', method='xml', xml_declaration=True) - -combine_messages_xml(messages_xml_list, merged_messages_xml_filename) diff --git a/build/script/hdbxml_custom/MessageXmlGen/messagexmlgen.cmake b/build/script/hdbxml_custom/MessageXmlGen/messagexmlgen.cmake deleted file mode 100755 index 3e22cba..0000000 --- a/build/script/hdbxml_custom/MessageXmlGen/messagexmlgen.cmake +++ /dev/null @@ -1,125 +0,0 @@ -function(messagexml TARGETDIR) - string(REPLACE "${CMAKE_SOURCE_DIR}/" "" RE_TARGETDIR ${TARGETDIR}) - set(TARGET "${RE_TARGETDIR}/${CORE}_messages") - set(STACK_XML "${RE_TARGETDIR}/stack.xml") - set(MESSAGES_XML "${TARGET}.xml") - set(MESSAGES_EXTERNAL_XML "${TARGET}_external.xml") - set(MESSAGES_HFILE "${TARGET}.h") - set(MESSAGES_CPPFILE "${TARGET}.i") - set(MESSAGEXMLCONFIG ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen_${CORE}.cfg) - set(MESSAGERULES ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageRules_${CORE}.xml) - if(EXISTS "${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}") - message(STATUS "REMOVE ${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}") - file(REMOVE "${CMAKE_SOURCE_DIR}/${MESSAGES_HFILE}") - endif() - list(LENGTH WANTED_HEADERS LI_LEN) - set(INDEX 1) - foreach(h_file ${WANTED_HEADERS}) - string(REPLACE "${CMAKE_SOURCE_DIR}/" "" re_h_file ${h_file}) - if (${INDEX} EQUAL ${LI_LEN}) - file(APPEND ${MESSAGES_HFILE} "#include \"${re_h_file}\"") - else() - file(APPEND ${MESSAGES_HFILE} "#include \"${re_h_file}\"\n") - math(EXPR INDEX "${INDEX}+1") - endif() - endforeach() - - set(XML_CPPINCFLAGS) - foreach(inc ${INCLUDES}) - string(REPLACE "${CMAKE_SOURCE_DIR}/" "" re_inc ${inc}) - list(APPEND XML_CPPINCFLAGS "-I${re_inc} ") - endforeach() - - - set(XML_CPPDEFFLAGS) -# 解析json时会给public_define添加-D前缀 - foreach(def ${XML_DEFINES}) - string(FIND "${def}" "-D" RET) - if(${RET} EQUAL 0) - list(APPEND XML_CPPDEFFLAGS "${def} ") - else() - list(APPEND XML_CPPDEFFLAGS "-D${def} ") - endif() - endforeach() - - file(WRITE ${RE_TARGETDIR}/database_include.rsp ${XML_CPPINCFLAGS}) - file(WRITE ${RE_TARGETDIR}/database_define.rsp ${XML_CPPDEFFLAGS}) - - execute_process(COMMAND ${CMAKE_C_COMPILER} -E @${RE_TARGETDIR}/database_include.rsp @${RE_TARGETDIR}/database_define.rsp ${MESSAGES_HFILE} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE RES - ERROR_VARIABLE ERR - OUTPUT_VARIABLE OUT) - if(NOT (${RES} EQUAL 0)) - message(FATAL_ERROR "${ERR}") - endif() - set(MESSAGES_IFILE "${TARGETDIR}/${CORE}_messages.i") - if(EXISTS ${MESSAGES_IFILE}) - file(REMOVE ${MESSAGES_IFILE}) - endif() - file(APPEND ${MESSAGES_CPPFILE} "${OUT}") - message(STATUS ${Python3_EXECUTABLE}) - message(STATUS "${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py ${MESSAGES_CPPFILE} ${MESSAGES_XML} ${MESSAGEXMLCONFIG} ${CORE} ${CORE} ${MESSAGERULES}") - execute_process(COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/script/hdbxml_custom/MessageXmlGen/MessageXmlGen.py ${MESSAGES_CPPFILE} ${MESSAGES_XML} ${MESSAGEXMLCONFIG} ${CORE} ${CORE} ${MESSAGERULES} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE RES - ERROR_VARIABLE ERR - OUTPUT_VARIABLE OUT) - if(NOT (${RES} EQUAL 0)) - message(FATAL_ERROR "${ERR}") - else() - message(STATUS "${OUT}") - endif() - # create_database() -endfunction() - -function(messagexml_generate_defs) - set(SOURCE) - set(SOURCEPATHS) - foreach(h ${ALL_HEADERS}) - get_filename_component(SOURCEPATH ${h} ABSOLUTE) - list(FIND SOURCEPATHS ${SOURCEPATH} RET) - if(${RET} EQUAL -1) - list(APPEND SOURCE ${h}) - list(APPEND SOURCEPATHS ${SOURCEPATH}) - endif() - endforeach() - set(WANTED_HEADERS) - foreach(h ${SOURCE}) - get_filename_component(H_FILENAME ${h} NAME) - if((${H_FILENAME} STREQUAL "rf_log_messages.h") AND (${CORE} STREQUAL "acore")) - continue() - endif() - if((${H_FILENAME} MATCHES ".*_messages.h$") OR (${H_FILENAME} MATCHES ".*_if.h$") OR - (${H_FILENAME} MATCHES ".*_messages_internal.h$") OR (${H_FILENAME} MATCHES ".*_message.h$")) - list(APPEND WANTED_HEADERS ${h}) - endif() - endforeach() - - get_property(MSGDEF_HEADERS GLOBAL PROPERTY TARGET_MSGDEF_HEADERS) - foreach(fsm ${MSGDEF_HEADERS}) - list(APPEND WANTED_HEADERS ${fsm}) - endforeach() - # message(STATUS ${WANTED_HEADERS}) - list(INSERT INCLUDES 0 ${MSGDEF_INCLUDES}) - list(INSERT INCLUDES 0 ${MSGDEF_INCLUDES_DFX}) - list(APPEND INCLUDES ${CMAKE_SOURCE_DIR}) - list(APPEND INCLUDES ${CMAKE_SOURCE_DIR}/kernel/liteos/liteos_v208.6.0_b017_cat1/Huawei_LiteOS/platform/libsec/include) - set(XML_DEFINES ${ALL_DEFINES}) - list(APPEND XML_DEFINES "SOC_DO_NOT_PACK_STRUCTS") - messagexml("${PROJECT_BINARY_DIR}") -endfunction() - -function(build_xml) - set(MSGDEF_INCLUDES "protocol/${CHIP}/include/message_headers/msgdef") - set(MSGDEF_INCLUDES_DFX "protocol/${CHIP}/include/message_headers/include") - set(ALL_HEADERS) - set(INCLUDES ${ALL_HEADER_DIRS}) - foreach(p ${INCLUDES}) - file(GLOB HEADERS "${p}/*.h") - foreach(h ${HEADERS}) - list(APPEND ALL_HEADERS ${h}) - endforeach() - endforeach() - messagexml_generate_defs() -endfunction() \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/app_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/app_struct_def.txt deleted file mode 100755 index cebe698..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/app_struct_def.txt +++ /dev/null @@ -1,41 +0,0 @@ -#include "base_datatype_def.txt" - -typedef enum { - SOC_DUMP_ACORE_CRASH_MEMORY = DUMP_TYPE_CRASH_MEMORY | (APPS << 8), - SOC_DUMP_PCORE_CRASH_MEMORY = DUMP_TYPE_CRASH_MEMORY | (PROTOCOL << 8), -} soc_dump_id; - -typedef struct { - osal_u32 attribute; - osal_u32 dump_id; /* soc_dump_id */ -} soc_dump_info_req; - -typedef struct { - osal_u32 cmd_ver; - osal_u32 dump_id; /* soc_dump_id */ - osal_u32 ret; - osal_u32 size; - osal_u32 pad; -} soc_dump_info_ind; - -typedef struct { - osal_u32 offser; - osal_u32 size; -} soc_dump_content_item; - -typedef struct { - osal_u32 cmd_ver; - osal_u32 dump_id; /* soc_dump_id */ - osal_u8 item_cnt; - soc_dump_content_item items[0]; -} soc_dump_content_req; - -typedef struct { - osal_u32 cmd_ver; - osal_u32 dump_id; /* soc_dump_id */ - osal_u32 ret; - osal_u32 offset; - osal_u32 size; - osal_u32 data[0]; -} soc_dump_content_ind; - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/base_datatype_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/base_datatype_def.txt deleted file mode 100755 index 41fa93c..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/base_datatype_def.txt +++ /dev/null @@ -1,69 +0,0 @@ -uint32_t 32 0 -uint16_t 16 0 -uint8_t 8 0 - -int32_t 32 1 -int16_t 16 1 -int8_t 8 1 - -enum 32 0 -HSO_ENUM 32 0 - -u32 32 0 -u16 16 0 -u8 8 0 - -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -TD_U8A 8 0 -TD_U16A 16 0 -TD_CHARTA 8 1 1 - -TD_U32 32 0 -TD_U16 16 0 -TD_U8 8 0 -TD_S32 32 1 -TD_S16 16 1 -TD_S8 8 1 -TD_BOOL 8 0 -TD_CHAR 8 1 1 -char 8 1 1 - -long 32 1 -TD_PVOID 32 0 -TD_PBYTE 32 0 - -td_u32 32 0 -td_u16 16 0 -td_u8 8 0 -td_s32 32 1 -td_s16 16 1 -td_s8 8 1 -td_bool 8 0 -td_char 8 1 1 - -td_pvoid 32 0 -td_pbyte 32 0 -uintptr_t 32 0 - -td_u64 64 0 -td_uintptr_t 32 0 -td_void 32 0 - -c_ubyte 8 0 -c_bool 8 0 -c_byte 8 1 -c_char 8 1 1 -c_ushort 16 0 -c_short 16 1 -c_ulong 32 0 -c_uint 32 0 -c_int 32 1 -LP_c_ubyte 32 0 -LP_c_ulong 32 0 -c_long 32 1 -c_void_p 32 0 -c_ulonglong 64 0 \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/extern_datatype_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/extern_datatype_def.txt deleted file mode 100755 index e69de29..0000000 diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/mac_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/mac_struct_def.txt deleted file mode 100755 index c49ca27..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/mac_struct_def.txt +++ /dev/null @@ -1,8 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/msg_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/msg_struct_def.txt deleted file mode 100755 index 8e844e1..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/msg_struct_def.txt +++ /dev/null @@ -1,4 +0,0 @@ -#include "base_datatype_def.txt" - -#include "extern_datatype_def.txt" - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/os_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/os_struct_def.txt deleted file mode 100755 index a63116b..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/os_struct_def.txt +++ /dev/null @@ -1,13 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - - -typedef struct { -} null_stru; - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/phy_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/phy_struct_def.txt deleted file mode 100755 index 562cb0f..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/phy_struct_def.txt +++ /dev/null @@ -1,7 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/pseudo_cmd_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/pseudo_cmd_struct_def.txt deleted file mode 100755 index c66279b..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/pseudo_cmd_struct_def.txt +++ /dev/null @@ -1,6 +0,0 @@ -#include "base_datatype_def.txt" - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/struct_def.txt deleted file mode 100755 index bb7fac7..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/struct_def.txt +++ /dev/null @@ -1,67 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - - -typedef struct { -} null_stru; - -typedef struct { - char str[1]; -} str_type; - -typedef struct { - long data[2]; -} s32_array_2_stru; - -typedef struct { - long data[3]; -} s32_array_3_stru; - -typedef struct { - long data[4]; -} s32_array_4_stru; - -typedef struct { - long data[5]; -} s32_array_5_stru; - -typedef struct { - long data[6]; -} s32_array_6_stru; - -typedef struct { - osal_u32 data[2]; -} u32_array_2_stru; - -typedef struct { - unsigned long data[3]; -} u32_array_3_stru; - -typedef struct { - osal_u32 data[4]; -} u32_array_4_stru; - -typedef struct { - char str[128]; -} file_type; - -typedef struct { - char str[1]; -} dump_data_stru; - -typedef struct { - char str[1]; -} dump_hex_stru; - -typedef struct { - osal_u32 baud_rate; - osal_u8 data_bits; - osal_u8 stop_bits; - osal_u8 parity; - osal_u8 pad; -} soc_uart_attr; \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/diag/sys_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/diag/sys_struct_def.txt deleted file mode 100755 index 40aae2a..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/diag/sys_struct_def.txt +++ /dev/null @@ -1,761 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - - -typedef struct { -} null_stru; - -typedef struct -{ - osal_u32 id; -} SOC_DBG_STAT_Q_S; - -typedef struct { - osal_u8 a; - osal_u8 b; -} soc_stat_diag_p_qry; - -typedef struct { - osal_u16 send_uart_fail_cnt; - osal_u16 ack_ind_malloc_fail_cnt; - osal_u16 msg_malloc_fail_cnt; - osal_u16 msg_send_fail_cnt; - osal_u16 msg_overbig_cnt; - osal_u16 ind_send_fail_cnt; - osal_u16 ind_malloc_fail_cnt; - osal_u8 diag_queue_used_cnt; - osal_u8 diag_queue_total_cnt; - osal_u8 dec_fail_cnt; - osal_u8 enc_fail_cnt; - osal_u16 pkt_size_err_cnt; - osal_u32 local_req_cnt; - osal_u32 remote_req_cnt; - osal_u16 req_cache_overflow_cnt; - osal_u8 conn_excep_cnt; - osal_u8 conn_bu_cnt; - osal_u8 chl_busy_cnt; - osal_u8 req_overbig1_cnt; - osal_u16 rx_remote_req_cnt; - osal_u16 rx_remote_req_invalid_cnt; - osal_u8 cmd_list_total_cnt; - osal_u8 cmd_list_used_cnt; - osal_u8 stat_list_total_cnt; - osal_u8 stat_list_used_cnt; - osal_u8 req_overbig2_cnt; - osal_u8 invalid_dec_id; - osal_u8 heart_beat_timeout_cnt; - osal_u8 rx_start_flag_wrong_cnt; - osal_u8 rx_ver_wrong_cnt; - osal_u8 rx_pkt_data_size_wrong_cnt; - osal_u8 rx_crc16_req_wrong_cnt; - osal_u8 rx_crc16_mux_wrong_cnt; - osal_u8 pad[2]; -} soc_stat_diag_qry; - -typedef struct tag_atiny_critical_information { - osal_u16 network_access_count_total; - osal_u16 bs_reg_retry_count_total[3]; - osal_u16 reg_retry_count_total[3]; - osal_u16 send_data_last_mid; - osal_u16 recv_data_last_mid; - osal_u32 send_data_total; - osal_u32 recv_data_total; -} atiny_critical_information; - -typedef struct tag_atiny_platform_state { - osal_u8 context_state[3]; - osal_u8 lwm2m_state[3]; - osal_u8 bootstrap_state[3]; - osal_u8 dtls_state[3]; -} atiny_platform_state; - -typedef struct tag_atiny_retrans_data { - osal_u32 mid[9]; - osal_u8 retrans_count[9]; - osal_u8 dtls_retrans_count[3]; -} atiny_retrans_data; - - -typedef struct tag_atiny_ota_data { - osal_u16 req_fota_block_size; - osal_bool force_suspend_firmware; - osal_bool sota_update_flag; -} atiny_ota_data; - -typedef struct tag_atiny_retry_counter { - osal_u8 bs_reg_retry_count_current[3]; - osal_u8 reg_retry_count_current[3]; -} atiny_retry_counter; - -typedef struct { - osal_u16 cmd_cnt; - osal_u16 evt_cnt; - osal_u16 cmd_opcode[10]; - osal_u32 cmd_time_stamp[10]; - osal_u16 evt_opcode[10]; - osal_u32 evt_time_stamp[10]; - osal_u8 evt_status[10]; -} tl_dfx_stru; - -typedef struct { - osal_u32 sleep_cnt; - osal_u32 wakeup_cnt; - osal_u32 ble_int_mask; - osal_u32 adv_miss_cnt; - osal_u32 idx; - osal_u32 wakeup_finetarget[10]; - osal_u32 ble_finetarget[10]; - osal_u32 ble_grosstarget[10]; - osal_u32 wakeup_end_clkn[10]; -} bt_sleep_dfx; - -typedef struct { - osal_bool en_print_period; - osal_u32 ds_proc_times; - osal_u32 ds_wake_times; - osal_u32 lp3_ds_times; - osal_u32 n_ds_kick_reson; - osal_u32 n_ds_os_schedule; - osal_u32 n_ds_veto_reson[29]; - osal_u32 stat_end; -} soc_lpc_stat_a; - -typedef struct { - osal_bool en_print_period; - osal_u32 ds_proc_times; - osal_u32 ds_wake_times; - osal_u32 lp3_ds_times; - osal_u32 n_ds_kick_reson; - osal_u32 n_ds_os_schedule; - osal_u32 n_ds_veto_reson[12]; - osal_u32 stat_end; -} soc_lpc_stat_p; - -typedef struct { - osal_bool backup_watchdog; - osal_bool enable; - osal_u32 ds_os_schedule_tick; - osal_u32 ds_veto; - osal_u32 clk_veto; - c_ulonglong clk_permit_ms; - c_ulonglong ds_permit_ms; - osal_u32 g_restore_funcs[29]; - osal_u32 g_restore_param[29]; - osal_u32 g_check_funcs[29]; - osal_u32 g_check_param[29]; - osal_u32 veto_lp3; - osal_u32 en_magic; - osal_u32 en_idle_time; - osal_u32 en_no_action_time; -} soc_lpc_process_ctrl_a_s; - -typedef struct { - osal_bool backup_watchdog; - osal_bool enable; - osal_u32 ds_os_schedule_tick; - osal_u32 ds_veto; - osal_u32 clk_veto; - c_ulonglong clk_permit_ms; - c_ulonglong ds_permit_ms; - osal_u32 g_restore_funcs[12]; - osal_u32 g_restore_param[12]; - osal_u32 g_check_funcs[12]; - osal_u32 g_check_param[12]; - osal_u32 veto_lp3; - osal_u32 en_magic; - osal_u32 en_idle_time; - osal_u32 en_no_action_time; -} soc_lpc_process_ctrl_s; - -typedef struct { - osal_u32 total; - osal_u32 used; - osal_u32 free; - osal_u32 free_node_num; - osal_u32 used_node_num; - osal_u32 max_free_node_size; - osal_u32 malloc_fail_count; - osal_u32 peek_size; -} soc_mem_info; - -typedef struct { - osal_u32 will_ds_times; - osal_u32 real_ds_times; - osal_u32 nds_kick_times; - osal_u32 ds_veto; - osal_u32 lpc_max_id; - osal_u32 real_lp3_times; - osal_u32 lp3_veto; - c_ulonglong ds_permit_ms; -} soc_lpc_info; - -typedef struct { - osal_u32 dfx_write_cnt; - osal_u32 dfx_read_cnt; - osal_u32 dfx_writed_cnt; - osal_u32 dfx_readed_cnt; - osal_u8 deinit_fail_times; - osal_u8 pad[3]; - osal_u32 tx_mux; -} diag_uart_driver_extra; - -typedef struct { - osal_u8 timer_usage; - osal_u8 task_usage; - osal_u8 sem_usage; - osal_u8 queue_usage; - osal_u8 mux_usage; - osal_u8 pad[3]; - osal_u32 err_info; -} soc_os_resource_use_stat_s; - -typedef struct { - osal_bool valid; - osal_bool last; - osal_u32 crash_sec; - osal_u32 main_type; - osal_u32 sub_type; - osal_u32 core; - osal_u32 data[5]; - osal_u32 mepc; - osal_u32 mstatus; - osal_u32 mtval; - osal_u32 mcause; - osal_u32 ccause; - osal_u32 ra; - osal_u32 sp; - osal_u32 mem_total; - osal_u32 mem_used; - osal_u32 mem_free; - osal_u32 mem_peek_size; -} diag_syserr_info; - -typedef enum { - AT_CMD_EXECUTE_SET, - AT_CMD_EXECUTE_READ, - AT_CMD_EXECUTE_EXEC, - AT_CMD_EXECUTE_TEST, -} at_cmd_execute_type; - -typedef struct { - osal_u8 cmd_id; - at_cmd_execute_type type; -} at_cmd_record; - -typedef struct { - at_cmd_record last_at_cmd_record; - osal_bool at_cmd_in_progress; - osal_u16 app_data_of_bytes; - osal_u16 async_list_node_count; - osal_u16 reboot_reset_reason; -} report_at_stat; - -typedef struct { - osal_u8 psm_status; - osal_u8 psm_enter_action; - osal_u8 psm_exit_action; - osal_bool as_deactivating_pover_save; - osal_bool psm_enhance; -} mmc_psm_mng_t_report; - -typedef struct { - osal_u8 sim_present_status; - osal_u8 ps_reg_status; - mmc_psm_mng_t_report psm_mng_info; - osal_bool user_reselection_in_progress; - osal_bool switch_off_pending; - osal_bool force_power_off; -} mmc_mml_context_report; - -typedef struct { - osal_u8 spec_plmn_search_state; - osal_u8 as_cell_camp_on; - osal_u8 selection_mode; - osal_bool is_first_search; - osal_bool is_stored_search; - osal_bool is_need_deep_search; - osal_bool out_of_service; - osal_bool is_need_abort_rsp; - osal_u8 select_plmn[3]; - osal_u8 user_spec_plmn_id[3]; - osal_u8 user_reselect_plmn_id[3]; - osal_u16 plmn_search_time_out_count; - osal_u16 stored_search_max_count; - osal_u16 stored_search_count; - osal_u8 search_cause; - osal_u8 abort_cause; - osal_u8 coverage_state; - osal_u8 ps_reg_additional_action; -} mmc_plmn_search_report; - -typedef struct { - mmc_plmn_search_report plmn_search_ctrl; - osal_u8 attach_pending; - osal_bool attach_locked; - osal_u8 detach_pending; - osal_bool plmn_search_in_progress; - osal_bool bg_search_in_progress; - osal_bool only_forbidden_plmns_found; - osal_bool cell_available; - osal_u32 search_period; - osal_bool user_plmn_search_req_pending; - osal_bool plmn_search_may_be_resumed; -} mmc_context_ctrl_info_report; - -typedef struct { - osal_u8 sim_state; - osal_u8 autostart_state; - osal_u8 reg_state; -} at_info_report; - -typedef struct { - osal_bool nslpi; - osal_bool need_reattach; - osal_bool is_cplane_cntx; - osal_u8 cid; - osal_u8 ebi; - osal_u8 h_comp; - osal_u8 trigger; - osal_u8 ul_data_route; - osal_bool t3396_is_running; - osal_u32 pdp_fsm_contx_state; -} taf_pdp_cntx_report; - -typedef struct { - osal_u8 ps_status; - osal_u8 service_status; - osal_u8 plmn_eps_max; - osal_u8 plmn[3]; -} esm_ctx_t_report; - -typedef struct { - osal_bool enabled; - osal_u8 f[4]; - osal_u8 c_pdn[4]; -} esm_rpm_param; - -typedef struct { - esm_ctx_t_report ctx; - osal_u8 def_pdn_cid; - osal_u8 attach_cid; - osal_u8 pdn_num; - osal_u8 eps_num; - osal_u8 pti_num; - osal_u16 data_num; - osal_u16 excpt_num; - osal_u16 ping_num; - osal_u16 wait_cnf_num; - osal_u8 current_state; - esm_rpm_param rpm_param; -} esm_entry_report; - -typedef struct { - osal_u8 attach_type; - osal_bool reg_without_pdn; - osal_u8 camped_type; - osal_bool roaming; - osal_u8 attempt_count; - osal_u8 attach_complete_count; -} emm_attach_report; - -typedef struct { - osal_u8 detach_mode; - osal_bool detach_req_send_succ; - osal_u8 detach_atmp_cnt; - osal_u8 cause; -} emm_detach_report; - -typedef struct { - osal_bool enabled; - osal_u8 n1; - osal_u8 t1; - osal_u8 c_br_1; - osal_u8 c_r_1; - osal_u8 cur_n1_count; -}emm_rpm_ctrl_data; - -typedef struct { - osal_u8 ksiasme; - osal_u32 ul_nas_count; - osal_u32 dl_nas_count; - osal_u32 fail_times; - osal_u8 integrity_check_fail_times; -} emm_secu_report; - -typedef struct { - osal_u8 ser_start_cause; - osal_u8 est_cause; - osal_bool data_valid; - osal_u8 attempt_count; - osal_bool start_in_conn; -} emm_ser_report; - -typedef struct { - osal_u8 emm_tau_type; - osal_u8 tau_start_cause; - osal_u8 tau_attempt_cnt; - osal_bool idle_tau; - osal_bool active_flag; - osal_bool signalling_active_flag; - osal_bool t3412_expired; - osal_u8 param_changes; - osal_bool settings_synced; - osal_u8 trigger_tau_rrc_rel; - osal_bool local_bearer_deactivation; - osal_bool wait_as_camp_on; -} emm_tau_report; - -typedef struct { - osal_u8 as_state; - osal_u8 drb_status; - osal_u8 sim_stat; - osal_u8 ps_sim_validity; -} emm_pub_info_report; - -typedef struct { - osal_u8 bar_attempt_counter; - osal_u16 bar_req_cause_mask; - osal_u8 bar_rel_action; -} emm_bar_rel_timer_info; - -typedef struct { - osal_bool low_priority_flag; - osal_bool exception_flag; - osal_u8 backoff_plmn[3]; - osal_u32 start_time; - osal_u8 expiry_action; -} emm_backoff_timer_info; - -typedef struct { - osal_u8 emm_main_state; - osal_u8 emm_sub_state; - osal_u8 secu_main_state; - osal_u8 secu_sub_state; - osal_u8 msg_buff_count; - osal_u8 rrc_conn_state; -} emm_main_context_report; - -typedef struct { - osal_u32 usim_update_count; - osal_u32 usim_cur_state; - osal_u32 usim_deactive_cause; - osal_u32 pres_timer_status; - osal_u32 sleep_veto_active; - osal_u32 usim_ind_status; -} usim_info_report; - -typedef struct { - mmc_mml_context_report mmc_mml_ctx; - mmc_context_ctrl_info_report mmc_context; - at_info_report at_info; - taf_pdp_cntx_report taf_pdp_cntx[11]; - esm_entry_report esm_entry; - emm_attach_report emm_attach; - emm_detach_report emm_detach; - emm_rpm_ctrl_data emm_rpm; - emm_secu_report emm_secu; - emm_ser_report emm_ser; - emm_tau_report emm_tau; - emm_pub_info_report emm_pub_info; - osal_u8 emm_t3440_rel_cau; - emm_bar_rel_timer_info emm_bar_rel_timer; - emm_backoff_timer_info emm_backoff_timer; - emm_main_context_report emm_main_context; - usim_info_report usim_info; -} report_nas_stat; - -typedef osal_u32 secnds; - -typedef struct { - osal_s8 default_s_search_delta_p; -} nb_iot_relaxed_monitoring_config_t; - -typedef struct { - osal_s8 meas_threshold_sinr_db; - osal_s8 meas_offset_sinr_db; - osal_u8 max_sinr_enable_times; - osal_u8 max_sinr_disable_times; -} nb_iot_sinr_meas_control_config_t; - -typedef struct { - osal_bool reselection_enabled; - osal_u8 resel_min_coverage_level; - osal_s8 srxlev_meas_disable_hyst_db; - osal_bool relaxed_monitoring_enabled; - nb_iot_relaxed_monitoring_config_t relaxed_monitoring_config; - osal_bool sinr_meas_control_enabled; - nb_iot_sinr_meas_control_config_t sinr_meas_control_config; -} nb_iot_cell_reselection_config_t; - -typedef struct { - osal_u8 max_pcell_mib_sib_attempt_counter; - osal_u8 max_ncell_mib_sib_attempt_counter; - osal_u16 band_scan_puncture_rate; - osal_s32 fast_search_threshold; - osal_s32 slow_search_threshold; - secnds data_inactivity_timeout; - secnds sib16_read_period_s; - nb_iot_cell_reselection_config_t cell_reselection_config; - osal_bool serving_cell_idle_meas_report_enabled; - osal_bool multi_carrier_enabled; - osal_bool early_contention_resolution_report_enabled; -} rrc_nvconfig_info_t; - -typedef enum { - RRC_BAR_CAUSE_CELL_SELECTION, - RRC_BAR_CAUSE_CELL_RESELECTION -} rrc_barred_cause; - -typedef enum { - TRANS_OUT_OF_CONNECTED_STATE, - SERVING_CELL_LOST_TRANS_TO_SEARCH, - IDLE_STATE_TRANS_TO_SEARCH, - REESTAB_SERVING_CELL_LOST_TRANS_TO_SEARCH, - REESTAB_ABORT_CONTINUE_SEARCH, -} rrc_oos_cause; - -typedef struct { - osal_u16 est_fail_count; - osal_u16 asn_decode_fail_count; - osal_u16 asn_encode_fail_count; - osal_u16 reselect_count; - osal_u16 search_count; - osal_u32 last_search_start_time; - osal_u32 last_search_time; - osal_u32 search_avg_time; - rrc_barred_cause last_bar_cause; - rrc_oos_cause last_oos_cause; -} rrc_debug_info_t; - -typedef enum { - RRC_TOP_FSM_STATE_SEARCH, - RRC_TOP_FSM_STATE_DEACTIVATED, - RRC_TOP_FSM_STATE_IDLE, - RRC_TOP_FSM_STATE_CONNECTED, - RRC_TOP_FSM_STATE_CONNECTING, - RRC_TOP_FSM_STATE_REESTAB, - RRC_TOP_FSM_STATE_NULL, - MAX_NUM_TOP_FSM_STATES -} rrc_top_fsm_state_t; - -typedef struct { - rrc_nvconfig_info_t rrc_nvcfg; - rrc_debug_info_t rrc_debug_info; - rrc_top_fsm_state_t rrc_current_state; - rrc_top_fsm_state_t rrc_next_state; - osal_u32 rrc_last_msg_id; - - /* g_rrc_ctxt */ - osal_bool rrc_cell_select_req_running; - osal_bool ll1_l2_deactivated; - osal_bool bg_search_active; - osal_bool as_security_active; -} report_rrc_stat; - -typedef osal_u32 sf_count; - -typedef struct { - /* mac_l2_context */ - osal_u16 crnti; - osal_bool rai_activation; -} report_mac_ul_stat; - -typedef enum { - RLC_DL_FSM_STATE_ACTIVATED, - RLC_DL_FSM_STATE_INITIALISED, - RLC_DL_FSM_STATE_SUSPENDED, -} rlc_dl_fsm_state_t; - -typedef struct { - rlc_dl_fsm_state_t rlc_dl_fsm[5]; -} report_rlc_dl_stat; - -typedef osal_u16 l2_size; - -typedef enum { - RLC_UL_FSM_STATE_ACTIVATED, - RLC_UL_FSM_STATE_INITIALISED, - RLC_UL_FSM_STATE_SUSPENDED, -} rlc_ul_fsm_state_t; - -typedef struct { - rlc_ul_fsm_state_t rlc_ul_fsm[5]; - /* rlc_ul_buffer_status */ - l2_size srb0_datalen; - osal_u16 rlc_ul_byte_without_poll[4]; - osal_u16 rlc_ul_pdu_num_without_poll[4]; -} report_rlc_ul_stat; - -typedef struct { - osal_u32 cipher_decipher_failure_count; - osal_u32 intefrity_check_failure_count; -} security_debug_info_t; - -typedef enum { - PDCP_SRB_FSM_STATE_FIRST_PDU_RECEIVED, - PDCP_SRB_FSM_STATE_IDLE, - PDCP_SRB_FSM_STATE_INTEGRITY_CHECKED, - PDCP_SRB_FSM_STATE_INTEGRITY_FAILED, - PDCP_SRB_FSM_STATE_READ_INTEGRITY_CHECK_STATUS, - PDCP_SRB_FSM_STATE_REESTABLISHED, - PDCP_SRB_FSM_STATE_SECURED, - PDCP_SRB_FSM_STATE_SUSPENDED, -} pdcp_srb_fsm_state_t; - -typedef enum { - PDCP_DRB_FSM_STATE_CIPHERED, - PDCP_DRB_FSM_STATE_REESTABLISHED, - PDCP_DRB_FSM_STATE_SUSPENDED, - PDCP_DRB_FSM_STATE_UNINITIALISED, -} pdcp_drb_fsm_state_t; - -typedef struct { - pdcp_srb_fsm_state_t pdcp_srb_fsm[1]; - pdcp_drb_fsm_state_t pdcp_drb_fsm[1]; - security_debug_info_t security_debug_info; -} report_pdcp_stat; - -typedef struct { - osal_u16 direct_ind_rx_count; - osal_u16 paging_rx_count; - osal_u16 missed_paging_count; - osal_u16 missed_paging_opportunity; -} report_paging_stat; - -typedef struct { - osal_u16 rar_fail_count; - osal_u16 contention_resolution_fail_count; - osal_u16 rach_fail_count; -} report_rach_stat; - -typedef struct { - osal_u16 nack_pdu; - osal_u16 total_pdu; - osal_u32 rate; -} mac_uldl_stat; - -typedef struct { - mac_uldl_stat ul; - mac_uldl_stat dl; -} report_mac_trans_stat; - -typedef osal_u32 nb_iot_earfcn; -typedef osal_s16 centibels; -typedef enum { - LL1_NULL, - LL1_INIT, - LL1_CELL_SEARCH, - LL1_IDLE, - LL1_CONNECTED, - LL1_RADIO_TEST, -} ll1_states; - -typedef struct { - nb_iot_earfcn earfcn; - osal_u16 pci; - osal_u16 rsrp; - osal_u16 snr; -} report_signal_stat; - -typedef struct { - ll1_states current_state; - ll1_states previous_state; -} report_fsm_state; - -typedef enum { - LL1_ERROR_TAG_DSP_COMPLETION_IGNORED_TX, - LL1_ERROR_TAG_DSP_COMPLETION_IGNORED_RX, - LL1_ERROR_TAG_MSG_DROPPED_NOT_INTER_THREAD, - LL1_ERROR_TAG_MSG_DROPPED_NOT_INTER_THREAD_IDLE, - LL1_ERROR_TAG_PDCCH_ORDER_NPRACH_REPETITION_NUMBER_INDEX_TOO_LARGE, - LL1_ERROR_TAG_UNKNOWN_STATE, - LL1_ERROR_TAG_UNKNOWN_EVENT, - LL1_ERROR_TAG_INVALID_PRACH_NUM_REP_PER_PREAMBLE, - LL1_ERROR_TAG_INVALID_RNTI_TYPE, - LL1_ERROR_TAG_INVALID_RNTI_TYPE_PDSCH, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_DELAY, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_LOG, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_LOAD_PUSCH, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_SEND_PUSCH, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_RAR, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_MSG4, - LL1_ERROR_TAG_INVALID_DCI_FORMAT_MSG4_SDU, - LL1_ERROR_TAG_INVALID_RACH_INITIATOR, - LL1_ERROR_TAG_INVALID_RACH_INITIATOR_RETRY, - LL1_ERROR_TAG_INVALID_RACH_INITIATOR_MSG4_SDU, - LL1_ERROR_TAG_INVALID_RACH_INITIATOR_MSG3_SENT, - LL1_ERROR_TAG_INVALID_PRACH_PREAMBLE_RANGE, - LL1_ERROR_TAG_INVALID_PRACH_PREAMBLE_RANGE_LIB, - LL1_ERROR_TAG_UNEXPECTED_STATE, - LL1_ERROR_TAG_UNEXPECTED_STATE_KICK, - LL1_ERROR_TAG_UNEXPECTED_STATE_LEAVING, - LL1_ERROR_TAG_UNEXPECTED_STATE_RACH_REQ, - LL1_ERROR_TAG_PAGING_OCCASSION_CALC, - LL1_ERROR_TAG_FREQ_CHANGE_ALREADY_SAVED, - LL1_ERROR_TAG_INVALID_DRX_CYCLE_LENGTH, - LL1_ERROR_TAG_SCHEDULE_DETECTION_FAILED, - LL1_ERROR_TAG_CANNOT_MEASURE_CELL, - LL1_ERROR_TAG_CANNOT_MEASURE_CELL_NO_CELL, - LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE, - LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE_PUSCH, - LL1_ERROR_TAG_INVALID_SUBCARRIER_SPACE_PUCCH, - LL1_ERROR_TAG_INVALID_SUBCARRIER_IND, - LL1_ERROR_TAG_INVALID_SUBCARRIER_IND_DURATION, - LL1_ERROR_TAG_CELL_SELECT_ALREADY_PENDING, - LL1_ERROR_TAG_INVALID_THREE_TONE_SET, - LL1_ERROR_TAG_INVALID_SIX_TONE_SET, - LL1_ERROR_TAG_INVALID_SUBCARRIER_FREQ, - LL1_ERROR_TAG_UNSUPPORTED_DSP_COMMAND, - LL1_ERROR_TAG_UNSUPPORTED_DSP_COMMAND_FLASH, - LL1_ERROR_TAG_CONNECTED_LPM_RESYNC_FAILURE, - LL1_ERROR_TAG_CELL_DETECT_EXCEEDS_MAX, - LL1_ERROR_TAG_INVALID_CARRIER_TYPE_PDSCH, - LL1_ERROR_TAG_INVALID_CARRIER_TYPE_SELECT, - LL1_ERROR_TAG_INVALID_CARRIER_TYPE_PDCCH, - LL1_ERROR_TAG_INVALID_CARRIER_TYPE_GET_MODE, - LL1_ERROR_TAG_INVALID_BASE_SUBFRAME_PATTERN, - LL1_ERROR_TAG_RF_MULTITONE_READ_FAILED, - LL1_ERROR_TAG_RF_SET_CALIBRATION_FAILURE, - LL1_ERROR_TAG_RF_RX_NOT_ACTIVE, - LL1_ERROR_TAG_INVALID_ANCHOR_CARRIER_DL_RASTER_OFFSET, - LL1_ERROR_TAG_NO_HARQ_WAITING_FOR_MAC_DATA, - LL1_ERROR_TAG_NO_DL_HARQ_PENDING, - LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED, - LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED_PUSCH, - LL1_ERROR_TAG_INVALID_HARQ_ID_DATA_DROPPED_REQ_HANDLER, - LL1_ERROR_TAG_INVALID_NPDCCH_COMPLETION_STATE, - LL1_ERROR_TAG_CARRIER_HAS_NO_RACH_RESOURCE_FOR_ECL, - LL1_ERROR_TAG_DIDNT_LOG_RF_EVENTS, - LL1_ERROR_TAG_MALLOC_FAILURE_SOFT_COMBINING, - LL1_ERROR_TAG_SSS_RESYNC_STATE_INVALID, - LL1_ERROR_TAG_SIB1_SCHD_INFO_INVALID, -} ll1_log_error_value_tag_t; - -typedef enum { - LL1_WARNING_TAG_RE_TX_UL_TBS_MISMATCH, - LL1_WARNING_TAG_RE_TX_UL_TBS_MISMATCH_N0, - LL1_WARNING_TAG_RACH_OPPORTUNITY_PASSED, - LL1_WARNING_TAG_PAGING_OPPORTUNITY_PASSED, - LL1_WARNING_TAG_NWUS_OPPORTUNITY_PASSED, - LL1_WARNING_MCS_BIGGER_THAN_TWO_WITHOUT_EDT, - LL1_WARNING_CONN_RACH_DCI_N1_RECEIVED_WITH_TCRNTI, -} ll1_log_warning_value_tag_t; - - -typedef struct { - report_paging_stat paging_stat; - osal_u16 power_ratio_fail_count; - report_rach_stat rach_stat; - report_mac_trans_stat mac_trans_stat; - osal_u16 cell_switch_count; - osal_u16 rlf_out_sync_count; - ll1_log_error_value_tag_t last_error_log; - ll1_log_warning_value_tag_t last_warning_log; - report_signal_stat signal_stat; - report_fsm_state fsm_state; -} report_ll1_stat; \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_cmd_db.xml b/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_cmd_db.xml deleted file mode 100755 index 60fc35e..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_cmd_db.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_layout_db.xml b/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_layout_db.xml deleted file mode 100755 index 9199673..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_layout_db.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_nvi_db.xml b/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_nvi_db.xml deleted file mode 100755 index 084d34e..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_nvi_db.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_prim_db.xml b/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_prim_db.xml deleted file mode 100755 index 3534b18..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_prim_db.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_subsystem_db.xml b/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_subsystem_db.xml deleted file mode 100755 index 81f821b..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/hdbcfg/mss_subsystem_db.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - <ITEM ID="0x00" NAME="NO." STAT="1" VALUE="0" DESCRIPTION="..." /> - <ITEM ID="0x01" NAME="Category" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x02" STAT="0" NAME="Level" DESCRIPTION="..." /> - <ITEM ID="0x03" STAT="1" NAME="Date" DESCRIPTION="..." /> - <ITEM ID="0x04" NAME="Time" STAT="1" DESCRIPTION="..." /> - <ITEM ID="0x05" NAME="TimeStamp" STAT="1" DESCRIPTION="..." /> - <ITEM ID="0x06" NAME="Chip" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x07" NAME="Cpu" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x08" NAME="Side" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x09" NAME="Layer" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0A" NAME="Prim" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0B" NAME="Source" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0C" NAME="Destination" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0D" NAME="FileName" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0E" NAME="LineNo" STAT="0" DESCRIPTION="..." /> - <ITEM ID="0x0F" NAME="Data" STAT="0" DESCRIPTION="..." /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/nv/base_datatype_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/nv/base_datatype_def.txt deleted file mode 100755 index b502696..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/nv/base_datatype_def.txt +++ /dev/null @@ -1,39 +0,0 @@ -UINT64 64 0 -UINT32 32 0 -UINT16 16 0 -UINT8 8 0 - -INT64 64 1 -INT32 32 1 -INT16 16 1 -INT8 8 1 - -enum 32 0 - -u64 64 0 -u32 32 0 -u16 16 0 -u8 8 0 - -s64 64 1 -s32 32 1 -s16 16 1 -s8 8 1 -BOOL 8 0 - -osal_u64 64 0 -osal_u32 32 0 -osal_u16 16 0 -osal_u8 8 0 -osal_s64 64 1 -osal_s32 32 1 -osal_s16 16 1 -osal_s8 8 1 -osal_bool 8 0 -osal_char 8 1 1 -char 8 1 1 - -long 32 1 -osal_pvoid 32 0 -osal_pbyte 32 0 - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/nv/extern_datatype_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/nv/extern_datatype_def.txt deleted file mode 100755 index e69de29..0000000 diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_app_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_app_struct_def.txt deleted file mode 100755 index 346ee26..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_app_struct_def.txt +++ /dev/null @@ -1,2 +0,0 @@ -#include "base_datatype_def.txt" - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_protocol_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_protocol_struct_def.txt deleted file mode 100755 index aef80d7..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_protocol_struct_def.txt +++ /dev/null @@ -1,13 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_security_struct_def.txt b/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_security_struct_def.txt deleted file mode 100755 index 9f3e57d..0000000 --- a/build/script/hdbxml_custom/database_create/database/cco/system/nv/nv_security_struct_def.txt +++ /dev/null @@ -1,10 +0,0 @@ -#include "base_datatype_def.txt" - - - - - - - - - diff --git a/build/script/hdbxml_custom/database_create/database/database_ver.txt b/build/script/hdbxml_custom/database_create/database/database_ver.txt deleted file mode 100755 index c69a53d..0000000 --- a/build/script/hdbxml_custom/database_create/database/database_ver.txt +++ /dev/null @@ -1 +0,0 @@ -NB1X V100R001C00 \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/database_create.py b/build/script/hdbxml_custom/database_create/database_create.py deleted file mode 100755 index ef4e958..0000000 --- a/build/script/hdbxml_custom/database_create/database_create.py +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -#=============================================================================== -# @brief create database -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. -#=============================================================================== - -import xml.dom.minidom -import sys -import re -import os -import shutil -import xml.etree.ElementTree as ET - -def write_enum_struct(name, enums, file): - file.write('typedef enum {\r\n') - for enum in enums: - file.write(''.join([' ', enum.getAttribute('Name'), '=', enum.getAttribute('Value'), ',\r\n'])) - file.write(''.join(['} ', name, ';\r\n'])) - -def write_nomal_struct(name, fields, file): - file.write('typedef struct {\r\n') - for field in fields: - if field.nodeType != xml.dom.Node.ELEMENT_NODE: - continue - if field.getAttribute('Enum') == '': - if field.getAttribute('Length') == '1': - file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n'])) - else: - file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length') , '];\r\n'])) - else: - if field.getAttribute('Length') == '1': - file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), ';\r\n'])) - else: - file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n'])) - file.write(''.join(['} ', name, ';\r\n'])) - -def write_union(item, file): - file.write('typedef union {\r\n') - fields = item.getElementsByTagName("Field") - for field in fields: - file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n'])) - file.write(''.join(['} ', item.getAttribute('Type'), ';\r\n'])) -def find_union(fields, union_name_to_node): - for field in fields: - if field.getAttribute('FieldType') == 'union': - union_name_to_node[field.getAttribute('Type')] = field -def write_msg_struct(name, fields, file): - file.write('typedef struct {\r\n') - for field in fields: - if field.nodeType != xml.dom.Node.ELEMENT_NODE: - continue - if field.getAttribute('Enum') == '': - if field.getAttribute('Length') == '1': - file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), ';\r\n'])) - else: - file.write(''.join([' ', field.getAttribute('Type'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n'])) - else: - if field.getAttribute('Length') == '1': - file.write(''.join([' ', field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), ';\r\n'])) - else: - file.write(''.join([' ' , field.getAttribute('Enum'), ' ', field.getAttribute('FieldName'), '[', field.getAttribute('Length'), '];\r\n'])) - - file.write(''.join(['} ', name, '_STRU;\r\n'])) - -def int_prim_xml_air_tree(tree): - root = tree.getroot() - layer_root_element = ET.Element('') - for child_1 in root: - if child_1.tag=='SUBSYSTEM': - for child_2 in child_1: - if child_2.tag=='AIR_LOG': - layer_root_element = child_2 - break - break - - if layer_root_element.tag=='AIR_LOG': - temp_attrib=layer_root_element.attrib - temp_text=layer_root_element.text - temp_tail = layer_root_element.tail - #layer_root_element.clear() - layer_root_element.attrib = temp_attrib - layer_root_element.text = temp_text - layer_root_element.tail = temp_tail - return layer_root_element - -def int_prim_xml_layer_tree(tree): - root = tree.getroot() - layer_root_element = ET.Element('') - for child_1 in root: - if child_1.tag=='SUBSYSTEM': - for child_2 in child_1: - if child_2.tag=='LAYER_LOG': - layer_root_element = child_2 - break - break - - if layer_root_element.tag=='LAYER_LOG': - temp_attrib=layer_root_element.attrib - temp_text=layer_root_element.text - temp_tail = layer_root_element.tail - #layer_root_element.clear() - layer_root_element.attrib = temp_attrib - layer_root_element.text = temp_text - layer_root_element.tail = temp_tail - return layer_root_element - -def int_prim_xml_msg_tree(tree): - root = tree.getroot() - layer_root_element = ET.Element('') - for child_1 in root: - if child_1.tag=='SUBSYSTEM': - for child_2 in child_1: - if child_2.tag=='MSG_LOG': - layer_root_element = child_2 - break - break - - if layer_root_element.tag=='MSG_LOG': - temp_attrib=layer_root_element.attrib - temp_text=layer_root_element.text - temp_tail = layer_root_element.tail - #layer_root_element.clear() - layer_root_element.attrib = temp_attrib - layer_root_element.text = temp_text - layer_root_element.tail = temp_tail - return layer_root_element - -def add_element_to_xml(root_element): - global num_to_id - sorted_list=sorted(num_to_id.items(),key=lambda e:e[1]) - - for key,value in sorted_list: - #print('key2=',key, 'value=',value) - new_element=ET.Element('') - new_element.tag='MSG' - new_element.attrib['NAME']=key - new_element.attrib['ID']=value - new_element.attrib['DESCRIPTION']='' - new_element.attrib['STRUCTURE']=''.join([key, '_STRU']) - new_element.tail='\n\t\t\t' - root_element.append(new_element) -def write_prim_xml_tree(tree, dest): - dst_xml_dir = os.path.dirname(dest) - if not os.path.exists(dst_xml_dir): - os.makedirs(dst_xml_dir) -# print(g_params['PRIM_XML_DST_XML_FILE'].strip()) - tree.write(dest,encoding="UTF-8",xml_declaration = '',method="xml") - -try: - msg_xml, mss_prim_db, destination = sys.argv[1:] -except ValueError: - raise SystemExit("Usage: %s msg_xml mss_prim_db destination" % sys.argv[0]) - -msg_struct_def = os.path.join(destination, 'cco', 'system', 'diag', 'msg_struct_def.txt') -extern_datatype_def = os.path.join(destination, 'cco','system', 'diag', 'extern_datatype_def.txt') -mss_prim_db_new = os.path.join(destination, 'cco', 'system', 'hdbcfg', 'mss_prim_db.xml') - -src_database_dir = os.path.join(os.path.dirname(sys.argv[0]), "database") - -shutil.rmtree(destination, ignore_errors=True, onerror=None) -shutil.copytree(src_database_dir, destination) - -dom_tree = xml.dom.minidom.parse(msg_xml) -collection = dom_tree.documentElement -enum_fields = collection.getElementsByTagName("EnumsEntry") -struct_fields = collection.getElementsByTagName("Structure") -msg_fields = collection.getElementsByTagName("Message") -all_fields = collection.getElementsByTagName("Field") - -num_to_id={} -enum_to_size = {} -type_to_size = {} -union_name_to_node = {} -lp_struct_to_size = {} - -for item in msg_fields: - message_id = item.getAttribute('MessageID') - name = item.getAttribute('Name') - num_to_id[name] = message_id - -with open(msg_struct_def,'w') as f: - f.write('#include \"base_datatype_def.txt\"\r\n') - f.write('#include \"extern_datatype_def.txt\"\r\n') - - for item in enum_fields: - name = item.getElementsByTagName("Name")[0].childNodes[0].data - enums = item.getElementsByTagName('Enum') - write_enum_struct(name, enums, f) - - for item in struct_fields: - name = item.getAttribute('Type') - fields = item.getElementsByTagName('Field') - write_nomal_struct(name, item.childNodes, f) - - find_union(all_fields, union_name_to_node) - for key, value in union_name_to_node.items(): - write_union(value, f) - for item in msg_fields: - name = item.getAttribute('Name') - fields = item.getElementsByTagName('Field') - write_msg_struct(name, item.childNodes, f) - f.close() - -with open(extern_datatype_def,'w') as f: - for field in all_fields: - enum = field.getAttribute('Enum') - if enum == '': - continue - size = field.getAttribute('Size') - enum_to_size[enum] = size - for item in enum_to_size.items(): - if item[1] == '1': - line = ''.join([item[0], ' 8 0\r\n']) - elif item[1] == '2': - line = ''.join([item[0], ' 16 0\r\n']) - elif item[1] == '4': - line = ''.join([item[0], ' 32 0\r\n']) - else: - continue - f.write(line) - for field in all_fields: - lp_struct = field.getAttribute('Type') - if 'LP_' not in lp_struct: - continue - size = field.getAttribute('Size') - lp_struct_to_size[lp_struct] = size - for item in lp_struct_to_size.items(): - if item[1] == '1': - line = ''.join([item[0], ' 8 0\r\n']) - elif item[1] == '2': - line = ''.join([item[0], ' 16 0\r\n']) - elif item[1] == '4': - line = ''.join([item[0], ' 32 0\r\n']) - else: - continue - f.write(line) - f.close() - - -tree = ET.parse(mss_prim_db) -add_element_to_xml(int_prim_xml_msg_tree(tree)) -write_prim_xml_tree(tree, mss_prim_db_new) \ No newline at end of file diff --git a/build/script/hdbxml_custom/database_create/mss_prim_db_old.xml b/build/script/hdbxml_custom/database_create/mss_prim_db_old.xml deleted file mode 100755 index 5322737..0000000 --- a/build/script/hdbxml_custom/database_create/mss_prim_db_old.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/build/script/hdbxml_custom/parse/parse_msgdefs.py b/build/script/hdbxml_custom/parse/parse_msgdefs.py deleted file mode 100755 index 5fa5fb8..0000000 --- a/build/script/hdbxml_custom/parse/parse_msgdefs.py +++ /dev/null @@ -1,312 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 - -#=============================================================================== -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. -# Description: Parse C headers and extract message definitions as ctypes objects. -#=============================================================================== -import pycparser -import ctypes - -binary_operators = { - "&": lambda x, y: x & y, - "|": lambda x, y: x | y, - "*": lambda x, y: x * y, - "+": lambda x, y: x + y, - "-": lambda x, y: x - y, - "/": lambda x, y: x // y, - "<<": lambda x, y: x << y, - ">>": lambda x, y: x >> y, - "<=": lambda x, y: int(x <= y), - ">=": lambda x, y: int(x >= y), - "==": lambda x, y: int(x == y), - "&&": lambda x, y: int(bool(x and y)), - "||": lambda x, y: int(bool(x or y)), -} - -unary_operators = { - "-": lambda x: -x, - "!": lambda x: 1 if x else 0, - "sizeof": lambda x: ctypes.sizeof(x), -} - -fundamental_types = { - "": ctypes.c_int, - "_Bool": ctypes.c_bool, - "char unsigned": ctypes.c_ubyte, - "char": ctypes.c_byte, - "double": ctypes.c_double, - # - # 32bit arm and riscv compilers define "long double" type as 8 and 16 byte long respectively. - # ctypes.c_longdouble under 32bit windows, 32bit linux, 64bit windows, 64bit linux OS has length 8, 12, 8, 16 respectively. - # We cannot find a ctype mapping to generalize. - # Especially that 16 byte riscv "long double" type cannot be interpreted by any 32/64bit windows ctype. - # Fortunately we don't have any long doubles in messages and etypes. So disable this mapping for now. - # - # "double long": ctypes.c_longdouble, - "float": ctypes.c_float, - "long long unsigned": ctypes.c_ulonglong, - "long long": ctypes.c_longlong, - # - # 32bit arm and riscv compilers define "long" type as 4 byte long. - # Messages xml generation calls this script with 32bit python while kv generation uses 64bit python. - # We need to map "long" type to ctypes.c_int which is 4 byte across 32/64bit OSs - # instead of ctypes.c_long which is 8 byte on 64bit linux and 4 byte otherwise. - # This also applies to "unsigned long" type. - # - "long unsigned": ctypes.c_uint, - "long": ctypes.c_int, - "short unsigned": ctypes.c_ushort, - "short": ctypes.c_short, - "unsigned": ctypes.c_uint, - "void": None, -} - -# These types will have a typedef but map to alternative ctypes values. -override_typedefs = { - "osal_char": ctypes.c_char, -} - -def get_typename(names): - specifiers = [] - for name in sorted(names): - if name in ["signed", "int"]: - continue - specifiers.append(name) - return " ".join(specifiers) - -def create_enum_type(enumname, enums): - smallest = min(enums.values()) - largest = max(enums.values()) - if smallest < 0: - if -128 <= smallest and largest <= 127: - base = ctypes.c_byte - elif -32768 <= smallest and largest <= 32767: - base = ctypes.c_short - else: - base = ctypes.c_int - else: - if largest < 256: - base = ctypes.c_ubyte - elif largest < 65536: - base = ctypes.c_ushort - else: - base = ctypes.c_uint - return type(enumname, (base,), {"members": enums}) - - -class Visitor(pycparser.c_ast.NodeVisitor): - # Parse all typedefs and expand identifiers. - def __init__(self): - self.enums = {} - self.typedefs = dict(fundamental_types) - - # The context in which the ID names exist. - self.id_context = self.enums - self.anon_struct_count = 1 - self.anon_enum_count = 1 - self.anon_union_count = 1 - - def generic_visit(self, node): - # Dump ast to see what is not implemented. - raise SystemExit("Unhandled ast element at %s: %s" % (node.coord, node)) - - def visit_Decl(self, node): - return - - def visit_FuncDef(self, node): - return - - def visit_FuncDecl(self, node): - return - - def visit_FileAST(self, node): - for c in node: - self.visit(c) - - def visit_ID(self, node): - try: - return self.id_context[node.name] - except KeyError: - raise SystemExit("Failed to resolve identifier '%s' at %s" % (node.name, node.coord)) - - def visit_Typename(self, node): - return self.visit(node.type) - - def visit_TypeDecl(self, node): - return self.visit(node.type) - - def visit_CompoundLiteral(self, node): - return self.visit(node.type) - - def visit_PtrDecl(self, node): - return ctypes.POINTER(self.visit(node.type)) - - def visit_Typedef(self, node): - if node.name in self.typedefs: - raise SystemExit("Duplicate typedef '%s' at %s" % (node.name, node.coord)) - if node.name in override_typedefs: - value = override_typedefs[node.name] - else: - value = self.visit(node.type) - self.typedefs[node.name] = value - - def visit_ArrayRef(self, node): - # For accessing type of an array element - array = self.visit(node.name) - #index = self.visit(node.subscript) - return array._type_ - - def visit_StructRef(self, node): - # This is needed to get access to types inside a struct. - struct = self.visit(node.name) - self.id_context = dict(struct._fields_) - try: - return self.visit(node.field) - finally: - self.id_context = self.enums - - def visit_BinaryOp(self, node): - try: - op = binary_operators[node.op] - except KeyError: - raise SystemExit("Unhandled binary operator '%s' at %s" % (node.op, node.coord)) - leftval = self.visit(node.left) - rightval = self.visit(node.right) - return op(leftval, rightval) - - def visit_UnaryOp(self, node): - value = self.visit(node.expr) - try: - op = unary_operators[node.op] - except KeyError: - raise SystemExit("Unhandled unary operator '%s' at %s" % (node.op, node.coord)) - return op(value) - - def visit_Enum(self, node): - # Mapping of enum names to enum values from all parsed enums. - value = -1 - enums = {} - for enum in node.values: - if enum.value is None: - value += 1 - else: - value = self.visit(enum.value) - self.enums[enum.name] = enums[enum.name] = value - - if node.name is None: - enumname = "enum_anon_%d" % self.anon_enum_count - self.anon_enum_count += 1 - else: - enumname = "enum_%s" % str(node.name) - return create_enum_type(enumname, enums) - - def visit_Constant(self, node): - if node.type not in ["int", "unsigned int"]: - raise SystemExit("Unhandled Constant node type '%s' at %s" % (node.type, node.coord)) - value = node.value.rstrip("LlUu") - if value.startswith(("0x", "0X")): - return int(value, 16) - return int(value) - - def visit_IdentifierType(self, node): - name = get_typename(node.names) - try: - return self.typedefs[name] - except KeyError: - raise SystemExit("Invalid type specifier '%s' at %s" % (name, node.coord)) - - def _handle_fields(self, decls): - fields = [] - # node.decls can be None when the struct declaration is outside the typedef. - if decls is not None: - field_count = 1 - for decl in decls: - value = self.visit(decl.type) - if value is None: - # This is the void type - indicates an invalid message definition type. - return None - if decl.name is None: - fieldname = "unnamed_%d" % field_count - field_count += 1 - else: - fieldname = decl.name - fields.append((fieldname, value)) - return fields - - def visit_Struct(self, node): - fields = self._handle_fields(node.decls) - if fields is None: - return None - - if node.name is None: - structname = "struct_anon_%d" % self.anon_struct_count - self.anon_struct_count += 1 - else: - structname = "struct_%s" % str(node.name) - return type(structname, (ctypes.Structure,), {"_fields_": fields}) - - def visit_Union(self, node): - fields = self._handle_fields(node.decls) - if fields is None: - return None - - if node.name is None: - unionname = "union_anon_%d" % self.anon_union_count - self.anon_union_count += 1 - else: - unionname = "union_%s" % str(node.name) - return type(unionname, (ctypes.Union,), {"_fields_": fields}) - - def visit_ArrayDecl(self, node): - type = self.visit(node.type) - if node.dim is None: - # Flexible array members do not have a size. - # Return a pointer for compatibility with old ctypesgen based implementation. - return ctypes.POINTER(type) - length = self.visit(node.dim) - if length is None or length < 0: - raise SystemExit("Invalid array len %s at %s" % (length, node.dim.coord)) - if type is None: - raise SystemExit("Invalid array type %s at %s" % (type, node.type.coord)) - return type * length - -def message_enum_name(elemName): - if elemName.endswith("_t"): - return elemName[:-2].upper() - if elemName.endswith("_s"): - # NAS messages, already uppercase - return elemName[:-2] - if elemName.endswith("_STRUCT"): - return elemName[:-7] - if elemName.upper().find("LOG_MESSAGE") != -1: - return elemName.upper() +'_ID' - -def parse_preprocessed_headers(source, core): - # Public function that returns the required data for producing messagexml - try: - node = pycparser.parse_file(source) - except pycparser.plyparser.ParseError as e: - raise SystemExit("ERROR parsing msgdefs %s: %s" % (source, e)) - v = Visitor() - if core == 'acore': - v.anon_struct_count = 0x8001 - v.anon_enum_count = 0x8001 - v.anon_union_count = 0x8001 - v.visit(node) - - messages = [] - for structname, fields in sorted(v.typedefs.items()): - messageEnumName = message_enum_name(structname) - if messageEnumName is None: - # Not a valid message definition name. - continue - try: - messageId = v.enums[messageEnumName] - except KeyError: - # No associated message id, so not a message definition. - continue - if fields is None: - raise SystemExit("Message definition contains undefined type: %s" % structname) - messages.append((messageEnumName, structname, messageId, fields)) - return messages diff --git a/build/script/image_analysis/build_data_analyzer_allinone.py b/build/script/image_analysis/build_data_analyzer_allinone.py deleted file mode 100755 index 3e21149..0000000 --- a/build/script/image_analysis/build_data_analyzer_allinone.py +++ /dev/null @@ -1,665 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -import json -import os -import sys -from os.path import join, isdir, abspath, exists, isabs, sep, normpath -import re - -from common_utils import CommonUtils - -work_dir = os.path.split(os.path.realpath(__file__))[0] -root_dir = os.path.join(work_dir, '..', '..', '..') -sys.path.append(os.path.join(root_dir, 'build')) -sys.path.append(os.path.join(root_dir, 'build', 'script')) -sys.path.append(os.path.join(root_dir, 'build', 'config')) -from enviroment import TargetEnvironment -from utils.build_utils import output_root - -map_start_rule = r'Memory Configuration' -map_end_rule = r'Linker script and memory map' -# map文件中Cross Reference Table项不涉及镜像大小,结束map文件解析 -map_file_size_end = r"Cross Reference Table" -elf_setion_rule = r'^\s[0-9]' -elf_symbol_rule = r'^[0-9]+' -file_size_content_rule = r'^(\s*\.[a-zA-Z]+)' - - -class BuildDataAnalyzer: - _elf_path = '' - _map_path = '' - _build_config_path = '' - _module_config = {} - _compiler_path = '' - _prefix = 'arm-none-eabi' - _section_keys = [] - _environment = '' - - section_data = {} - region_data = [] - size_data = {} - elf_size_data = {} - module_data = {} - folder_data = {} - rom_addr = { - 'start': 0, - 'end': 0 - } - rom_parts = {} - is_rom = True - last_symbol = [] - last_line = '' - is_unknown = False - cur_section = '' - cur_section_size = '' - - def __init__(self, paths): - print('++++++++++start buildAnalyzer++++++++++') - data = CommonUtils.get_prefix(paths['compiler_path']) - self._prefix = data['prefix'] - self._environment = data['environment'] - for key, value in paths.items(): - print(f"{key}:{value}") - self._elf_path = paths['elf_path'] - self._map_path = paths['map_path'] - self._compiler_path = paths['compiler_path'] - self._build_config_path = paths['build_config_path'] - self._remove_sections_config_path = paths['remove_sections_config_path'] - self._result_save_path = paths['result_save_path'] - - try: - save_dir = os.path.dirname(self._result_save_path) - if not os.path.isdir(save_dir): - os.makedirs(save_dir) - except Exception as e: - raise Exception(f"Failed to Create Save Directory,{e}") - self._root_dir = os.getcwd() - self._json_path = join(self._root_dir, 'memoryDetails.json') - self._image_remove_section = [] - - def do_build_analysis(self, paths): - try: - with open(self._remove_sections_config_path, 'r') as rv_f: - for line in rv_f.readlines(): - l_s = line.strip() - self._image_remove_section.append(l_s) - - self._module_config = self._get_build_json(paths.get('build_config_path', "")) - json_obj = self._parse_map_file() - self.result_filter(json_obj) - # with open(self._result_save_path, 'w') as result_f: - # json.dump(json_obj, result_f, indent=4) - print('++++++++++end buildAnalyzer++++++++++') - except Exception as e: - raise Exception('buildAnalyzer error') from e - - def result_filter(self, json_cont): - """ - 结果过滤 - """ - new_json = json_cont.get("moduleData", "") - if not new_json: - raise Exception("ImageAnalysis Failed") - with open(self._result_save_path, 'w') as res_f: - res_f.write('

Image Analysis

') - res_f.write('') - line = 0 - for key, value in new_json.items(): - if line == 0: - head_line = '' - for v in value: - if v == 'parent': - continue - head_line = head_line + '' - head_line = head_line + '\n' - res_f.write(head_line) - line = line + 1 - new_line = '' - if value["parent"]: - continue - for v in value: - if value[v] != '': - new_line = new_line + '' - new_line = new_line + '\n' - res_f.write(new_line) - - @staticmethod - def _get_build_json(file_path): - try: - with open(file_path, 'r', encoding='utf-8') as f: - res = f.read() - json_data = json.loads(s=res) - return json_data - except FileExistsError as e: - print('file exists error') - raise FileExistsError() from e - - def _parse_map_file(self): - try: - suffix = self._prefix + '-size.exe' - if self._environment == 'linux': - suffix = self._prefix + '-size' - file_size_path = join(self._compiler_path, suffix) - if not exists(file_size_path): - print(f'size path not find: {file_size_path}') - raise FileExistsError() - size_arr = self.get_file_size(file_size_path, '-A', self._elf_path) - size_arr.pop() - size_arr.pop(0) - self._set_elf_size_data(size_arr) - json_obj = self._read_file() - return json_obj - except SystemError as e: - print('map parse error') - raise SystemError() from e - - def _set_elf_size_data(self, size_arr): - order_section_keys = [".text", ".data", ".bss", ".reboot_retention"] - order_elf_size_data = dict() - for key in order_section_keys: - order_elf_size_data[key] = {'addr': None, 'size': None} - - for item in size_arr: - elf_key, elf_size, elf_addr = re.sub(r'\s+', ' ', item).split(' ')[:3] - if elf_key.startswith('.') and (elf_size != '0' or elf_addr != '0'): - order_elf_size_data[elf_key] = {'addr': int(elf_addr), 'size': int(elf_size)} - if elf_key not in order_section_keys: - order_section_keys.append(elf_key) - self._section_keys = list() - for k, v in order_elf_size_data.items(): - if v.get("size", None) is None: - continue - if k in self._image_remove_section: - continue - self.elf_size_data[k] = v - self._section_keys.append(k) - - def _read_file(self): - try: - self._read_file_to_arr() - json_obj = self._parse_elf_file(self._elf_path) - return json_obj - except Exception as e: - print('elf parse error') - raise Exception() from e - - def _parse_elf_file(self, elf_path): - suffix = self._prefix + '-objdump.exe' - if self._environment == 'linux': - suffix = self._prefix + '-objdump' - obj_dump_path = join(self._compiler_path, suffix) - if not obj_dump_path or not exists(obj_dump_path): - print('Please configure the correct compiler type and compiler path') - raise FileExistsError() - try: - data = CommonUtils.get_obj_dump_info(obj_dump_path, '-h', elf_path) - self._set_section(data) - json_obj = self._get_symbol_data(obj_dump_path, elf_path) - return json_obj - except SystemError as e: - print('elf parse error') - raise SystemError() from e - - def _set_section(self, data): - for key, value in enumerate(data): - line = re.sub(r'\s+', ' ', value) - if re.search(elf_setion_rule, line): - data_arr = line.split(' ') - if len(data_arr) > 2 and data_arr[2] in self._image_remove_section: - continue - next_line = '' - if self._prefix != 'llvm' and key < len(data) - 1: - next_line = data[key + 1] - self._set_section_data(data_arr, next_line) - - def _set_section_data(self, data_arr, next_line): - size = int('0x' + data_arr[3], 16) - vma = int('0x' + data_arr[4], 16) - if vma > 0 or size != 0: - lma = 0 - if next_line: - lma = 0 if next_line.find('LOAD') < 0 else int('0x' + data_arr[5], 16) - elif data_arr[5]: - lma = int('0x' + data_arr[5], 16) - region_name = [] - for region_item in self.region_data: - start_addr = int(region_item['startAddr'], 16) - end_addr = int(region_item['endAddr'], 16) - if (start_addr <= vma < end_addr) or (lma != 0 and start_addr <= lma < end_addr): - region_name.append(region_item['name']) - region_item['used'] += size - section = { - 'regionName': region_name, - 'runAddr': '0x' + data_arr[4], - 'loadAddr': '0x' + data_arr[5] if lma else '', - 'size': self._addr_to_size('0x' + data_arr[3]), - 'sizeOri': '0x' + data_arr[3], - 'children': [] - } - self.section_data[data_arr[2]] = section - - def _get_symbol_data(self, obj_dump_path, elf_path): - try: - data = CommonUtils.get_obj_dump_info(obj_dump_path, '-t', elf_path) - for item in data: - line = re.sub(r'\s+', ' ', item) - if re.search(elf_symbol_rule, line): - self._set_section_symbol_data(line) - except SystemError as e: - print('data parse error') - raise SystemError() from e - - for region in self.region_data: - used = self._addr_to_size(hex(region['used'])) - try: - usage = region['used'] / region['size'] - region['usage'] = '%.2f' % (usage * 100) + '%' - except ZeroDivisionError: - region['usage'] = '0.00%' - region['free'] = self._addr_to_size(hex(region['size'] - region['used'])) - region['used'] = used - region['size'] = self._addr_to_size(hex(region['size'])) - json_obj = { - 'region': self.region_data, - 'details': self.section_data, - 'sizeData': self.size_data, - 'moduleData': self.module_data, - 'folderData': self.folder_data - } - return json_obj - - def _set_section_symbol_data(self, line): - data_arr = line.split(' ') - section_name = data_arr[3] - symbol_name = data_arr[-2] - type_name = data_arr[2] - if len(data_arr[-1]) != 0: - symbol_name = data_arr[-1] - if section_name != symbol_name and section_name in self.section_data: - section = self.section_data[section_name] - vma = int('0x' + data_arr[0], 16) - lma = 0 - if section['loadAddr']: - lma = int(section['loadAddr'], 16) - int(section['runAddr'], 16) + vma - symbol = { - 'name': symbol_name, - 'runAddr': '0x' + data_arr[0], - 'loadAddr': hex(lma) if lma else '', - 'size': self._addr_to_size('0x' + data_arr[4]), - 'sizeOri': '0x' + data_arr[4], - 'location': '', - 'type': type_name - } - self.section_data[section_name]['children'].append(symbol) - - @staticmethod - def _addr_to_size(addr): - size = int(addr, 16) - if size < 1024: - return f'{size} B' - else: - return '%.2f' % (size / 1024) + 'KB' - - @staticmethod - def get_file_size(file_size_path, arg, elf_file_path): - cmd = [file_size_path, arg, elf_file_path] - data = CommonUtils.exec_cmd(cmd) - return data.strip().split('\n') - - def _read_file_to_arr(self): - is_start = False - is_end = False - with open(self._map_path, 'r') as f: - line = f.readline() - while line: - line = line.strip() - if line == map_file_size_end: - break - if re.match(map_start_rule, line): - is_start = True - elif re.match(map_end_rule, line): - is_end = True - elif is_start and not is_end: - self._set_region_data(line) - elif is_end: - self._parse_size_data(line) - line = f.readline() - - def _set_region_data(self, line): - if len(line) > 0 and not line.startswith('Name') and not line.startswith('*default*'): - line_arr = re.sub(r'\s+', ' ', line).split(' ') - end_addr = '0x%08x' % (int(line_arr[1], 16) + int(line_arr[2], 16)) - if len(line_arr) >= 3: - region = { - 'name': line_arr[0], - 'startAddr': line_arr[1], - 'endAddr': end_addr, - 'size': int(line_arr[2], 16), - 'sizeOri': line_arr[2], - 'used': 0, - 'usage': 0 - } - self.region_data.append(region) - name_sp = line_arr[0].split("_") - if 'FLASH' in name_sp or "ROM" in name_sp: - self.rom_parts[line_arr[0]] = {'start': int(region['startAddr'], 16), - 'end': int(region['endAddr'], 16)} - - def _parse_size_data(self, line): - is_need_parse = False - file_size_content_end_rule = re.compile(r'0x[0-9a-fA-F]{8,16}\s+0x[0-9a-fA-F]{1,16}\s+') - file_size_symbol_rule = re.compile(r'^(\s*0x[0-9a-fA-F]{8,16})\s*\w+') - file_rule = re.compile(r'^(\s+\*fill\*)\s+0x[0-9a-fA-F]{8,16}\s+0x[0-9a-fA-F]{1,16}') - is_content_rule = len(line) > 0 and re.search(file_size_content_rule, line) is not None - is_end_rule = line.find('.o') > 0 and re.search(file_size_content_end_rule, line) is not None - if is_content_rule and is_end_rule: - is_need_parse = True - elif is_content_rule: - self.last_line = line - is_need_parse = False - elif len(line) > 0 and is_end_rule: - line = self.last_line + ' ' + line - self.last_line = '' - is_need_parse = True - elif re.search(file_rule, line) is not None: - self.last_line = '' - is_need_parse = True - else: - self.last_line = '' - if is_need_parse: - if self.is_unknown and len(self.last_symbol) > 1 and self.last_symbol[0]['addr'] in self.size_data: - self._reset_symbol_size_data() - self.is_unknown = False - line = line.strip() - line_arr = re.sub(r'\s+', ' ', line).split(' ') - for rv_s in self._image_remove_section: - if line_arr[0].startswith(rv_s): - return - addr = line_arr[1] - self._get_cur_section(addr) - if self.cur_section: - self._calculate_size_data(line_arr, addr) - elif self.is_unknown and re.search(file_size_symbol_rule, line): - line_arr = re.sub(r'\s+', ' ', line).split(' ') - addr = line_arr[0] - name = line_arr[1] - if len(self.last_symbol) == 1 and self.last_symbol[0]['addr'] != addr: - self.is_unknown = False - self.last_symbol = [] - else: - self.last_symbol.append({ - 'addr': addr, - 'name': name - }) - - def _calculate_size_data(self, line_arr, addr): - cur_size = int(line_arr[2], 16) - # .o或者.obj文件路径相对路径,包含括号里,可能没有.a文件一定有.o/.obj文件 - # 如 ../../../../interim_binary/brandy/libs/media/evb_standard/libaudio_player.a(liteplayer.cpp.obj) - nor_path = normpath(line_arr[3]) - a_file_index = nor_path.find('.a(') - if nor_path and a_file_index > 0: - a_file_path = nor_path[0: a_file_index + 2] - a_file_dir = os.path.dirname(a_file_path) - a_file_name = os.path.basename(a_file_path) - o_file_name = nor_path[a_file_index + 3: len(nor_path) - 1] - o_file_dir = a_file_path - # 统计.a文件大小 - param_size = dict(name=a_file_name, - parent='', - path=a_file_dir, - obj_name=o_file_name, - lib_name=a_file_name, - cur_size=cur_size) - self._set_size_data(param_size) - # 统计.o/.obj文件大小 - param_size = dict(name=o_file_name, - parent=a_file_name, - path=o_file_dir, - obj_name=o_file_name, - lib_name=a_file_name, - cur_size=cur_size) - self._set_size_data(param_size) - - else: - o_file_name = os.path.basename(nor_path) - o_file_dir = os.path.dirname(nor_path) - param_size = dict(name=o_file_name, parent='', path=o_file_dir, - obj_name=o_file_name, lib_name='', cur_size=cur_size) - self._set_size_data(param_size) - - # 函数 - child = line_arr[0] + ':' + addr - self._set_addr_data(addr) - if cur_size != 0: - param_size.update({'name': child, 'parent': o_file_name, 'path': ''}) - self._set_size_data(param_size, True) - - def _set_addr_data(self, addr): - if addr in self.size_data: - old_size = self.size_data[addr][self.cur_section_size] - old_lib = self.size_data[addr]['lib'] - old_parent = self.size_data[addr]['parent'] - old_module_name = self.size_data[addr]['moduleName'] - old_component_name = self.size_data[addr]['componentName'] - if old_lib in self.size_data: - self.size_data[old_lib][self.cur_section_size] = self.size_data[ - old_lib][self.cur_section_size] - old_size - - if old_parent in self.size_data: - self.size_data[old_parent][self.cur_section_size] = self.size_data[ - old_parent][self.cur_section_size] - old_size - self._set_old_parent_size(old_parent, old_size) - - if old_module_name in self.module_data: - self.module_data[old_module_name][self.cur_section_size] = self.module_data[ - old_module_name][ - self.cur_section_size] - old_size - - if old_component_name in self.module_data: - self.module_data[old_component_name][self.cur_section_size] = self.module_data[ - old_component_name][ - self.cur_section_size] - old_size - - def _set_old_parent_size(self, cur_parent, cur_size): - if self.size_data[cur_parent]['parent'] == '' and 'path' in self.size_data[cur_parent]: - path_list = self.size_data[cur_parent]['path'].split(sep) - temp_folder = self.folder_data - for path in path_list: - if path in temp_folder and self.cur_section_size in temp_folder[path]: - temp_folder[path][self.cur_section_size] = temp_folder[path][self.cur_section_size] - cur_size - temp_folder = temp_folder[path] - - def _set_size_data(self, param_size, is_symbol=False): - # .a/.o/.obj文件的索引字符串:全路径 - name = param_size.get('name') - # .o/.obj是否有父节点.a文件 - parent = param_size.get('parent') - # .o/.obj文件名称 - obj_name = param_size.get('obj_name') - # .a文件名称 - lib_name = param_size.get('lib_name') - # .o/.obj文件大小 - cur_size = param_size.get('cur_size') - # .a/.o/.obj文件的目录 - file_dir = param_size.get('path') - if name in self.size_data and not is_symbol: - if not self.size_data[name][self.cur_section_size]: - self.size_data[name][self.cur_section_size] = cur_size - else: - self.size_data[name][self.cur_section_size] = self.size_data[name][self.cur_section_size] + cur_size - elif name: - symbol_name = name.split(':')[0] - name = symbol_name - self.size_data[name] = { - 'objName': symbol_name, - 'parent': parent, - 'path': file_dir, - 'romSize': 0, - 'moduleName': self._get_module_name(obj_name), - 'componentName': self._get_component_name(lib_name) - } - if is_symbol: - self.size_data[name]['isSymbol'] = True - self.size_data[name]['lib'] = lib_name - self._set_module_data(self.size_data[name]['moduleName'], self.size_data[name]['componentName'], - cur_size) - self._set_module_data(self.size_data[name]['componentName'], '', cur_size) - if self.size_data[name]['moduleName'] == '' and self.size_data[name]['componentName']: - self.size_data[name]['moduleName'] = self.size_data[name]['componentName'] - for item in self._section_keys: - self.size_data[name][item] = 0 - self.size_data[name][self.cur_section_size] = cur_size - if self.is_rom and name: - self.size_data[name]['romSize'] = self.size_data[name]['romSize'] + cur_size - - if file_dir and not isabs(file_dir): - self._set_folder_data(file_dir, name, cur_size, obj_name) - - def _set_folder_data(self, cur_path, cur_name, cur_size, child_name): - """ - Split paths and assemble them into dict - Example: "build/libs/main.o" assemble to {"build":{"child":[], "size":1, "libs"{"child":[main.o], "size":1}}} - """ - path_list = cur_path.split(sep) - temp_folder = self.folder_data - - for path in path_list: - self._set_child_size(path, temp_folder, cur_size, []) - temp_folder = temp_folder[path] - - if cur_name not in temp_folder['child']: - if cur_name != child_name: - self._set_child_size(cur_name, temp_folder, cur_size, [child_name]) - if cur_name in temp_folder and child_name not in temp_folder[cur_name]['child']: - temp_folder[cur_name]['child'].append(child_name) - else: - temp_folder['child'].append(cur_name) - - def _set_child_size(self, cur, folder, size, child_list): - if cur not in folder: - folder[cur] = {"child": child_list} - for item in self._section_keys: - folder[cur][item] = 0 - folder[cur][self.cur_section_size] = size - else: - if self.cur_section_size in folder[cur]: - folder[cur][self.cur_section_size] = folder[cur][self.cur_section_size] + size - else: - folder[cur][self.cur_section_size] = size - - def _set_module_data(self, name, parent, cur_size): - if name == '': - return - if name in self.module_data: - if not self.module_data[name][self.cur_section_size]: - self.module_data[name][self.cur_section_size] = cur_size - else: - self.module_data[name][self.cur_section_size] = self.module_data[name][self.cur_section_size] + cur_size - elif name: - self.module_data[name] = { - 'objName': name, - 'parent': parent, - 'romSize': 0 - } - for item in self._section_keys: - self.module_data[name][item] = 0 - self.module_data[name][self.cur_section_size] = cur_size - if self.is_rom and name: - self.module_data[name]['romSize'] = self.module_data[name]['romSize'] + cur_size - - def _get_module_name(self, obj_name): - if obj_name in self._module_config and type(self._module_config[obj_name]) == str: - return self._module_config[obj_name] - else: - return obj_name - - def _get_component_name(self, lib_name): - if lib_name in self._module_config and type(self._module_config[lib_name]) == str: - return self._module_config[lib_name] - else: - return lib_name - - def _get_cur_section(self, addr): - self.cur_section = '' - self.cur_section_size = '' - - for section_key in self.elf_size_data: - section_size = self.elf_size_data[section_key]['size'] - section_addr = self.elf_size_data[section_key]['addr'] - if section_addr <= int(addr, 16) < section_addr + section_size: - self.cur_section = section_key - self.cur_section_size = self.cur_section - break - - self.is_rom = False - if self.cur_section in ('.text', '.rodata', '.data', '.l2m_gpu_text', '.plt_ramtext'): - self.is_rom = True - else: - for rom_part, part_size in self.rom_parts.items(): - if part_size['start'] <= int(addr, 16) < part_size['end']: - self.is_rom = True - break - - def _reset_symbol_size_data(self): - length = len(self.last_symbol) - tmp_parent = self.last_symbol[0]['addr'] - all_size = int(self.size_data[tmp_parent][self.cur_section_size]) - - for key, val in enumerate(self.last_symbol): - if key != 0: - tmp = val['addr'] - size = 0 - if key == length - 1: - size = all_size - else: - size = int(self.last_symbol[key + 1]['addr'], 16) - int(self.last_symbol[key]['addr'], 16) - all_size = all_size - size - tmp_size = { - 'objName': self.last_symbol[key]['name'], - 'parent': self.size_data[tmp_parent]['parent'], - 'isSymbol': True, - 'lib': self.size_data[tmp_parent]['lib'], - 'moduleName': self.size_data[tmp_parent]['moduleName'], - 'componentName': self.size_data[tmp_parent]['componentName'] - } - for item in self._section_keys: - tmp_size[item] = 0 - self.size_data[tmp] = tmp_size - self.size_data[tmp][self.cur_section_size] = size - - -if __name__ == '__main__': - env = TargetEnvironment(sys.argv[1]) - chip = env.get('chip') - core = env.get('core') - bin_name = env.get('bin_name') - hso_xlm_chip_name = env.get('hso_xml_chip') - - ELF_PATH = os.path.join(output_root, chip, core, sys.argv[1], bin_name + ".elf") - MAP_PATH = os.path.join(output_root, chip, core, sys.argv[1], bin_name + ".map") - RESULT_SAVE_PATH = os.path.join(output_root, chip, core, sys.argv[1], "image_analysis_result.html") - COMPILER_PATH = sys.argv[2] - # for debug - # COMPILER_PATH = os.path.join(root_dir, "tools", "bin", "compiler", "linx", "linx_170", "linx-llvm-binary-debug", - # "linx-llvm-binary-release-musl", "bin", "riscv32") - - if hso_xlm_chip_name != None: # just for melody - chip = hso_xlm_chip_name - BUILD_CONFIG_PATH = os.path.join(root_dir, 'build', 'config', 'target_config', chip, 'image_analysis_cfg', 'module.json') - REMOVE_SECTIONS_CONFIG_PATH = os.path.join(root_dir, 'build', 'config', 'target_config', chip, 'image_analysis_cfg', "remove_sections.txt") - - PAHT_DICT = {"elf_path": ELF_PATH, - "map_path": MAP_PATH, - "compiler_path": COMPILER_PATH, - "build_config_path": BUILD_CONFIG_PATH, - "remove_sections_config_path": REMOVE_SECTIONS_CONFIG_PATH, - "result_save_path": RESULT_SAVE_PATH, - } - - IMAGE_ANALYSE_RUN = BuildDataAnalyzer(PAHT_DICT) - IMAGE_ANALYSE_RUN.do_build_analysis(PAHT_DICT) - - print('Image Analyse Done ^_^') \ No newline at end of file diff --git a/build/script/image_analysis/common_utils.py b/build/script/image_analysis/common_utils.py deleted file mode 100755 index 4bbac1c..0000000 --- a/build/script/image_analysis/common_utils.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -from os import listdir -from os.path import isdir, exists -import re -import subprocess -import sys - - -ELF_SYMBOL_RULE = r'^[0-9a-zA-Z]{8}' - - -class CommonUtils: - symbol_key_arr = [] - symbol_data = {} - - @staticmethod - def get_prefix(path): - data = { - 'prefix': '', - 'environment': '' - } - if not exists(path) or not isdir(path): - print(f'compiler path not find or not a directory: {path}') - raise FileExistsError() - cp_files = listdir(path) - - objdump_win_sign = '-objdump.exe' - objdump_linux_sign = '-objdump' - has_compiler = False - - for file_name in cp_files: - if file_name.endswith(objdump_win_sign): - data['prefix'] = file_name[0: file_name.rindex(objdump_win_sign)] - data['environment'] = 'windows' - has_compiler = True - break - elif file_name.endswith(objdump_linux_sign): - data['prefix'] = file_name[0: file_name.rindex(objdump_linux_sign)] - data['environment'] = 'linux' - has_compiler = True - break - if not has_compiler: - print(f'Incorrect compiler path: {path}') - raise Exception() - - return data - - @staticmethod - def check_elf_file(file_path): - with open(file_path, 'rb') as f: - elf_ident = f.read(16) - elf_str = '' - for i in elf_ident: - elf_str += hex(i)[2:] - return elf_str.find('7f454c46') >= 0 - - @staticmethod - def get_obj_dump_info(obj_dump_path, arg, elf_file_path, is_return_arr=True, is_convert=True): - result = [] - if not exists(obj_dump_path): - return result - cmd = [obj_dump_path, arg, elf_file_path] - data = CommonUtils.exec_cmd(cmd, is_convert) - if data: - if is_return_arr: - result = data.strip().split('\n') - else: - result.append(data) - return result - - @staticmethod - def exec_cmd(cmd, is_convert=True): - try: - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, _ = p.communicate(timeout=120) - if is_convert: - out = out.decode() - return out - except subprocess.TimeoutExpired as e: - print('cmd timeouot') - raise SystemError() from e - except SystemError as e: - print('cmd error') - raise SystemError() from e - - @staticmethod - def get_symbol_data(obj_dump_path='', elf_file_path=''): - if not obj_dump_path or not exists(obj_dump_path): - raise FileExistsError(f'objdump path not find: {obj_dump_path}') - if not elf_file_path or not exists(elf_file_path): - raise FileExistsError(f'elf path not find: {elf_file_path}') - CommonUtils.symbol_data = {} - CommonUtils.symbol_key_arr = [] - res = CommonUtils.get_obj_dump_info(obj_dump_path, '-t', elf_file_path) - for item in res: - line = re.sub(r'\s+', ' ', item) - if re.search(ELF_SYMBOL_RULE, line): - data_arr = line.split(' ') - section_name = data_arr[3] - symbol_name = data_arr[-1] - type_name = data_arr[2] - if section_name != symbol_name and type_name == 'F': - CommonUtils.symbol_data[data_arr[0]] = symbol_name - for keys in CommonUtils.symbol_data.keys(): - hex_str = '0x' + keys - CommonUtils.symbol_key_arr.append(int(hex_str, 16)) - - if len(CommonUtils.symbol_key_arr) == 0: - return - CommonUtils.symbol_key_arr.sort(reverse=True) - - @staticmethod - def get_function_name(num): - index = 0 - d_value = sys.maxsize - if num.find('0x') < 0: - num = '0x' + num - for i, symbol_key_val in enumerate(CommonUtils.symbol_key_arr): - new_value = int(num, 16) - symbol_key_val - if d_value >= new_value >= 0: - if new_value == d_value and symbol_key_val < CommonUtils.symbol_key_arr[index]: - continue - index = i - d_value = new_value - break - if CommonUtils.symbol_key_arr[index]: - addr = hex(CommonUtils.symbol_key_arr[index]) - return { - 'funcname': CommonUtils.symbol_data['%08x' % int(addr, 16)], - 'funcaddr': '0x%08x' % int(addr, 16) - } - return { - 'funcname': '', - 'funcaddr': '' - } - - @staticmethod - def read_uint16_le(data, offset=0): - return int.from_bytes(data[offset:offset + 2][::-1], byteorder='big') - - @staticmethod - def read_uint32_le(data, offset=0): - return int.from_bytes(data[offset:offset + 4][::-1], byteorder='big') diff --git a/build/script/make_upg_res_pack.py b/build/script/make_upg_res_pack.py deleted file mode 100755 index 1fe927b..0000000 --- a/build/script/make_upg_res_pack.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/python3 -# coding=utf-8 -# ============================================================================ -# @brief Build Update Resource Pkg File -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. -# ============================================================================ - -""" -用法: python pack.py [-i INDEX_FILE] [-d DATA_FILE] [res_dir] - res_dir 待打包目录路径, 仅删除时无需填写此参数 - -i INDEX_FILE, --index-file INDEX_FILE - 生成的索引文件名称 - -d DATA_FILE, --data-file DATA_FILE - 生成的数据文件名称, 仅删除时此参数无效 -""" - -from enum import IntEnum, auto -import sys -import os -import struct -import ctypes -import shutil - -file_dir = os.path.dirname(os.path.realpath(__file__)) -g_root = os.path.realpath(os.path.join(file_dir, "..", "..")) - -DEFAULT_INDEX_FILE = os.path.join(g_root, "output", "res", "res_index.bin") -DEFAULT_DATA_FILE = os.path.join(g_root, "output", "res", "res_data.bin") - -class UpgResourceOperation(IntEnum): - ADD_FILE = 0 - AMEND_FILE = auto() - DELETE_FILE = auto() - REMOVE_DIR = auto() - -class Structure(ctypes.LittleEndianStructure): - def encode(self): - return ctypes.string_at(ctypes.addressof(self), ctypes.sizeof(self)) - - def decode(self, data): - ctypes.memmove(ctypes.addressof(self), data, ctypes.sizeof(self)) - return len(data) - -class UpgResourceNode(Structure): - _fields_ = [ - ("file_path", ctypes.c_char * 128), - ("offset", ctypes.c_uint32), - ("file_len", ctypes.c_uint32), - ("operation_type", ctypes.c_uint32), - ] - -class UpgResourceIndex(Structure): - _fields_ = [ - ("file_num", ctypes.c_uint32), - ("file_node", UpgResourceNode * 0), - ] - -def res_pack(res_dir, index_path=DEFAULT_INDEX_FILE, data_path=DEFAULT_DATA_FILE, deleted_files=[], removed_dirs=[]): - """ - 打包指定资源目录,会先删除文件或目录,再修改/增加文件 - :param res_dir: 待打包目录路径, 如果仅删除则填None - :param index_path: 生成的索引文件路径 - :param data_path: 生成的数据文件路径, 仅删除时此参数无效 - :param deleted_files: 待删除文件列表 - :param removed_dirs: 待删除目录列表 - :returns: 是否成功打包 - """ - - os.makedirs(os.path.dirname(os.path.realpath(index_path)), exist_ok=True) - - with open(index_path, "wb") as index_file: - file_num = 0 - index_file.write(b"\x00" * ctypes.sizeof(UpgResourceIndex)) - - for name in deleted_files: - if not name.startswith("/"): - name = "/" + name - print(f"Delete file '{name}'") - - node = UpgResourceNode() - node.file_path = name.encode() - node.offset = 0 - node.file_len = 0 - node.operation_type = UpgResourceOperation.DELETE_FILE - index_file.write(node.encode()) - - file_num += 1 - - for name in removed_dirs: - if not name.startswith("/"): - name = "/" + name - print(f"Remove dir '{name}'") - - node = UpgResourceNode() - node.file_path = name.encode() - node.offset = 0 - node.file_len = 0 - node.operation_type = UpgResourceOperation.REMOVE_DIR - index_file.write(node.encode()) - - file_num += 1 - - if res_dir is not None: - pack_dir = os.path.realpath(res_dir) - if not os.path.isdir(pack_dir): - print("Error: invaild resource directory!") - return False - print(f"Packing resource directory: {pack_dir}") - - data_file = None - for root, dirs, files in os.walk(pack_dir): - for name in files: - if data_file is None: - os.makedirs(os.path.dirname(os.path.realpath(data_path)), exist_ok=True) - data_file = open(data_path, "wb") - - full_file_path = os.path.join(root, name) - file_path = full_file_path[len(pack_dir):].replace("\\", "/") - if len(file_path.encode()) > UpgResourceNode.file_path.size - 1: - print(f"The length of '{file_path}' is greater than {UpgResourceNode.file_path.size - 1}, skip!") - continue - print(f"Add '{full_file_path}' -> '{data_path}:{file_path}'") - - node = UpgResourceNode() - node.file_path = file_path.encode() - node.offset = data_file.tell() - node.file_len = os.path.getsize(full_file_path) - node.operation_type = UpgResourceOperation.AMEND_FILE - index_file.write(node.encode()) - with open(full_file_path, "rb") as res_file: - shutil.copyfileobj(res_file, data_file) - - file_num += 1 - - if data_file is not None: - data_file.close() - print(f"Added {file_num} files data into {data_path}") - - index_file.seek(0) - index_file.write(struct.pack("= 0): - try: - print("remove dir_path:%s" % dir_path) - retval.remove(dir_path) - except ValueError as e: - print(e) - - return retval - -def fn_search_all_files(top_dir, file_name, excludes=[]): - """ - Traverse sub-folders to find all files named "file_name". - """ - retval = [] - for dir_path, dir_names, file_names in os.walk(top_dir, followlinks=True): - # remove useless folder first - dir_names = [dir_names.remove(x) for x in dir_names if x.startswith(".")] - if file_name in file_names: - retval.append(os.path.join(dir_path, file_name)) - return fn_filter_dirs(retval, excludes) - -def fn_search_all_dirs(top_dir, dir_name, excludes=[]): - """ - Traverse sub-folders to find all files named "dir_name". - """ - retval = [] - for dir_path, dir_names, file_names in os.walk(top_dir, followlinks=True): - if not dir_names: - continue - # remove useless folder first - temp_dirs = list(dir_names) - dirnames = [x for x in dir_names if not x.startswith(".")] - for dirname in dirnames: - if dirname and dirname == dir_name: - retval.append(os.path.join(dir_path, dirname)) - return fn_filter_dirs(retval, excludes) - -def fn_get_subdirs(dir_path): - lst = [name for name in os.listdir(dir_path) if os.path.isdir(os.path.join(dir_path, name)) and name[0] != '.'] - lst.sort() - return lst - -def fn_str_to_int(text, num=None): - if num is not None: - return int(text, num) - match1 = re.match(r'\s*0x',text) - match2 = re.match(r'\s*0X',text) - if match1 or match2: - return int(text, 16) - else: - return int(text, 10) - -""" -Convert build error from scons to string. -""" -def bf_to_str(bf): - if bf is None: - return '(unknown targets product None in list)' - elif bf.node: - return str(bf.node) + ': ' + bf.errstr - elif bf.filename: - return bf.filename + ': ' + bf.errstr - else: - return str(bf) - -""" -call shell -""" -def exec_shell(cmd, logfile=None): - cmdlist = cmd - logfp = None - if isinstance(cmd, str): - cmdlist = cmd.split(' ') - - logger = logging.getLogger() - logger.setLevel(logging.INFO) - if not logger.handlers: - logger.addHandler(logging.StreamHandler(sys.stdout)) - - if logfile: - if os.path.isfile(logfile): - os.unlink(logfile) - if len(logger.handlers) < 2: # 1. console; 2. file - logfp = logging.FileHandler(logfile, encoding='utf-8') - logger.addHandler(logfp) - try: - logging.info(str(cmdlist)) - logging.info('\n') - subp = subprocess.Popen(cmdlist, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - while True: - try: - output = subp.stdout.readline() - output = output.decode(encoding='UTF-8', errors='replace') - if output == '' and subp.poll() is not None: - break - if output: - logging.info(output.strip()) - except UnicodeDecodeError as err: - pass - return subp.returncode - except FileNotFoundError as err: - logging.error(err) - raise Exception(err) - except Exception as err: - logging.error(err) - raise Exception(err) - finally: - if logfile and logfp: - logfp.close() - -def add_temp_sys_path(path): - env_path = os.environ.get('PATH') - if path.startswith(os.sep): - work_path = path - else: - work_path = os.path.join(os.getcwd(), path) - - if work_path not in env_path: - new_env_path = ':'.join([work_path, env_path]) - os.environ['PATH'] = new_env_path - return os.environ.get('PATH') - -def rm_all(items): - for item in items: - if os.path.isdir(item): - shutil.rmtree(item) - elif os.path.isfile(item): - os.unlink(item) - else: - pass - -def rm_pyc(root): - pyc_dirs = fn_search_all_dirs(root, "__pycache__") - rm_all(pyc_dirs) - -def get_diff(list0, list1): - diff = list(set(list0) - set(list1)) - return diff - diff --git a/build/script/nv/conf_parser.py b/build/script/nv/conf_parser.py deleted file mode 100755 index b304065..0000000 --- a/build/script/nv/conf_parser.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -""" -* Description: Settings parsers. -* Create: 2020-1-2 -""" - -import os -import json - -from build_utils import color_red -from build_utils import color_end - -__all__ = ["MconfParser", "BuildConfParser"] - -def nv_repeat_check(pairs): - key_list = [] - for key_temp in pairs: - if key_temp[0] not in key_list: - key_list.append(key_temp[0]) - else: - raise Exception("nv items(%s) repeat"%key_temp[0]) - pairs = dict(pairs) - return pairs - -class ParserError(Exception): - """ - Parse errors, highlight in red. - """ - def __init__(self, err): - emsg = "%s%s%s"%(color_red(), err, color_end()) - Exception.__init__(self, emsg) - pass - -""" -Json format config file parser -""" -class BuildConfParser: - def __init__(self, conf_path): - if not os.path.isfile(conf_path): - raise ParserError("Configration file %s NOT found!"%conf_path) - - with open(conf_path, 'r', encoding='utf-8') as conf: - try: - myread = conf.read() - self.conf_data = json.loads(myread) - self.nvconf_data = json.loads(myread, object_pairs_hook = nv_repeat_check) - except Exception as err: - msg = "%s\nParsing file:%s"%(err, conf_path) - raise ParserError(msg) - - self.conf_data = self._parse(self.conf_data) - self.nvconf_data = self._parse(self.nvconf_data) - - def get_conf_data(self): - return self.conf_data - - def get_nvconf_data(self): - return self.nvconf_data - - def get(self, option): - return self.conf_data.get(option) - - def _parse(self, data): - """ - parse the python sentence starts with ### - """ - for key, value in data.items(): - if isinstance(value, dict): - # Recursion - value = self._parse(value) - if isinstance(value, list): - # Recursion - data[key] = self._parse_list(value) - if isinstance(value, int): - data[key] = value - if isinstance(value, str) and value.startswith('###'): - value = self._exec(value) - data[key] = value - return data - - def _parse_list(self, values): - new_list = [] - for val in values: - if type(val) is str and val.startswith('###'): - value = self._exec(val) - new_list.append(value) - elif isinstance(val, dict): - new_list.append(self._parse(val)) - else: - new_list.append(val) - return new_list - - def _exec(self, code): - """ - Execute the simple python sentence. - For the security reason, only allows 'os.path.join' to be input, as a path string - to support multiple platforms. - If it needs to support more python features, please use compile and eval, but careful about - the security issues. - """ - start = code.find("os.path.join") - if start < 0: - raise ParserError("The input doesn't support!") - lpt = code.find("(") - if lpt < 0 or lpt < start: - raise ParserError("The input doesn't support!") - rpt = code.find(")") - if rpt < 0 or rpt < lpt: - raise ParserError("The input doesn't support!") - path_parts = code[lpt + 1:rpt].split(",") - ret = "" - for part in path_parts: - ret = os.path.join(ret, part.lstrip(" '\"").rstrip(" '\"")) - return ret - -""" -Menuconfig format config file parser -""" -class MconfParser: - def __init__(self, conf_path): - if not os.path.isfile(conf_path): - raise ParserError("Configration file %s NOT found!"%conf_path) - - with open(conf_path, 'r', encoding='utf-8') as conf: - self.conf_data = conf.readlines() - - self.conf_data = self._parse(self.conf_data) - - def get(self, option): - data = self.conf_data.get(option) - if data is None: - # Option not found be treated as false. - return 'n' - # strip " when met string values. - return data.replace('"', '') - - def _parse(self, data): - settings = {} - for option in data: - if self._option_is_valid(option) is True: - key, value = self._parse_option(option) - settings[key] = value.strip().replace('\n', '').replace('\r', '') - return settings - - def _option_is_valid(self, option): - option = option.strip() - if (option is None) or (option == '') or (option.startswith('#') is True): - # skip blanks and comments. - return False - return True - - def _parse_option(self, option): - cfg = option.split('=') - if len(cfg) == 2: - # like "KEY=value", length always be 2. return in KEY, value - return cfg[0], cfg[1] - else: - raise ParserError("Unknow format of the option:%s"%option) - -def test(): - """ - Test only. - """ - parser = BuildConfParser("build/config/riscv32_toolchain.json") - print(parser.get('TargetFolder')) - mparser = MconfParser("build/config/settings.json") - print(mparser.get('CONFIG_TARGET_SOFT_VER')) - -if __name__ == "__main__": - test() - diff --git a/build/script/nv/generate_data_stream.py b/build/script/nv/generate_data_stream.py deleted file mode 100755 index 3853ac2..0000000 --- a/build/script/nv/generate_data_stream.py +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -""" -* Description: NV binary create. -* Create: 2020-3-10 -""" -from ctypes import * -import os -import re -import ctypes -import sys -import pycparser - -from parse_msgdefs import Visitor -from conf_parser import ParserError - -nextIsBitfield = 0 -bitField = 0 -bitLength = 0 -lastByteLength = 0 -totalByteLen = 0 -baseByteSize = 0 -# type define -class generate_data_stream: - def __init__(self): - self.v = Visitor() - - def phase_etypes(self, file): - code = pycparser.parse_file(file) - tmp = Visitor() - tmp.visit(code) - self.v.typedefs.update(tmp.typedefs) - - def is_dec(self, s): - try: - int(s) - return True - except ValueError: - pass - return False - - def is_hex(self, s): - try: - int(s, 16) - return True - except ValueError: - pass - return False - - def byte_len(self, value): - if value < 256: - return 1 - elif value < 65536: - return 2 - elif value < 4294967296: - return 4 - else: - return 8 - -# value 的几种case需要分别考虑 -#1.直接数字 -#2.直接字符串 -#3.枚举 -#4.简单数组 -#5.结构体 -#6.结构体数组 -#7.指针 -#8.指针数组 - def get_value(self, value_str): - if self.is_dec(value_str): - value = int(value_str) - return value - elif self.is_hex(value_str): - value = int(value_str, 16) - return value - return None - - def get_char_value(self, value_str): - if type(value_str) is int: - return value_str - if len(value_str) == 1: - return ord(value_str) - return None - - def get_value_for_array(self, value_str): - if '[' not in value_str or ']' not in value_str: - return None - value_line_list = list(filter(None, re.split(r'[;,\s\"\[\]]\s*', value_str))) - return value_line_list - - def get_value_for_char_array(self, value_str): - if '\"' not in value_str: - return None - value_str = value_str.replace('\"','') - value_line_list = [x for x in value_str] - return value_line_list - - def get_value_str(self, value): - value_line_list = list(filter(None, value.split('\n'))) - value_list = [] - for i in range(len(value_line_list)): - tmp_list = list(filter(None, value_line_list[i].split(' = '))) - value_list.append(tmp_list[1]) - return value_list - - def get_enum_value(self, enum_fields, enum_str): - if 1: - enum_value = enum_fields.members.get(enum_str) - if enum_value is None: - msg = "[error] [%s] not a enum value, please check!!" % enum_str - raise ParserError(msg) - return enum_value - - for field in enum_fields.members: - if enum_str == field: - return enum_fields.members[field] - - def get_bitfield_value(self, fields, typename, value): - global nextIsBitfield - global bitField - global bitLength - global lastByteLength - global totalByteLen - global baseByteSize - - bufferData = b'' - bitsize = self.get_value(fields.bitsize) - bitLength += bitsize - - if value.bit_length() > bitsize: - msg = "[error] [%s]'s value exceeds its bit width!!" % typename - raise ParserError(msg) - if bitLength == bitsize: - baseByteSize = sizeof(fields) - totalByteLen = 0 - writeLen = 0 - # 前后类型相同,不压缩处理 - if bitLength > bitsize and sizeof(fields) == lastByteLength: - if bitLength > baseByteSize * 8: - writelen = max(self.byte_len(bitField), lastByteLength) - bufferData += bitField.to_bytes(writelen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(writelen, byteorder="little", signed=False) - totalByteLen += writelen - bitField = 0 - bitLength = bitsize # 记录未写入的bit - # 前后类型不同,考虑压缩场景 - elif bitLength > bitsize and sizeof(fields) != lastByteLength: - baseByteSize = sizeof(fields) if sizeof(fields) > lastByteLength else lastByteLength - if bitLength > baseByteSize * 8: # 不压缩处理 - writelen = max(self.byte_len(bitField), lastByteLength) - bufferData += bitField.to_bytes(writelen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(writelen, byteorder="little", signed=False) - totalByteLen += writelen - # 对齐处理 - if totalByteLen % sizeof(fields) != 0: - bitField = 0 - alignByteLen = sizeof(fields) - totalByteLen if sizeof(fields) > totalByteLen \ - else totalByteLen - sizeof(fields) - bufferData += bitField.to_bytes(alignByteLen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(alignByteLen, byteorder="little", signed=False) - totalByteLen += alignByteLen - bitField = 0 - bitLength = bitsize - if totalByteLen % baseByteSize != 0: # 非对齐场景,不压缩 - writelen = max(self.byte_len(bitField), lastByteLength) - bufferData += bitField.to_bytes(writelen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(writelen, byteorder="little", signed=False) - totalByteLen += writelen - bitField = 0 - bitLength = bitsize - lastByteLength = sizeof(fields) - if bitLength > bitsize: - bitField = (bitField | (value << (bitLength - bitsize))) - else: - bitField = value - - # print("bitsize: ",bitsize) - # print("value: ",value) - # print("lastByteLength: ",lastByteLength) - # print("bitLength: ",bitLength) - # print("totalByteLen :", totalByteLen) - # print("bitField: ",bitField) - if bitLength == (sizeof(fields) * 8): - writelen = max(self.byte_len(bitField), sizeof(fields)) - bufferData += bitField.to_bytes(writelen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(writelen, byteorder="little", signed=False) - totalByteLen += writelen - bitField = 0 - bitLength = 0 - return bufferData - if nextIsBitfield == 0: - # 后面非位域,数据输出。如果后面嵌套结构体,结构体起始仍为位域,仍需要考虑压缩 - writelen = max(self.byte_len(bitField), sizeof(fields)) - bufferData += bitField.to_bytes(writelen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(writelen, byteorder="little", signed=False) - totalByteLen += writelen - bitField = 0 - bitLength = 0 - if totalByteLen % baseByteSize != 0: - bitField = 0 - alignByteLen = baseByteSize - (totalByteLen % baseByteSize) - bufferData += bitField.to_bytes(alignByteLen, byteorder="little", signed=True) if bitField < 0 \ - else bitField.to_bytes(alignByteLen, byteorder="little", signed=False) - # print("bufferData: ", bufferData) - return bufferData - - def print_type(self, typename, value, isBaseType, isEnum, isSomeKindOfArray, isUnion, isPointer): - print("%s, value: %s, isBaseType :" % (typename, value), isBaseType) if isBaseType else None - print("%s, value: %s, isEnum :" % (typename, value), isEnum) if isEnum else None - print("%s, value: %s, isSomeKindOfArray :" % (typename, value), isSomeKindOfArray) if isSomeKindOfArray else None - print("%s, value: %s, isUnion :" % (typename, value), isUnion) if isUnion else None - print("%s, value: %s, isPointer :" % (typename, value), isPointer) if isPointer else None - - - def recursion_parse(self, fields, type_name, value): - global nextIsBitfield - # print('recurse field: ', fields) - # print('recurse type_name: ', type_name) - # print('recurse value: ', value) - isBitfield = hasattr(fields, "bitsize") - isBaseType = not hasattr(fields, "_fields_") - isEnum = hasattr(fields, "members") - isSomeKindOfArray = issubclass(fields, ctypes.Array) - isUnion = isinstance(fields, ctypes.Union) - isPointer = hasattr(fields, "contents") - #self.print_type(type_name, value, isBaseType, isEnum, isSomeKindOfArray, isUnion, isPointer) - - if ((isBaseType and not isSomeKindOfArray) or isEnum or isPointer) and \ - (type(value) is list or type(value) is dict): - msg = "[error] [%s] is not a array or a structrue, the value cannot be a list or a dict!!" % type_name - raise ParserError(msg) - - if not ((isBaseType and not isSomeKindOfArray) or isEnum or isPointer) and \ - not (type(value) is list or type(value) is dict): - msg = "[error] [%s] is a array or a structrue, the value must be a list or a dict!!" % type_name - raise ParserError(msg) - - if isUnion and not isSomeKindOfArray and type(value) is list: - msg = "[error] [%s] is a union, the value must be a hex or int or a dict!!" % type_name - raise ParserError(msg) - - buffer = b'' - if isEnum: - buffer += self.get_enum_value(fields, value).to_bytes(sizeof(fields), byteorder="little") - # print("buffer: ", buffer) - return buffer - - if isBaseType and not isSomeKindOfArray: - # print("base size: ", sizeof(fields)) - # print("fileds: ", fields) - # print("type: ", type(fields)) - if sizeof(fields) == 1 and \ - isinstance(value, str) and \ - not value.startswith('0x') and not value.startswith('0X'): - value = self.get_char_value(value) - else: - value = self.get_value(value) - - if isBitfield: - buffer += self.get_bitfield_value(fields, type_name, value) - else: - buffer += value.to_bytes(sizeof(fields), byteorder="little", signed=True) if value < 0 \ - else value.to_bytes(sizeof(fields), byteorder="little", signed=False) - # print("buffer: ", buffer) - return buffer - - if isUnion and not isSomeKindOfArray: - # print("union size: ", sizeof(fields)) - # union要么指定成员赋值,要么直接整体赋值,不能是list,list无法知道对具体哪个成员赋值 - if type(value) is not dict: - buffer += self.get_value(value).to_bytes(sizeof(fields), byteorder="little") - else: - # 增加枚举结构的解析 - pass - # print("buffer: ", buffer) - return buffer - - if isSomeKindOfArray: - if type(value) is not list: - msg = "[error] [%s] is a array, the value must be a list!!" % type_name - raise ParserError(msg) - - # print("array type: ", fields._type_) - # print("array length: ", fields._length_) - idx = 0 - for val in value: - buffer += self.recursion_parse(fields._type_, '%s[%d]' % (type_name, idx), val) - idx += 1 - # print("sizeof array [%s]: " % type_name, sizeof(fields)) - if len(buffer) > sizeof(fields): - msg = "[error] the value is oversized the array: [%s]!!" % type_name - raise ParserError(msg) - buffer += bytearray(sizeof(fields) - len(buffer)) - # print("buffer: ", buffer) - return buffer - - all_types = fields._fields_ - # print('all_types in struct [%s] : ' % type_name, all_types) - if type(value) is list: - typesLen = len(all_types) - typesIdx = 0 - for (item, item_class) in all_types: - if len(value) == 0: - buffer += bytearray(sizeof(item_class)) - continue - if typesIdx + 1 < typesLen: - nextField = all_types[typesIdx + 1][1] - nextIsBitfield = hasattr(nextField, "bitsize") - else: - nextIsBitfield = 0 - buffer += self.recursion_parse(item_class, item, value[0]) - del(value[0]) - typesIdx += 1 - if len(value) != 0: - msg = "[error] the value is not match the type: [%s]!!" % type_name - raise ParserError(msg) - return buffer - - if type(value) is dict: - typesLen = len(all_types) - typesIdx = 0 - for (item, item_class) in all_types: - item_value = value.get(item) - if item_value is None: - buffer += bytearray(sizeof(item_class)) - continue - if typesIdx + 1 < typesLen: - nextField = all_types[typesIdx + 1][1] - nextIsBitfield = hasattr(nextField, "bitsize") - else: - nextIsBitfield = 0 - buffer += self.recursion_parse(item_class, item, item_value) - typesIdx += 1 - return buffer - - def generate(self, struct_name, value): - fields = self.v.typedefs.get(struct_name) - # print("struct: %s, value: " %struct_name, value) - # print('types: ', self.v.typedefs) - if fields is None: - msg = "[error] not found the type [%s]!" % struct_name - raise ParserError(msg) - buffer = self.recursion_parse(fields, struct_name, value) - return buffer, len(buffer) - - -#DEBUG - -if __name__=="__main__": - class g_env: - flash_size = 0x3000 - protocolKvIndex = 0 - appKvIndex = 0x1000 - secureKvindex = 0x2000 - KV_STORE_DIR = {'security' : 0 ,'protocol' : 1 ,'application' : 2 ,'asset' : 3 } - KV_STATUS_DIR = {'alive':0xffff,'reserved':0,'deprecated':1} - KV_PAGE_ID = {'security' : 0xcb7e ,'protocol' : 0xda81 ,'application' : 0x254d ,'backup' : 0x34b2} - - g_kv_pairs = { - 'yml_test_eg' : { - 'value' : { - 'num_supported_bands' : 1, - 'band_ids' :[8, 7, 6] - }, - 'permanence': False - }, - 'yml_test_eg2_mixed' : { - 'value' : { - 'param1' : 1, - 'param2' : [[1,2,], [3,4], [5]] - }, - 'permanence': False - }, - 'yml_test_eg2' : { - 'value' : [1, [[1,2,], [3,4]]], - 'permanence': False - }, - - 'test_nv_type_nest_deep' :{ - 'value' : [1, "C", 0, - [[1, 0, 0x2222, [["TEST_NV_ENUM_1"], ["TEST_NV_ENUM_2"]]], - [3, 0, 0x4444, [["TEST_NV_ENUM_3"], ["TEST_NV_ENUM_4"]]]] - ], - 'permanence': False - }, - - 'test_nv_type_nest_deep____pure_value' :{ - 'value' : [1, 0, "C", - [[1, 0x2222, 0, [[0x1111], [0x2222]]]], - [3, 0x4444, 0, [[0x33334444], [0x5555]]] - ], - 'permanence': False - }, - 'test_nv_type_nest_deep___dict' :{ - 'value' : [1, [[1,2,], [3,4]]], - 'permanence': False - }, - 'test_nv_type_nest_deep___mixed' :{ - 'value' : [1, [[1,2,], [3,4]]], - 'permanence': False - } - } - - struct_name = sys.argv[1] - etypes = sys.argv[2] - test = generate_data_stream() - test.phase_etypes(etypes) - nv_file_Bin = bytearray(g_env.flash_size) - for i in range(0, g_env.flash_size): - nv_file_Bin[i] = 0xFF - # SetKvPageHead(nv_file_Bin) - - for keyValueItem in g_kv_pairs: - if keyValueItem != struct_name: - continue - value,value_len = test.generate(struct_name, g_kv_pairs[struct_name]['value']) - print("value: ", value) - print("value_len: ", value_len) - with open('nv.bin', 'wb') as f: - f.write(value) - break diff --git a/build/script/nv/generate_utils.py b/build/script/nv/generate_utils.py deleted file mode 100755 index 311620b..0000000 --- a/build/script/nv/generate_utils.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2023. All rights reserved. - -""" -* Description: Utilities of compile system. -* Change: 2023-3-17 -""" -import os -import sys -import glob - -def generate_nv_source(input, output): - if input == 'noneed': - headers = glob.glob(os.path.join("*.h")) - else: - headers = glob.glob(os.path.join(input, "*.h")) - # dummy C file that includes all the required headers to get structure defs. - lines = [] - for header in headers: - lines.append('#include <%s>' % os.path.basename(header)) - - with open(output, "w") as f: - f.write("\n".join(lines)) # for compatible representation to old implementation. - -def generate_nv_dir(nv_c_path): - if not os.path.exists(nv_c_path): - os.makedirs(nv_c_path) - -if __name__ == "__main__": - if sys.argv[1] == 'NV': - generate_nv_source(sys.argv[2], sys.argv[3]) - if sys.argv[1] == 'MKPATH': - generate_nv_dir(sys.argv[2]) \ No newline at end of file diff --git a/build/script/nv/nv_binary.py b/build/script/nv/nv_binary.py deleted file mode 100755 index 1392ec7..0000000 --- a/build/script/nv/nv_binary.py +++ /dev/null @@ -1,667 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -""" -* Description: NV binary create. -* Create: 2021-11-30 -""" - -import os -import re -import sys -import stat -import json -import hashlib -import struct -import shutil -import zlib -import binascii - -g_root = os.path.realpath(__file__) -g_root = os.path.dirname(g_root) -g_root = os.path.realpath(os.path.join(g_root, "..", "..", "..")) -sys.path.append(os.path.join(g_root, 'build')) -sys.path.append(os.path.join(g_root, 'build', 'script')) -# print(g_root) - -from conf_parser import BuildConfParser, ParserError -from build_utils import fn_str_to_int -from generate_data_stream import generate_data_stream - -from ctypes import c_char, c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, Structure, sizeof - -TD_CHAR = c_char -TD_S8 = c_byte -TD_U8 = c_ubyte -TD_S16 = c_short -TD_U16 = c_ushort -TD_S32 = c_int -TD_U32 = c_uint -g_u8_max = 0xFF -g_u16_max = 0xFFFF -class KeyHead(Structure): - _fields_ = [ - ("magic", TD_U8), # Magic number to indicate the start of the item - ("valid", TD_U8), # flag to indicate whether the value is valid - ("length", TD_U16), # Length of the key_data field in bytes - ("type", TD_U8), # Normal (0xFF) or permanent (0x00) or keep (0x04 ) - ("upgrade", TD_U8), - - ("key_id", TD_U16), # The Key ID - ("enc_key", TD_U16), # Allows some customisation of the data AES key used, 0x0 - key_data is plaintext, Others - key_data is encrypted - ("version", TD_U16), # Version of the key - ("rnd", TD_U32) # Key header crc calculated from length - ] - -class NvPageHead(Structure): - _fields_ = [ - ("id", TD_U16), - ("reserved", TD_U8), - ("num_pages", TD_U8), - ("inverted_details_word", TD_U32), - ("last_write", TD_U32), # last_write - ("unused", TD_U32), # We want this header to be 4 words long - this allows us to alias anything after it - ] - -# 1.根据指定的alias,合并所有配置文件 -# 1.1 解析alias中所有type=Nv的配置。 - -# 2.如果需要,从合并的配置文件中提取NV项ID,生成ID枚举头文件提供给源码使用(构建过程不允许修改源码,因此该头文件只有需要的时候调用脚本生成) -# 3.预编译所有nv结构 -# 4.解析配置文件中各个nv项的数据内容,与结构结合,生成bin - - - -class BuildNv: - def __init__(self, alias, root=None, targets=None, backup=False, use_crc16=False): - self.alias = alias - self.root = root if root is not None else g_root - self.targets = targets - self.is_backup = backup - self.use_crc16 = use_crc16 - self.tmp_path = os.path.join(self.root, json_conf["BUILD_TEMP_PATH"]) - self.nv_relative_path = os.path.join(self.root, json_conf["NV_RELATIVE_PATH"]) - self.nv_root = os.path.join(self.root, json_conf["NV_DEFAULT_CFG_DIR"]) - self.nv_output_dir = os.path.join(self.root, json_conf["OUT_BIN_DIR"]) - if not backup: - self.nv_output_name = json_conf["OUT_BIN_NAME"] - else: - self.nv_output_name = json_conf["OUT_BACKUP_BIN_NAME"] - self.nv_ver_src_dict = dict() - self.nv_ver_dict = dict() - self.nv_flash_cfg = None - self.nv_cores_ver_bin = dict() - self.nv_chip_ver_bin = dict() - self.nv_flash_page_index = dict() - - def set_nv_output_dir(self, path): - self.nv_output_dir = path - - def start_work(self): - self._merge_cfgs() - self._load_nv_flash_cfg() - self._parse_etypes() - self._gen_binary() - self._create_header() - - - def _merge_cfgs(self): - ''' - Merge config sources in self.nv_ver_src_dict. - This will build the self.nv_ver_dict like the following tree: - |--- ver1 : { - | "merged_cfg" : json file after merge all nv configuration with the same product type. - | "prod_type" : "XXXX" } - | - chip|---target1---|--- ver2 : - | | - | |--- ver3 : - | | - | |--- core : "Each target corresponds to one core." - |---targetN... - ''' - for target in self.alias: - if self._nv_ver_prepare(target) is False: - continue - # print('nv_ver_src_dict: ', self.nv_ver_src_dict) - - for chip in self.nv_ver_src_dict: - src_chip_dict = self.nv_ver_src_dict[chip] - # print("src_chip_dict =",src_chip_dict) - self.nv_ver_dict[chip] = {} - chip_dict = self.nv_ver_dict[chip] - for target in src_chip_dict: - if chip_dict.get(target) is None: - chip_dict[target] = {'core':src_chip_dict[target]['core']} - nv_tmp_dir = os.path.join(self.nv_relative_path) - for ver_name in src_chip_dict[target]: - if ver_name == 'core': - continue - cfg_file_prefix = os.path.join(nv_tmp_dir, 'cfg', '%s_nv' % (target)) # 生成中间文件路径 - # print("cfg_file_prefix = ", cfg_file_prefix) - chip_dict[target][ver_name] = self._merge_ver_cfg(cfg_file_prefix, src_chip_dict[target][ver_name]) - - def _parse_etypes(self): - for chip in self.nv_ver_dict: - chip_dict = self.nv_ver_dict[chip] - for target in chip_dict: - # TODO: scons in chip dir or nv_config dir? etypes path depends on scons path - nv_tmp_dir = os.path.join(self.tmp_path, target) - etypes_path = os.path.join(nv_tmp_dir, "%s.etypes" % target) # 中间文件xxx.etypes路径 - if os.path.exists(etypes_path) is not True: # 判断中间文件是否存在,如果不在说明该模块没有被编译,需要加入到编译链接中 - etypes_path = os.path.join(self.tmp_path, "etypes", "%s.etypes" % target) - if os.path.exists(etypes_path) is not True: - msg = "[error] [%s] need add nv_config module in alias! %s" % (target, etypes_path) - raise ParserError(msg) - stream_gen = generate_data_stream() - stream_gen.phase_etypes(etypes_path) - chip_dict[target]["stream_gen"] = stream_gen - dtabase_txt = os.path.join(self.root, json_conf['DATABASE_TXT_FILE']) - shutil.copy(etypes_path, dtabase_txt) - - - def _gen_binary(self): - ''' - |--- ver1 : binary file of ver1. - | (version name : product_type + version name) - chip|---core1---|--- ver2 : - | | - | |--- ver3 : - |---coreN... - ''' - self._gen_binary_prepare() - self._gen_target_version_binary() - self._gen_chip_nv_binary() - - def _gen_target_version_binary(self): - for chip in self.nv_cores_ver_bin: - cores = self.nv_cores_ver_bin[chip] - # print("cores =", cores) - for core in cores: - cores[core] = self._gen_version_binary(self.nv_ver_dict[chip], chip, core) - - def _gen_version_binary(self, chip_ver_dict, chip, core): - ver_binary_dict = dict() - # print("chip_ver_dict = ", chip_ver_dict) # 字典信息包含核名字,配置文件路径 - if chip_ver_dict is None: - return ver_binary_dict - for target in chip_ver_dict: - if chip_ver_dict[target].get('core') != core: # 判断字典里面的target读出来的core是否和core相同 - print("chip_ver_dict[target].get('core') = ", chip_ver_dict[target].get('core')) - continue - stream_gen = chip_ver_dict[target].get('stream_gen') - for ver in chip_ver_dict[target]: - # print("ver =", ver) - if ver == 'core' or ver == 'stream_gen': - continue - stream_gen = chip_ver_dict[target].get('stream_gen') - cfg_file = chip_ver_dict[target][ver]["merged_cfg"] - # print("cfg_file =",cfg_file) - stream = self._gen_nv_stream(cfg_file, stream_gen, chip, core) - nv_ver_bin = \ - os.path.join(self.nv_relative_path, 'bin', '%s_nv.bin' % (core)) - # print("nv_ver_bin = ", nv_ver_bin) # 生成nvbin文件的路径 - prod_type = chip_ver_dict[target][ver]["prod_type"] - prod_type = "all" if prod_type is None else prod_type - ver_binary_dict["%s_%s" % (chip, prod_type)] = self._write_binary_to_file(nv_ver_bin, stream) - return ver_binary_dict - - def _write_binary_to_file(self, file_path, stream): - if os.path.exists(os.path.dirname(file_path)) is False: - os.makedirs(os.path.dirname(file_path)) - if os.path.exists(file_path) is True: - os.remove(file_path) - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - modes = stat.S_IWUSR | stat.S_IRUSR - with os.fdopen(os.open(file_path, flags, modes), 'wb') as fout: - fout.write(stream) - return file_path - - def _gen_binary_prepare(self): - for chip in self.nv_ver_dict: - self.nv_chip_ver_bin[chip] = dict() - self.nv_cores_ver_bin[chip] = dict() - self.nv_flash_page_index[chip] = dict() - nv_flash_chip_cfg = self.nv_flash_cfg[chip] - cores = nv_flash_chip_cfg["cores"].keys() - chip_nv_ver = self.nv_ver_dict[chip] - for target in chip_nv_ver: - core = chip_nv_ver[target].get('core') - for core in cores: - if core not in cores: - msg = "[error] [%s] [%s] not a core cfg in nv_storage_cfg.json!" % (target, core) - raise ParserError(msg) - if self.nv_cores_ver_bin[chip].get(core) is None: - self.nv_cores_ver_bin[chip][core] = dict() - page_size = fn_str_to_int(nv_flash_chip_cfg["size"]["page_size"]) - total_size = 0 - for core in cores: - core_page_nums = nv_flash_chip_cfg['cores'][core]['page_nums'] - total_size += core_page_nums * page_size - self.nv_flash_page_index[chip][core] = [(sizeof(NvPageHead) + num * page_size, (num + 1) * page_size) \ - for num in range(0, core_page_nums)] - if total_size > fn_str_to_int(nv_flash_chip_cfg["size"]['flash_size']): - msg = "[error] cores size: %s, over total flash size: %s!" % \ - (total_size, nv_flash_chip_cfg["size"]['flash_size']) - raise ParserError(msg) - - def _gen_nv_stream(self, cfg_file, stream_gen, chip, core): - core_nv_bin = self._init_nv_page_head(chip, core) - - cfg_data = BuildConfParser(cfg_file).get_conf_data() - key_id_list = [] - last_key_item_start_addr = 0 - for module in cfg_data: - for key_item in cfg_data[module]: - if key_item == 'module_id': - continue - key_struct_name = cfg_data[module][key_item].get("structure_type") - key_value = cfg_data[module][key_item].get("value") - key_attr = cfg_data[module][key_item].get("attributions") - key_id = cfg_data[module][key_item].get("key_id") - key_id = fn_str_to_int(key_id) if type(key_id) is not int else key_id - if key_struct_name is None or key_value is None or key_attr is None or key_value == []: - msg = "[error] 'structure_type' 'value' 'attributions' must be configured!" - raise ParserError(msg) - - if key_id in key_id_list: - msg = "[error] key id:%d repeated, please check!" % key_id - raise ParserError(msg) - key_id_list.append(key_id) - - key_data, key_data_len = stream_gen.generate(key_struct_name, key_value) - page_index, key_item_start_addr = self._find_usable_addr(chip, core, key_data, key_data_len) - core_nv_bin, key_item_start_addr = \ - self._init_key_head(core_nv_bin, key_item_start_addr, key_data_len, key_id, key_attr) - - core_nv_bin, key_item_start_addr = \ - self._set_key_data(core_nv_bin, key_item_start_addr, key_data, key_data_len) - core_nv_bin, key_item_start_addr = \ - self._set_key_hash(core_nv_bin, key_item_start_addr, key_data_len) - self._update_core_index(chip, core, page_index, key_item_start_addr) - last_key_item_start_addr = max(last_key_item_start_addr, key_item_start_addr) - core_nv_bin = self._set_unused_page(chip, core_nv_bin, last_key_item_start_addr) - self._reset_core_index(chip, core) - return core_nv_bin - - def _set_unused_page(self, chip, core_nv_bin, key_item_start_addr): - page_size = fn_str_to_int(self.nv_flash_cfg[chip]['size']['page_size']) - core_nv_end_addr = (key_item_start_addr + (page_size - 1)) & ~(page_size - 1) - for i in range(key_item_start_addr, core_nv_end_addr): - core_nv_bin[i] = 0xFF - return core_nv_bin[0 : core_nv_end_addr] - - def _gen_chip_nv_binary(self): - for chip in self.nv_cores_ver_bin: - chip_bins = self.nv_cores_ver_bin[chip] - ver_list = [] - for core in chip_bins: - ver_list.extend(chip_bins[core].keys()) - - ver_list = set(ver_list) - for ver in ver_list: - self.nv_chip_ver_bin[chip][ver] = self._assemble_ver_bins(chip, ver) - - def _assemble_ver_bins(self, chip, ver): - flash_bin = bytearray(fn_str_to_int(self.nv_flash_cfg[chip]['size']['flash_size'])) - for i in range(0, len(flash_bin)): - flash_bin[i] = 0xFF - - start_addr = 0 - chip_bins = self.nv_cores_ver_bin[chip] - cores = self.nv_cores_ver_bin[chip] - for core in chip_bins: - ver_bin = chip_bins[core].get(ver) - flash_bin, start_addr = self._append_file_to_stream(flash_bin, start_addr, chip, core, ver_bin) - chip_ver_bin_file = os.path.join(self.nv_output_dir, self.nv_output_name) - # TODO: 目前只考虑单核场景去除 NV bin 末尾的无用 FF - return self._write_binary_to_file(chip_ver_bin_file, flash_bin[0 : start_addr]) - - def _append_file_to_stream(self, flash_bin, start_addr, chip, core, ver_bin): - core_bin_size = fn_str_to_int(self.nv_flash_cfg[chip]['size']["page_size"]) * \ - self.nv_flash_cfg[chip]["cores"][core]['page_nums'] - core_nv_bin = b'' - if ver_bin is None: - core_nv_bin = self._init_nv_page_head(chip, core) - else: - with open(ver_bin, 'rb') as f: - core_nv_bin = f.read() - #print('core_nv_bin = ', core_nv_bin) - tail_addr = start_addr + len(core_nv_bin) - flash_bin[start_addr : tail_addr] = core_nv_bin - - return flash_bin, tail_addr - - def _reset_core_index(self, chip, core): - nv_flash_chip_cfg = self.nv_flash_cfg[chip] - page_size = fn_str_to_int(nv_flash_chip_cfg['size']["page_size"]) - core_page_nums = nv_flash_chip_cfg['cores'][core]['page_nums'] - self.nv_flash_page_index[chip][core] = [(sizeof(NvPageHead) + num * page_size, (num + 1) * page_size) \ - for num in range(0, core_page_nums)] - - def _update_core_index(self, chip, core, index, addr): - (start_addr, page_max_addr) = self.nv_flash_page_index[chip][core][index] - if start_addr >= addr or addr > page_max_addr: - msg = "[error] addr %s invalid!" % addr - raise ParserError(msg) - self.nv_flash_page_index[chip][core][index] = (addr, page_max_addr) - #print("update page index: \n", self.nv_flash_page_index) - - def _find_usable_addr(self, chip, core, key_data, key_data_len): - page_size = fn_str_to_int(self.nv_flash_cfg[chip]['size'].get('page_size')) - key_item_total_len = self._get_key_item_len(key_data_len) - if key_item_total_len > page_size - sizeof(NvPageHead): - msg = "[error] key over page size !" % key_id - raise ParserError(msg) - - index = 0 - for (start_addr, page_max_addr) in self.nv_flash_page_index[chip][core]: - if start_addr + key_item_total_len > page_max_addr: - index += 1 - continue - return index, start_addr - msg = "[error] no more enough space for [%s]!" % core - raise ParserError(msg) - - def _get_key_type_from_attr(self, key_id, attr): - if (attr & 1) and (not (attr & ~1)): - return 0xFF - elif (attr & 2) and (not (attr & ~2)): - return 0x00 - elif (attr & 4) and (not (attr & ~4)): - return 0xFF - else: - msg = "[error] attribution config err: [id-%s] [attr-%s] !" % (key_id, attr) - raise ParserError(msg) - - def _get_key_upgrade_from_attr(self, key_id, attr): - if (attr & 1) and (not (attr & ~1)): - return 0xFF - elif (attr & 2) and (not (attr & ~2)): - return 0xFF - elif (attr & 4) and (not (attr & ~4)): - return 0x00 - else: - msg = "[error] attribution config err: [id-%s] [attr-%s] !" % (key_id, attr) - raise ParserError(msg) - - def _get_key_item_len(self, key_data_len): - if key_data_len % 4 != 0: - key_data_len += 4 - key_data_len % 4 - return sizeof(KeyHead) + 4 + key_data_len - - def _set_key_hash(self, nv_bin, key_item_start_addr, key_data_len): - if key_data_len % 4 != 0: - key_data_len += 4 - key_data_len % 4 - hash_start_addr = key_item_start_addr - key_data_len - sizeof(KeyHead) - hash_end_addr = hash_start_addr + key_data_len + sizeof(KeyHead) - if not self.use_crc16: - crc32num = zlib.crc32(nv_bin[hash_start_addr : hash_end_addr]) - else: - crc32num = binascii.crc_hqx(nv_bin[hash_start_addr : hash_end_addr], 0) - crc32ret = '{:0>8X}'.format(crc32num) - crc32ret = re.sub(r"(?<=\w)(?=(?:\w\w)+$)", " 0x", crc32ret) - crc32ret = '0x' + crc32ret - crc32list = [int(x,16) for x in crc32ret.split(" ")] - sha256bytearray = bytes(crc32list) - tail_addr = key_item_start_addr + len(sha256bytearray) - nv_bin[key_item_start_addr : tail_addr] = sha256bytearray - return nv_bin, tail_addr - - def _set_key_data(self, nv_bin, key_item_start_addr, key_data, key_data_len): - if key_data_len % 4 != 0: - for i in range(0, 4 - key_data_len % 4) : - key_data += b'\x00' - key_data_len += 4 - key_data_len % 4 - tail_addr = key_item_start_addr + key_data_len - nv_bin[key_item_start_addr : tail_addr] = key_data - return nv_bin, tail_addr - - def _init_key_head(self, nv_bin, key_item_start_addr, key_data_len, key_id, key_attr): - nv_key_st = KeyHead.from_buffer(nv_bin[key_item_start_addr:]) - - nv_key_st.magic = 0xA9 - nv_key_st.length = key_data_len - nv_key_st.type = self._get_key_type_from_attr(key_id, key_attr) - nv_key_st.upgrade = self._get_key_upgrade_from_attr(key_id, key_attr) - nv_key_st.key_id = key_id - - nv_key_st.version = 65535 - nv_key_st.enc_key = 0 # TODO: 目前不支持加密,且nv加密部分不由nv脚本做,可能放到初始化? - tail_addr = key_item_start_addr + sizeof(KeyHead) - nv_bin[key_item_start_addr : tail_addr] = nv_key_st - return nv_bin, tail_addr - - def _init_nv_page_head(self, chip, core): - nv_flash_chip_cfg = self.nv_flash_cfg[chip] - default_page_nums = nv_flash_chip_cfg.get('default_page_nums') - page_size = fn_str_to_int(nv_flash_chip_cfg['size']['page_size']) - page_nums = nv_flash_chip_cfg['cores'][core]['page_nums'] - if not self.is_backup: - page_id_start = nv_flash_chip_cfg['cores'][core]['page_id_start'] - else: - page_id_start = '0x34B2' - core_nv_size = page_nums * page_size - core_nv_bin = bytearray(core_nv_size) - - for i in range(0, core_nv_size): - core_nv_bin[i] = 0xFF - - for i in range(0, page_nums): - start_addr = i * page_size - nv_page_head = NvPageHead.from_buffer(core_nv_bin[start_addr:]) - nv_page_head.id = fn_str_to_int(page_id_start) - nv_page_head.reserved = 1 - nv_page_head.num_pages = i - nv_page_head.inverted_details_word = ~int.from_bytes(struct.pack('HBB', \ - nv_page_head.id, nv_page_head.reserved, nv_page_head.num_pages), 'little') - nv_page_head.last_write = 0 - nv_page_head.unused = ~nv_page_head.last_write - core_nv_bin[start_addr : start_addr + sizeof(NvPageHead)] = nv_page_head - return core_nv_bin - - def _load_nv_flash_cfg(self): - self.nv_flash_cfg = dict() - for chip in self.nv_ver_dict: - cfg_file = os.path.join(self.root, json_conf["NV_TARGET_JSON_PATH"]) - self.nv_flash_cfg[chip] = BuildConfParser(cfg_file).get_conf_data() - - def _add_nv_ver(self, chip, target, core, ver, common_cfg, ver_cfg, prod_type=None): - ''' - Add version config into self.nv_ver_src_dict. - There are three configuration scenarios.One target may correspond to multiple NV versions. - - |--- ver1: { srcs:[default, common, cfg1], prod_type: } - | - chip|---target1---|--- ver2: { srcs:[default, cfg2], prod_type: } - | | - | |--- ver3: { srcs:[default, common], prod_type: } - | | - | |--- core : "Each target corresponds to one core." - |---targetN... - ''' - - ver_cfgs = [] - if os.path.exists(common_cfg) is True: - ver_cfgs.append(common_cfg) - if ver_cfg is not None and os.path.exists(ver_cfg): - ver_cfgs.append(ver_cfg) - - if self.nv_ver_src_dict.get(chip) is None: - self.nv_ver_src_dict[chip] = dict() - - chip_dict = self.nv_ver_src_dict[chip] - if chip_dict.get(target) is not None and chip_dict[target].get(ver) is not None: - msg = "[error] Ver config Repeate!" - raise ParserError(msg) - - if chip_dict.get(target) is None: - chip_dict[target] = {ver:{"srcs":ver_cfgs, 'prod_type': prod_type}} - else: - chip_dict[target].update({ver:{"srcs":ver_cfgs, 'prod_type': prod_type}}) - - if chip_dict[target].get('core') is None: - chip_dict[target]['core'] = core - elif chip_dict[target].get('core') != core: - msg = "[error] [%s] core not match!" % target - raise ParserError(msg) - - def _nv_ver_prepare(self, target): - ''' - 1. Check nv configurations. - 2. Add all correct config into self.nv_ver_src_dict.. - ''' - if type(self.alias[target]) is list: - return False - target_type = self.alias[target].get("TYPE") - if target_type is None or target_type != 'nv': - return False - - core = self.alias[target].get("CORE") - if core is None: - msg = "[error] core name not exist!" - raise ParserError(msg) - chip = self.alias[target].get("CHIP") - #default_cfg = os.path.join(self.nv_root, '%s_default.json' % core) - ''' - if chip is None or os.path.exists(default_cfg) is False: - msg = "[error] chip name OR %s not exist!" % default_cfg - raise ParserError(msg) - ''' - kernel_name = self.alias[target].get("KERNEL_BIN") - if kernel_name is None: - msg = "[error] KERNEL is null!" - raise ParserError(msg) - if self.targets is not None and kernel_name not in self.targets: - return False - cfgs = self.alias[target].get("COMPONENT") - if cfgs is None: - msg = "[error] COMPONENT is null!" - raise ParserError(msg) - - prod_type = self.alias[target].get("PRODUCT_TYPE") - if prod_type == "": - prod_type = None - if prod_type is not None and type(prod_type) is not str: - msg = "[error] PRODUCT_TYPE must be a string type, one kernel only suuport one product type!" - raise ParserError(msg) - - cfg_dir = os.path.join(self.nv_root, kernel_name) - common_cfg = os.path.join(cfg_dir, 'common.json') - - for cfg in cfgs: - cfg_file = os.path.join(cfg_dir, '%s.json' % cfg) if cfg != 'common' else None - self._add_nv_ver(chip, kernel_name, core, cfg, common_cfg, cfg_file, prod_type) - - def _prod_type_filter(self, srcs, prod_type = None): - combination = dict() - module_dict = dict() - for src in srcs: - # print("[INFO] nv config src file: ", src) - src_conf = BuildConfParser(src).get_conf_data() - for module in src_conf: - module_id = src_conf.get(module).get('module_id') - if module_id is None: - msg = "[error][file:%s][%s] module_id is null!" % (src, module) - raise ParserError(msg) - module_id = fn_str_to_int(module_id) if type(module_id) is not int else module_id - if module_id > g_u8_max : - msg = "[error][file:%s][%s] module_id is more than 0xFF!" % (src, module) - raise ParserError(msg) - - # diffrent module must config with diffrent module_id - if module_id in module_dict: - if module_dict[module_id] != module: - msg = "[error][file:%s][%s] module_id is the same to [%s]!" % (src, module, module_dict[module_id]) - raise ParserError(msg) - else: - module_dict[module_id] = module - - if module not in combination: - combination[module] = {'module_id': module_id} - elif combination.get(module).get('module_id') != module_id: - msg = "[error][%s][%s] module_id is not same as other file!" % (src, module) - raise ParserError(msg) - - for item in src_conf.get(module): - key_cfg = src_conf.get(module).get(item) - if item == 'module_id': - continue - - key_id = key_cfg.get('key_id') - key_id = None if key_id is None else (fn_str_to_int(key_id) if type(key_id) is not int else key_id) - # print("key id: %d, module id: %d, key>>8: %d"%( key_id, module_id, key_id>>8)) - if key_id is None or key_id > g_u16_max : - msg = "[error][file:%s][%s][%s] key_id is null or more than unsighed 16 or not match with module_id!" % (src, module, item) - raise ParserError(msg) - - item_prod_type = key_cfg.get('product_type') - key_status = key_cfg.get('key_status') - #print('prodtype: %s, key prod: %s'%(prod_type, item_prod_type)) - if (prod_type == item_prod_type or (item_prod_type is not None and prod_type in item_prod_type)) \ - and key_status == 'alive': - combination[module].update({item:key_cfg}) - return combination - - def _nv_cfg_writer(self, dst_file, combination): - if os.path.exists(os.path.dirname(dst_file)) is False: - os.makedirs(os.path.dirname(dst_file)) - if os.path.exists(dst_file): - os.remove(dst_file) - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - modes = stat.S_IWUSR | stat.S_IRUSR - with os.fdopen(os.open(dst_file, flags, modes), 'w') as fout: - fout.write(json.dumps(combination, indent=4)) - - def _merge_ver_cfg(self, file_prefix, ver_cfg): - srcs = ver_cfg.get('srcs') - if srcs is None: - msg = "[error] ver cfg file is null!" - raise ParserError(msg) - - prod_type = ver_cfg.get('prod_type') - combination = self._prod_type_filter(srcs, prod_type) - dst_file = '%s.json' % file_prefix - self._nv_cfg_writer(dst_file, combination) - return { "merged_cfg" : dst_file, "prod_type" : prod_type} - - def _create_header(self): - pass - -# 检查配置文件中是否有必须配置项 -def check_key(json_conf): - check_item = ['OUT_BIN_DIR', 'BUILD_TEMP_PATH', 'NV_TARGET_JSON_PATH', \ - 'NV_RELATIVE_PATH', 'NV_DEFAULT_CFG_DIR', 'DATABASE_TXT_FILE'] - keys = dict.keys(json_conf) - for check_key in check_item: - if check_key not in keys: - msg = "[error] [nv_binary] need add ConfigMap (%s) in json_conf!" % (check_key) - raise ParserError(msg) - -def test(targets, flag, backup, use_crc16): - root = g_root - nv_target_json_path = os.path.join(root, json_conf["NV_TARGET_JSON_PATH"]) - alias_conf = BuildConfParser(nv_target_json_path).get_conf_data() - worker = BuildNv(alias_conf, root, targets, backup, use_crc16) - if flag: - worker.set_nv_output_dir(os.path.join(root, json_conf["OUT_BIN_DIR"])) - worker.start_work() - -def nv_begin(in_path, targets, flag, gen_backup=False, use_crc16=False): - global json_conf - with open(in_path, 'r') as i: - json_conf = json.load(i) - - check_key(json_conf) - test(targets, flag, False, use_crc16) - if gen_backup: - test(targets, flag, True, use_crc16) - print("build nv bin success!!") - -if __name__ == "__main__": - in_path = sys.argv[2] - targets = sys.argv[3].split() - flag = len(sys.argv) == 3 - - nv_begin(in_path, targets, flag) diff --git a/build/script/nv/parse_msgdefs.py b/build/script/nv/parse_msgdefs.py deleted file mode 100755 index 1dc29a6..0000000 --- a/build/script/nv/parse_msgdefs.py +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2022. All rights reserved. - -""" -* Description: NV binary create. -* Create: 2020-3-10 -""" -import pycparser -import ctypes - -binary_operators = { - "&": lambda x, y: x & y, - "|": lambda x, y: x | y, - "*": lambda x, y: x * y, - "+": lambda x, y: x + y, - "-": lambda x, y: x - y, - "/": lambda x, y: x // y, - "<<": lambda x, y: x << y, - ">>": lambda x, y: x >> y, - "<=": lambda x, y: int(x <= y), - ">=": lambda x, y: int(x >= y), - "==": lambda x, y: int(x == y), - "&&": lambda x, y: int(bool(x and y)), - "||": lambda x, y: int(bool(x or y)), -} - -unary_operators = { - "-": lambda x: -x, - "!": lambda x: 1 if x else 0, - "sizeof": lambda x: ctypes.sizeof(x), -} - -fundamental_types = { - "": ctypes.c_int, - "_Bool": ctypes.c_bool, - "char unsigned": ctypes.c_ubyte, - "char": ctypes.c_byte, - "double": ctypes.c_double, - "double long": ctypes.c_longdouble, - "float": ctypes.c_float, - "long long unsigned": ctypes.c_ulonglong, - "long long": ctypes.c_longlong, - "long unsigned": ctypes.c_ulong, - "long": ctypes.c_long, - "short unsigned": ctypes.c_ushort, - "short": ctypes.c_short, - "unsigned": ctypes.c_uint, - "void": None, -} - -def get_typename(names): - specifiers = [] - for name in sorted(names): - if name in ["signed", "int"]: - continue - specifiers.append(name) - return " ".join(specifiers) - -def create_enum_type(enumname, enums): - # enum size fixed to 4Bytes - return type(enumname, (ctypes.c_uint,), {"members": enums}) - - # enum size depends on max enum value - smallest = min(enums.values()) - largest = max(enums.values()) - if smallest < 0: - if -128 <= smallest and largest <= 127: - base = ctypes.c_byte - elif -32768 <= smallest and largest <= 32767: - base = ctypes.c_short - else: - base = ctypes.c_int - else: - if largest < 256: - base = ctypes.c_ubyte - elif largest < 65536: - base = ctypes.c_ushort - else: - base = ctypes.c_uint - return type(enumname, (base,), {"members": enums}) - - -class Visitor(pycparser.c_ast.NodeVisitor): - # Parse all typedefs and expand identifiers. - def __init__(self): - self.enums = {} - self.typedefs = dict(fundamental_types) - - # The context in which the ID names exist. - self.id_context = self.enums - self.anon_struct_count = 1 - self.anon_enum_count = 1 - self.anon_union_count = 1 - - def generic_visit(self, node): - # Dump ast to see what is not implemented. - raise SystemExit("Unhandled ast element at %s: %s" % (node.coord, node)) - - def visit_Decl(self, node): - return - - def visit_FuncDef(self, node): - return - - def visit_FuncDecl(self, node): - return - - def visit_FileAST(self, node): - for c in node: - self.visit(c) - - def visit_ID(self, node): - try: - return self.id_context[node.name] - except KeyError: - raise SystemExit("Failed to resolve identifier '%s' at %s" % (node.name, node.coord)) - - def visit_Typename(self, node): - return self.visit(node.type) - - def visit_TypeDecl(self, node): - return self.visit(node.type) - - def visit_CompoundLiteral(self, node): - return self.visit(node.type) - - def visit_PtrDecl(self, node): - return ctypes.POINTER(self.visit(node.type)) - - def visit_Typedef(self, node): - if node.name in self.typedefs: - raise SystemExit("Duplicate typedef '%s' at %s" % (node.name, node.coord)) - value = self.visit(node.type) - self.typedefs[node.name] = value - - def visit_ArrayRef(self, node): - # For accessing type of an array element - array = self.visit(node.name) - #index = self.visit(node.subscript) - return array._type_ - - def visit_StructRef(self, node): - # This is needed to get access to types inside a struct. - struct = self.visit(node.name) - self.id_context = dict(struct._fields_) - try: - return self.visit(node.field) - finally: - self.id_context = self.enums - - def visit_BinaryOp(self, node): - try: - op = binary_operators[node.op] - except KeyError: - raise SystemExit("Unhandled binary operator '%s' at %s" % (node.op, node.coord)) - leftval = self.visit(node.left) - rightval = self.visit(node.right) - return op(leftval, rightval) - - def visit_UnaryOp(self, node): - value = self.visit(node.expr) - try: - op = unary_operators[node.op] - except KeyError: - raise SystemExit("Unhandled unary operator '%s' at %s" % (node.op, node.coord)) - return op(value) - - def visit_Enum(self, node): - # Mapping of enum names to enum values from all parsed enums. - value = -1 - enums = {} - for enum in node.values: - if enum.value is None: - value += 1 - else: - value = self.visit(enum.value) - self.enums[enum.name] = enums[enum.name] = value - - if node.name is None: - enumname = "enum_anon_%d" % self.anon_enum_count - self.anon_enum_count += 1 - else: - enumname = "enum_%s" % str(node.name) - return create_enum_type(enumname, enums) - - def visit_Constant(self, node): - if node.type not in ["int", "unsigned int"]: - raise SystemExit("Unhandled Constant node type '%s' at %s" % (node.type, node.coord)) - value = node.value.rstrip("LlUu") - if value.startswith(("0x", "0X")): - return int(value, 16) - return int(value) - - def visit_IdentifierType(self, node): - name = get_typename(node.names) - try: - return self.typedefs[name] - except KeyError: - raise SystemExit("Invalid type specifier '%s' at %s" % (name, node.coord)) - - def visit_Struct(self, node): - fields = [] - # node.decls can be None when the struct declaration is outside the typedef. - if node.decls is not None: - for decl in node.decls: - if decl.bitsize is not None: - temp = self.visit(decl.type) - value = type(decl.name, (temp,),{"bitsize": decl.bitsize.value}) - else: - value = self.visit(decl.type) - if value is None: - # This is the void type - indicates an invalid message definition type. - return None - fields.append((decl.name, value)) - - if node.name is None: - structname = "struct_anon_%d" % self.anon_struct_count - self.anon_struct_count += 1 - else: - structname = "struct_%s" % str(node.name) - return type(structname, (ctypes.Structure,), {"_fields_": fields}) - - def visit_Union(self, node): - fields = [] - for decl in node.decls: - value = self.visit(decl.type) - if value is None: - return None - fields.append((decl.name, value)) - - if node.name is None: - unionname = "union_anon_%d" % self.anon_union_count - self.anon_struct_count += 1 - else: - unionname = "union_%s" % str(node.name) - return type(unionname, (ctypes.Union,), {"_fields_": fields}) - - def visit_ArrayDecl(self, node): - length = self.visit(node.dim) - type = self.visit(node.type) - if length is None or length < 0: - raise SystemExit("Invalid array len %s at %s" % (length, node.dim.coord)) - if type is None: - raise SystemExit("Invalid array type %s at %s" % (type, node.type.coord)) - return type * length - -def message_enum_name(elemName): - if elemName.endswith("_t"): - return elemName[:-2].upper() - if elemName.endswith("_s"): - # NAS messages, already uppercase - return elemName[:-2] - if elemName.endswith("_STRUCT"): - return elemName[:-7] - if elemName.find("LOG_MESSAGE") != -1: - return elemName +'_ID' - -def parse_preprocessed_headers(source): - # Public function that returns the required data for producing messagexml - try: - node = pycparser.parse_file(source) - except pycparser.plyparser.ParseError as e: - raise SystemExit("ERROR parsing msgdefs %s: %s" % (source, e)) - v = Visitor() - v.visit(node) - - messages = [] - for structname, fields in sorted(v.typedefs.items()): - messageEnumName = message_enum_name(structname) - if messageEnumName is None: - # Not a valid message definition name. - continue - try: - messageId = v.enums[messageEnumName] - except KeyError: - # No associated message id, so not a message definition. - continue - if fields is None: - raise SystemExit("Message definition contains undefined type: %s" % structname) - messages.append((messageEnumName, structname, messageId, fields)) - return messages diff --git a/build/script/pack_tool.py b/build/script/pack_tool.py deleted file mode 100755 index 02080f1..0000000 --- a/build/script/pack_tool.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import sys -import shutil -from utils.build_utils import CopyModule, output_root, root_path -from enviroment import TargetEnvironment, BuildEnvironment, chip_copy_target - -def find_copy_target(target_name): - for chip in chip_copy_target: - if target_name in chip_copy_target[chip]: - print(target_name, chip) - return chip - return None - -class packTool: - def __init__(self, pack_name, target_name): - self.pack_name = pack_name - self.target_name = target_name - self.pack_suffix = ['bin', 'elf', 'lst', 'asm', 'nm', 'map', 'mem', 'hex', 'info', 'fwpkg', 'ko'] - self.pack_dir = ['parse_tool'] - self.pack_bin_suffix = ['bin'] - - def __replace_copy_target_path(self, path): - path = path.replace("", root_path) - path = path.replace("", output_root) - path = path.replace("", self.pack_name) - return path - - def __pack_copy_target__(self, chip, copy_target): - for item in copy_target: - src = self.__replace_copy_target_path(item['src']) - dst = self.__replace_copy_target_path(item['dst']) - if not dst and os.path.exists(src): - print("remove %s" % src) - if os.path.isfile(src): - os.remove(src) - elif os.path.isdir(src): - shutil.rmtree(src) - continue - print("copy %s -> %s" % (src, dst)) - c = CopyModule(copy_header = False) - c.copy(src, dst) - - def pack(self): - chip = find_copy_target(self.target_name) - if chip is not None: - self.__pack_copy_target__(chip, chip_copy_target[chip][self.target_name]) - return - target_env = TargetEnvironment(self.target_name) - chip = target_env.get('chip') - output_path = target_env.get_output_path() - pack_path = os.path.join(output_root, 'package', chip, self.pack_name) - pack_target_path = os.path.join(pack_path, self.target_name) - pack_bin_path = pack_path - print("Start pack target %s" % self.target_name) - if not os.path.exists(pack_target_path): - os.makedirs(pack_target_path) - for file_name in os.listdir(output_path): - ext_name = os.path.splitext(file_name)[-1][1:] - if ext_name not in self.pack_suffix: - continue - src = os.path.join(output_path, file_name) - dst = os.path.join(pack_target_path, file_name) - shutil.copy(src, dst) - print("copy %s -> %s" % (src, dst)) - if ext_name not in self.pack_bin_suffix: - continue - bin_dst = os.path.join(pack_bin_path, file_name) - print("copy %s -> %s" % (src, bin_dst)) - shutil.copy(src, bin_dst) - - for file_name in os.listdir(output_path): - if file_name not in self.pack_dir: - continue - src = os.path.join(output_path, file_name) - dst = os.path.join(pack_target_path, file_name) - shutil.copytree(src, dst) - print("copytree %s -> %s" % (src, dst)) \ No newline at end of file diff --git a/build/script/param_packet.py b/build/script/param_packet.py deleted file mode 100755 index ef12038..0000000 --- a/build/script/param_packet.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import sys -import struct -sys.path.append(os.path.dirname(__file__)) -from conf_parser import BuildConfParser, ParserError -from utils.build_utils import fn_str_to_int - -## -## Params Area Stucture -## -## Image_ID: 4B -## Struct_Version: 4B -## Version: 4B -## Item_Offset: 2B -## Item_Count: 1B -## ItemID_List: Item_Count -## Padding_Area: Item_Offset - 15 - Item_Count -## Item_List: (4B + 4B) * Item_Count -## -def param_area(dst_file, image_id, stru_ver, version, param_info) -> None: - - item_num = len(param_info) - item_offset = 15 + item_num - item_offset = int((item_offset + 3) / 4) * 4 - - ## image_id, stru_ver, version, item_offset, item_num - bin_size = 1024 - - binary = struct.pack("= item.start_addr and addr+size < item.start_addr+item.size: - match_item=item - break - if match_item==None: - return None - addr=addr-match_item.start_addr - return match_item.data[addr:addr+size] - -class _HookFunctions: - def __init__(self): - self.get_symbol_info = None - self.get_u32_symbol_val = None - self.get_symbol_addr = None - self.addr_2_function_name = None - self.addr_in_2_function_name = None - -def parse_memory_get(addr,size): - """获取一段空间 - Args - addr: 起始地址 - size:大小 - return - binary:成功返回一段空间 - None:这段空间不存在 - """ - return _g_parse_memory_manager.memory_get(addr,size) - -def parse_memory_2_class(addr,class_type,class_size): - """将一段空间转换成一个ctype obj - Args - addr: 起始地址 - class_type: class 类型 - class_size: class size - return - obj:返回一个ctype obj - None:这段空间不存在 - """ - bin = parse_memory_get(addr,class_size) - if bin==None: - return None - return class_type.from_buffer(bin) - -def parse_memory_2_string(addr,max_len): - obj=parse_memory_2_class(addr,(c_char*max_len),sizeof((c_char*max_len))) - if obj==None: - return None - else: - return obj.value.decode('utf-8') - -def parse_memory_register(file_name,start_addr,size): - """注册一段内存 - Args - file_name: 内存来自文件,文件全路径 - start_addr: 内存起始地址 - size: 内存大小 - return - """ - _g_parse_memory_manager.register_memory(file_name,start_addr,size) - -def parse_memory_register_bin(bin,start_addr,size): - """注册一段内存 - Args - bin: 内存一段binary - start_addr: 内存起始地址 - size: 内存大小 - return - """ - _g_parse_memory_manager.register_bin(bin,start_addr,size) - -def parse_get_symbol_info(name): - """获取symbolinfo - Args - name: 符号名 - return - obj:成功,Sysmbol类型的obj - None:获取失败 - """ - if _g_hook_functions.get_symbol_info==None: - assert(False) - return None - return _g_hook_functions.get_symbol_info(name) - -def parse_get_u32_symbol_val(name): - """获取值 - Args - name: 符号名 - return - int:成功,获取到的值 - None:获取失败 - """ - if _g_hook_functions.get_u32_symbol_val==None: - assert(False) - return None - return _g_hook_functions.get_u32_symbol_val(name) - -def parse_get_symbol_addr(name): - """获取符号地址 - Args - name: 符号名 - return - int:成功,获取到的值 - None:获取失败 - """ - if _g_hook_functions.get_symbol_addr==None: - assert(False) - return None - return _g_hook_functions.get_symbol_addr(name) - -def parse_addr_2_function_name(addr): - if _g_hook_functions.addr_2_function_name==None: - assert(False) - return None - return _g_hook_functions.addr_2_function_name(addr) - -def parse_addr_in_2_function_name(addr): - if _g_hook_functions.addr_in_2_function_name==None: - assert(False) - return None - return _g_hook_functions.addr_in_2_function_name(addr) - -def uapi_register_function(name,function): - if name=="get_symbol_info": - _g_hook_functions.get_symbol_info = function - elif name=="get_u32_symbol_val": - _g_hook_functions.get_u32_symbol_val = function - elif name=="get_symbol_addr": - _g_hook_functions.get_symbol_addr=function - elif name=="addr_2_function_name": - _g_hook_functions.addr_2_function_name = function - elif name=="addr_in_2_function_name": - _g_hook_functions.addr_in_2_function_name = function - else: - assert(False) - -_g_parse_memory_manager = _ParseMemoryManager() -_g_basic_ctrl=_BasicCtrl() -_g_hook_functions =_HookFunctions() \ No newline at end of file diff --git a/build/script/parse_tool/parse_elf.py b/build/script/parse_tool/parse_elf.py deleted file mode 100755 index c644581..0000000 --- a/build/script/parse_tool/parse_elf.py +++ /dev/null @@ -1,1133 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_basic import * -from xml_main import * -import json - -g_drwaf_all_tag_tup = ('DW_TAG_compile_unit', - 'DW_TAG_subprogram', - 'DW_TAG_variable', - 'DW_TAG_GNU_call_site', - 'DW_TAG_typedef', - 'DW_TAG_base_type', - 'DW_TAG_array_type', - 'DW_TAG_subrange_type', - 'DW_TAG_pointer_type', - 'DW_TAG_subroutine_type', - 'DW_TAG_formal_parameter', - 'DW_TAG_const_type', - 'DW_TAG_structure_type', - 'DW_TAG_member', - 'DW_TAG_enumeration_type', - 'DW_TAG_enumerator', - 'DW_TAG_unspecified_parameters', - 'DW_TAG_lexical_block', - 'DW_TAG_inlined_subroutine', - 'DW_TAG_union_type', - 'DW_TAG_volatile_type', - 'DW_TAG_label', - 'DW_TAG_restrict_type', - 'DW_TAG_namespace', - 'DW_TAG_class_type', - 'DW_TAG_template_type_param', - 'DW_TAG_inheritance', - 'DW_TAG_GNU_template_parameter_pack', - 'DW_TAG_template_value_param', - 'DW_TAG_imported_declaration', - 'DW_TAG_reference_type', - 'DW_TAG_rvalue_reference_type', - 'DW_TAG_unspecified_type', - 'DW_TAG_imported_module', - 'DW_TAG_GNU_call_site_parameter') - -g_drwaf_all_attr_tup = ('DW_AT_producer', - 'DW_AT_language', - 'DW_AT_name', - 'DW_AT_stmt_list', - 'DW_AT_comp_dir', - 'DW_AT_low_pc', - 'DW_AT_ranges', - 'DW_AT_high_pc', - 'DW_AT_frame_base', - 'DW_AT_GNU_all_call_sites', - 'DW_AT_decl_file', - 'DW_AT_decl_line', - 'DW_AT_prototyped', - 'DW_AT_type', - 'DW_AT_external', - 'DW_AT_location', - 'DW_AT_abstract_origin', - 'DW_AT_GNU_tail_call', - 'DW_AT_encoding', - 'DW_AT_byte_size', - 'DW_AT_count', - 'DW_AT_data_member_location', - 'DW_AT_const_value', - 'DW_AT_declaration', - 'DW_AT_inline', - 'DW_AT_call_file', - 'DW_AT_call_line', - 'DW_AT_call_column', - 'DW_AT_GNU_call_site_target', - 'DW_AT_bit_size', - 'DW_AT_bit_offset', - 'DW_AT_alignment', - 'DW_AT_sibling', - 'DW_AT_upper_bound', - 'DW_AT_entry_pc', - 'DW_AT_GNU_all_tail_call_sites', - 'DW_AT_specification', - 'DW_AT_linkage_name', - 'DW_AT_calling_convention', - 'DW_AT_accessibility', - 'DW_AT_artificial', - 'DW_AT_explicit', - 'DW_AT_containing_type', - 'DW_AT_virtuality', - 'DW_AT_vtable_elem_location', - 'DW_AT_noreturn', - 'DW_AT_object_pointer', - 'DW_AT_export_symbols', - 'DW_AT_enum_class', - 'DW_AT_GNU_call_site_value', - 'DW_AT_import') - - -class TreeNode: - def __init__(self): - self.data = None - self.son = [] - self.parent = None - -class Tag: - def __init__(self): - self.level_str=None - self.entry_str=None - self.type_str = None - self.at_list = {} - self.level = None - self.son_tag_list = [] - self.parent = None - self.at_name = None - self.op_addr = None - self.byte_size = None - self.member_location = None - self.random_name = None - self.c_type_name = None - self.member_name = None - self.c_type_root_name = None - self.member_array_tag = None - self.member_type_tag = None - self.member_bit_size = None - self.root_tag = None - self.var_array = [] - self.symbol_location = None - -class Attribute: - def __init__(self): - self.entry_str=None - self.type_str=None - self.val_attr = None - -class Signature: - def __init__(self): - self.signature=None - self.sign_entry=0 - -class ParseCtrl(): - def __init__(self): - self.debug_type = None - self.symbol_dic_init=False - self.parse_debug_info_phase_0=False - self.parse_debug_info_phase_1=False - self.out_type = 'python' - self.symbol_dic={} - self.tag_list = [] - self.tag_dic_by_entry = {} - self.sign_list = [] - self.sign_entry_by_id = {} - self.last_tag = [None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None, - None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None]#支持48个等级 - self.tag_name_dic = {} - self.attr_name_dic = {} - self.random_val = 0 - self.class_fd = None - self.out_type_dic={} - self.var_symbol_dic={} - self.c_basic_type=[ - 'char','int','unsigned char','bool' - ] - - self.name_convert_dic = { - 'bool':'td_bool', - 'char':'td_char', - 'signed char':'td_char', - 'unsigned char':'td_uchar', - 'int':'td_s32', - 'unsigned int':'td_u32', - 'short':'td_s16', - 'unsigned short':'td_u16', - 'short unsigned int':'td_u16', - 'long':'td_s32', - 'unsigned long':'td_u32', - 'long long':'td_s64', - 'unsigned long long':'td_u64', - 'float':'td_float', - 'double':'td_double', - '__ARRAY_SIZE_TYPE__':'td_u32', - 'long unsigned int':'td_u32', - '_Bool':'td_bool', - } - - for key in self.name_convert_dic: - self.out_type_dic[self.name_convert_dic[key]]=True - - def print_root_basic_type(self,fp): - if self.out_type=='python': - print('from ctypes import *',file=self.class_fd) - print('td_bool=c_bool',file=fp) - print('td_char=c_char',file=fp) - print('td_uchar=c_ubyte',file=fp) - print('td_s16=c_short',file=fp) - print('td_u16=c_ushort',file=fp) - print('td_s32=c_int',file=fp) - print('td_u32=c_uint',file=fp) - print('td_s64=c_longlong',file=fp) - print('td_u64=c_ulonglong',file=fp) - print('td_float=c_float',file=fp) - print('td_double=c_double',file=fp) - elif self.out_type=='c': - print('typedef unsigned char td_bool;',file=fp) - print('typedef char td_char;',file=fp) - print('typedef unsigned char td_uchar;',file=fp) - print('typedef short td_s16;',file=fp) - print('typedef unsigned short td_u16;',file=fp) - print('typedef short unsigned int td_u16;',file=fp) #add for arm, UINT16 is short unsiged int - print('typedef int td_s32;',file=fp) - print('typedef unsigned int td_u32;',file=fp) - print('typedef long long td_s64;',file=fp) - print('typedef unsigned long long td_u64;',file=fp) - print('typedef float td_float;',file=fp) - print('typedef double td_double;',file=fp) - self.out_type_dic['td_bool']=True - self.out_type_dic['td_char']=True - self.out_type_dic['td_uchar']=True - self.out_type_dic['td_s16']=True - self.out_type_dic['td_u16']=True - self.out_type_dic['td_s32']=True - self.out_type_dic['td_u32']=True - self.out_type_dic['td_s64']=True - self.out_type_dic['td_u64']=True - self.out_type_dic['td_float']=True - self.out_type_dic['td_double']=True - - - def append_space(self,line,cnt): - i=0 - while i]$',tag.at_list['DW_AT_type'].val_attr.strip()) - entry_str = result[0][2:] - return entry_str - - def get_at_byte_size(self,tag):#获取bytesize(类型) - if tag.type_str == "DW_TAG_pointer_type": - return 4 - if 'DW_AT_byte_size' not in tag.at_list: - return None - str = tag.at_list['DW_AT_byte_size'].val_attr - return int(str,0) - - def get_at_bit_size(self,tag):#获取bytesize(类型) - if 'DW_AT_bit_size' not in tag.at_list: - return None - str = tag.at_list['DW_AT_bit_size'].val_attr - return int(str,0) - - def get_at_data_member_location(self,tag):#获取member相对偏移 - if 'DW_AT_data_member_location' not in tag.at_list: - return None - str = tag.at_list['DW_AT_data_member_location'].val_attr - return int(str,0) - - def get_at_count(self,tag):#数组长度 - if 'DW_AT_count' not in tag.at_list: - return None - str = tag.at_list['DW_AT_count'].val_attr - if (str.startswith('<')): - return None - return int(str,0) - - def get_at_location(self,tag): - if 'DW_AT_location' not in tag.at_list: - return None - str = tag.at_list['DW_AT_location'].val_attr.strip() - - result = re.findall(r'DW_OP_addr:(\s\w+)',str) - if result: - #print(str,'------------',result[0]) - #print(str,' result=',result[0]) - return int(result[0],16) - else: - #print(str,' result=None') - return None - - def get_root_tag(self,tag):#查找一个typedef类型的根类型 - if tag.type_str != 'DW_TAG_typedef': - return tag - - at_name = self.get_at_name(tag) - if at_name=='td_void' or at_name=='MC_VOID':#特殊情况 - return tag - - entry_str = self.get_at_type(tag) - if entry_str==None:#特殊情况td_void - return None - print("[ASSERT][LINE=%d]"%(sys._getframe().f_lineno),tag.entry_str) - assert(False) - new_tag = self.get_tag_by_entry_name(entry_str) - if new_tag==None: - print("[ASSERT][LINE=%d]"%(sys._getframe().f_lineno),tag.entry_str) - assert(False) - return self.get_root_tag(new_tag) - - def byte_size_2_c_type_name(self,byte_size):#根据类型size转基础类型(枚举转换) - if byte_size==1: - return 'td_u8' - elif byte_size==2: - return 'td_u16' - elif byte_size == 4: - return 'td_u32' - elif byte_size==8: - return 'c_ulonglong' - return None - - def process_phase1_base_type(self,tag): - at_name = self.get_at_name(tag) - tag.at_name = at_name - at_name = self.conver_base_name(at_name) - tag.c_type_name = at_name - tag.c_type_root_name = at_name - tag.byte_size = self.get_at_byte_size(tag) - tag.root_tag = tag - #self.print_tag_info(tag,0) - - def process_phase1_enumeration_type(self,tag): - at_name = self.get_at_name(tag) - tag.at_name = at_name - tag.byte_size = self.get_at_byte_size(tag) - tag.c_type_name = self.byte_size_2_c_type_name(tag.byte_size) - tag.c_type_root_name = tag.c_type_name - tag.root_tag = tag - #self.print_tag_info(tag,0) - def process_phase1_pointer_type(self,tag): - tag.byte_size = 4 - tag.c_type_name = 'td_u32' - tag.c_type_root_name = 'td_u32' - tag.root_tag = tag - #self.print_tag_info(tag,0) - - def process_phase1_structure_type(self,tag): - at_name = self.get_at_name(tag) - tag.byte_size = self.get_at_byte_size(tag) - tag.at_name = at_name - if tag.at_name==None: - tag.random_name = self.create_random_name() - tag.c_type_name = tag.random_name - tag.c_type_root_name = tag.random_name - tag.root_tag = tag - else: - tag.c_type_name = tag.at_name - tag.c_type_root_name = tag.at_name - tag.root_tag = tag - #self.print_tag_info(tag,0) - - def process_phase1_union_type(self,tag): - at_name = self.get_at_name(tag) - tag.byte_size = self.get_at_byte_size(tag) - tag.at_name = at_name - if tag.at_name==None: - tag.random_name = self.create_random_name() - tag.c_type_name = tag.random_name - tag.c_type_root_name = tag.random_name - tag.root_tag = tag - else: - tag.c_type_name = tag.at_name - tag.c_type_root_name = tag.at_name - tag.root_tag = tag - #self.print_tag_info(tag,0) - - def process_phase1_type_def(self,tag): - at_name = self.get_at_name(tag) - tag.at_name = at_name - if tag.at_name==None: - return - assert(False) - tag.c_type_name = tag.at_name - root_tag = self.get_root_tag(tag) - if root_tag==None: - return - assert(False) - tag.byte_size = root_tag.byte_size #TBD 是否已经生成 - tag.c_type_root_name = root_tag.c_type_root_name #TBD 是否已经生成 - tag.root_tag = root_tag - #self.print_tag_info(tag,0) - - def process_phase_array_type(self,tag): - tag.var_array = [] - for son in tag.son_tag_list: - if son.type_str == 'DW_TAG_subrange_type': - cnt = self.get_at_count(son) - if cnt==None: #特殊情况 data[] - cnt=0 - tag.var_array.append(cnt) - #self.print_tag_info(tag,0) - - def process_phase1_member_relation_tag(self,member_tag,tag): - entry_str = self.get_at_type(tag) - new_tag = self.get_tag_by_entry_name(entry_str) - if not new_tag: - return - if new_tag.type_str=='DW_TAG_array_type': - member_tag.member_array_tag = new_tag - elif new_tag.type_str=='DW_TAG_volatile_type' or new_tag.type_str=='DW_TAG_const_type': - pass - elif new_tag.type_str=='DW_TAG_typedef': - member_tag.member_type_tag = new_tag - elif (new_tag.type_str=='DW_TAG_base_type' - or new_tag.type_str=='DW_TAG_structure_type' - or new_tag.type_str=='DW_TAG_enumeration_type' - or new_tag.type_str=='DW_TAG_pointer_type' - or new_tag.type_str=='DW_TAG_union_type' ): - member_tag.member_type_tag = new_tag - elif (new_tag.type_str=='DW_TAG_class_type' - or new_tag.type_str=='DW_TAG_reference_type'): - member_tag.member_type_tag=None#不支持 - return - else: - print("[new tag type can not support parse]new_tag.type_str=%s" % new_tag.type_str) - return - - if member_tag.member_type_tag==None: - self.process_phase1_member_relation_tag(member_tag,new_tag) - #self.print_tag_info(tag,0) - - def process_phase1_member(self,tag): - tag.member_location = self.get_at_data_member_location(tag) - tag.at_name = self.get_at_name(tag) - tag.member_name = tag.at_name - tag.member_bit_size = self.get_at_bit_size(tag) - if tag.member_name==None:#结构体内部内嵌练合体 - tag.member_name = self.create_random_var_name() - if tag.member_location==None:#有些联合体没有location - pass - self.process_phase1_member_relation_tag(tag,tag) - #self.print_tag_info(tag,0) - - def process_phase1_variable(self,tag): - tag.at_name = self.get_at_name(tag) - tag.symbol_location = self.get_at_location(tag) - if tag.symbol_location: - self.process_phase1_member_relation_tag(tag,tag) - self.var_symbol_dic[tag.at_name]=tag - #print(tag.at_name) - - def process_phase1_tag(self,tag): - #tag_process(tag) - #self.print_tag_info(tag,0) - for son in tag.son_tag_list: - self.process_phase1_tag(son) - - if tag.type_str == "DW_TAG_base_type": - self.process_phase1_base_type(tag) - if tag.type_str == 'DW_TAG_enumeration_type': - self.process_phase1_enumeration_type(tag) - if tag.type_str == 'DW_TAG_structure_type': - self.process_phase1_structure_type(tag) - if tag.type_str == 'DW_TAG_typedef': - self.process_phase1_type_def(tag) - if tag.type_str == 'DW_TAG_pointer_type': - self.process_phase1_pointer_type(tag) - if tag.type_str == 'DW_TAG_member': - self.process_phase1_member(tag) - if tag.type_str == 'DW_TAG_array_type': - self.process_phase_array_type(tag) - if tag.type_str == 'DW_TAG_union_type': - self.process_phase1_union_type(tag) - if tag.type_str == 'DW_TAG_variable': - self.process_phase1_variable(tag) - - def process_phase1(self): - if self.parse_debug_info_phase_1==True: - return - process_list = ['DW_TAG_base_type', - 'DW_TAG_structure_type', - 'DW_TAG_enumeration_type', - 'DW_TAG_pointer_type', - 'DW_TAG_member', - 'DW_TAG_array_type', - 'DW_TAG_union_type', - 'DW_TAG_variable', - ] - for tag in self.tag_list: - if tag.level!=1: - continue - if tag.type_str not in process_list: - continue - self.process_phase1_tag(tag) - - process_list = ['DW_TAG_typedef' - ] - - for tag in self.tag_list: - if tag.level!=1: - continue - if tag.type_str not in process_list: - continue - self.process_phase1_tag(tag) - - self.parse_debug_info_phase_1=True - - def print_tag_2_class(self,tag,lines): - #print("print=",tag.entry_str) - for line in lines: - print(line,file=self.class_fd) - - def process_print_enumeration_type(self,tag): - return DEFINE_FAIL - - def process_print_python_typedef(self,tag): - - if tag.c_type_name=='td_void' or tag.c_type_name=='MC_VOID': - return DEFINE_SUCCESS - if tag.c_type_root_name in self.out_type_dic: - lines=[] - line='%s=%s'%(tag.c_type_name,tag.c_type_root_name) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - else:#原类型还没有定义,先打印原类型 - if (tag.root_tag)==None:# TD_VOID - return DEFINE_FAIL - ret = self.print_depend_tag(tag.root_tag) - if ret!=DEFINE_SUCCESS: - return ret - return self.process_print_typedef(tag) - - def process_print_c_typedef(self,tag): - #print(tag.c_type_name,tag.c_type_root_name) - - if tag.c_type_name=='td_void' or tag.c_type_name=='MC_VOID': - return DEFINE_SUCCESS - if tag.c_type_root_name in self.out_type_dic: - lines=[] - line='typedef %s %s;'%(tag.c_type_root_name,tag.c_type_name) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - else:#原类型还没有定义,先打印原类型 - if (tag.root_tag)==None:# TD_VOID - return DEFINE_FAIL - ret = self.print_depend_tag(tag.root_tag) - if ret!=DEFINE_SUCCESS: - return ret - return self.process_print_typedef(tag) - - def process_print_typedef(self,tag): - if self.out_type=='python': - return self.process_print_python_typedef(tag) - elif self.out_type=='c': - return self.process_print_c_typedef(tag) - - def process_print_python_member(self,tag): - if tag.member_type_tag==None: - return (DEFINE_FAIL,[]) - - if tag.member_array_tag: - - tmp=r'%s'%(self.get_c_type_name(tag.member_type_tag)) - for val in tag.member_array_tag.var_array[::-1]: - tmp=r'(%s*%d)'%(tmp,val) - line=r"('%s', %s),"%(tag.member_name,tmp) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - elif tag.member_bit_size: - line=r"('%s', %s,%d),"%(tag.member_name,self.get_c_type_name(tag.member_type_tag),tag.member_bit_size) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - else: - line=r"('%s', %s),"%(tag.member_name,self.get_c_type_name(tag.member_type_tag)) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - - def process_print_c_member(self,tag): - if tag.member_type_tag==None: - return (DEFINE_FAIL,[]) - - if tag.member_array_tag: - tmp=r'%s %s'%(self.get_c_type_name(tag.member_type_tag),tag.member_name) - for val in tag.member_array_tag.var_array: - tmp=r'%s[%d]'%(tmp,val) - line=r"%s;"%(tmp) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - elif tag.member_bit_size: - line=r"%s %s:%d;"%(self.get_c_type_name(tag.member_type_tag),tag.member_name,tag.member_bit_size) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - else: - line=r"%s %s;"%(self.get_c_type_name(tag.member_type_tag),tag.member_name) - ret = self.print_depend_tag(tag.member_type_tag) - return (ret,line) - - def process_print_member(self,tag): - if self.out_type=='python': - return self.process_print_python_member(tag) - elif self.out_type=='c': - return self.process_print_c_member(tag) - - def get_c_type_name(self,tag): - return tag.c_type_name - - def process_print_python_structure_type(self,tag): - lines=[] - line="class %s(Structure):"%(self.get_c_type_name(tag)) - if self.get_c_type_name(tag)=='tskTaskControlBlock' and not tag.son_tag_list: - return DEFINE_SUCCESS - if self.get_c_type_name(tag)=='QueueDefinition' and not tag.son_tag_list: - return DEFINE_SUCCESS - if tag.c_type_name in self.out_type_dic: - return DEFINE_SUCCESS - lines.append(line) - line=self.append_space('_fields_ = [',4) - lines.append(line) - - for son in tag.son_tag_list: - if son.type_str=='DW_TAG_member': - (ret,line)=self.process_print_member(son) - if ret!= DEFINE_SUCCESS: - return ret - line=self.append_space(line,8) - lines.append(line) - - line=self.append_space(']',4) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - - def process_print_c_structure_type(self,tag): - lines=[] - line="typedef struct {" - lines.append(line) - - for son in tag.son_tag_list: - if son.type_str=='DW_TAG_member': - (ret,line)=self.process_print_member(son) - if ret!= DEFINE_SUCCESS: - return ret - line=self.append_space(line,4) - lines.append(line) - - line=self.append_space('}%s;'%(self.get_c_type_name(tag)),0) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - - def process_print_structure_type(self,tag): - if self.out_type=='python': - return self.process_print_python_structure_type(tag) - elif self.out_type=='c': - return self.process_print_c_structure_type(tag) - - def process_print_python_union_type(self,tag): - lines=[] - line="class %s(Union):"%(self.get_c_type_name(tag)) - lines.append(line) - line=self.append_space('_fields_ = [',4) - lines.append(line) - - for son in tag.son_tag_list: - if son.type_str=='DW_TAG_member': - (ret,line)=self.process_print_member(son) - if ret!= DEFINE_SUCCESS: - return ret - line=self.append_space(line,8) - lines.append(line) - - line=self.append_space(']',4) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - - def process_print_c_union_type(self,tag): - lines=[] - line="typedef union {" - lines.append(line) - for son in tag.son_tag_list: - if son.type_str=='DW_TAG_member': - (ret,line)=self.process_print_member(son) - if ret!= DEFINE_SUCCESS: - return ret - line=self.append_space(line,4) - lines.append(line) - - line=self.append_space('}%s;'%(self.get_c_type_name(tag)),0) - lines.append(line) - self.print_tag_2_class(tag,lines) - self.out_type_dic[tag.c_type_name] = True - return DEFINE_SUCCESS - - def process_print_union_type(self,tag): - if self.out_type=='python': - return self.process_print_python_union_type(tag) - elif self.out_type=='c': - return self.process_print_c_union_type(tag) - - def print_tag(self,tag): - ret=DEFINE_SUCCESS - if self.get_c_type_name(tag)!='tskTaskControlBlock' and self.get_c_type_name(tag)!='QueueDefinition' and tag.c_type_name in self.out_type_dic: - return DEFINE_SUCCESS - if tag.type_str == "DW_TAG_enumeration_type": - ret = self.process_print_enumeration_type(tag) - elif tag.type_str == "DW_TAG_typedef": - ret = self.process_print_typedef(tag) - elif tag.type_str == "DW_TAG_structure_type": - ret = self.process_print_structure_type(tag) - elif tag.type_str == "DW_TAG_union_type": - ret = self.process_print_union_type(tag) - else: - return DEFINE_FAIL - return ret - - def print_depend_tag(self,tag): - #print("depend=",tag.entry_str) - ret = self.print_tag(tag) - if ret!=DEFINE_SUCCESS: - pass - else: - pass - return ret - - def print_enter_tag(self,tag): - #print('enter=',tag.entry_str) - ret = self.print_tag(tag) - if ret!=DEFINE_SUCCESS: - pass - else: - pass - return ret - - def process_phase2(self,out_file,language,type_name_list): - _g_parse_ctrl.out_type=language - self.out_type_dic={} - print("out_file:") - print(out_file) - with open(out_file,'w+') as fp: - _g_parse_ctrl.class_fd = fp - self.print_root_basic_type(_g_parse_ctrl.class_fd) - process_list = ['DW_TAG_structure_type', - 'DW_TAG_enumeration_type', - 'DW_TAG_typedef', - 'DW_TAG_pointer_type', - 'DW_TAG_union_type', - ] - for tag in self.tag_list: - if tag.level!=1: - continue - if tag.type_str not in process_list: - continue - if type_name_list!=None and (tag.c_type_name not in type_name_list): - continue - self.print_enter_tag(tag) - - def print_var_array(self,bin,type_tag): - pass - - def print_var_type(self,bin,type_tag): - tag = type_tag.root_tag - print(tag.entry_str) - if tag.type_str=='DW_TAG_union_type': - pass - - def print_g_var(self,var_name): - tag=None - arry_tag=None - if var_name in self.var_symbol_dic: - tag = self.var_symbol_dic[var_name] - if tag==None: - return - - if tag.member_array_tag: - arry_tag=tag.member_array_tag - for x in arry_tag.var_array: - print(x) - - bin = bytearray(108) - self.print_var_type(bin,tag.member_type_tag) - print(tag.at_name) - - def process_phase_0(self,file): - """读取debug info file,生成通用tag信息 - Args - file: debug info file路径 - return - """ - if self.parse_debug_info_phase_0==True: - return - with open(file,'r') as fp: - lines=fp.readlines() - self.parse_debug_info_lines(lines) - self.parse_debug_info_phase_0=True - - def parase_debug_types(self, line, sign): - if('Compilation Unit' in line): - result = line.split(' ') - sign.sign_entry = int(result[4][:-1],16) - if('Signature:' in line): - result = line.split(':') - sign.signature = result[1].strip() - if('Type Offset:' in line): - result = line.split(':') - sign.sign_entry += int(result[1].strip(), 16) - self.sign_entry_by_id[sign.signature] = '{:08X}'.format(sign.sign_entry + int('0x10000000', 16)) - sign.signature = None - sign.sign_entry = 0 - def parse_debug_info_lines(self,lines): - pass_st_lines=['application.elf','wstp.elf','tstp.elf','bt.elf','Contents of the','Compilation Unit', - 'Length:','Version:','Abbrev Offset:','Pointer Size:', 'Signature', 'Type Offset','$'] - - tag = None - new_lines = [] - sign = Signature() - for line in lines: - line = line.strip(); - if('debug_types' in line): - _g_parse_ctrl.debug_type = True - if('debug_info' in line): - _g_parse_ctrl.debug_type = False - if _g_parse_ctrl.debug_type: - self.parase_debug_types(line, sign) - if(self.match_line_list(line,pass_st_lines)): - continue - if re.match('[<]\w+[>][<]\w+[>]:',line):#tag start line - if tag: - _g_parse_ctrl.append_tag(tag) - tag = Tag() - self.parase_debug_info_tag_start_line(line,tag) - else: - self.parase_debug_info_tag_other_line(line,tag) - _g_parse_ctrl.append_tag(tag) - - def parase_debug_info_tag_start_line(self,line,tag): - result = re.findall(r'[<](.*?)[>]',line)#取<>中的数据 - tag.level_str = result[0] - if _g_parse_ctrl.debug_type == True: - tag.entry_str = '{:08X}'.format(int(result[1], 16) + int('0x10000000', 16)) - else: - tag.entry_str = result[1] - tag.level = int(tag.level_str,10) - result = re.findall(r'[(](.*?)[)]', line)#取()中的数据 - if(result): - tag.type_str = result[0] - _g_parse_ctrl.stat_add_tag_type(tag) - - def parase_debug_info_tag_other_line(self,line,tag): - attr = Attribute(); - result = re.findall(r'^[<](.*?)[>]',line)#取第一个<>中的数据 - # attr.entry_str = result[0] - if _g_parse_ctrl.debug_type == True: - attr.entry_str = '{:08X}'.format(int(result[0], 16) + int('0x10000000', 16)) - else: - attr.entry_str = result[0] - result = re.findall('DW_AT_\w+',line)#取DW_AT_xxx - attr.type_str = result[0] - result = re.findall('DW_AT_\w+\s*:([\s,\S]*)',line) - attr.val_attr = result[0].strip() - if attr.type_str == "DW_AT_type" and _g_parse_ctrl.debug_type == True: - result = re.findall('[<]([\w\s]+)[>]$', attr.val_attr.strip()) - if result != []: - entry_str = result[0][2:] - attr.val_attr = '<0x{:08X}>'.format(int(entry_str, 16) + int('0x10000000', 16)) - _g_parse_ctrl.stat_add_attr_type(attr) - tag.at_list[attr.type_str]=attr - - def match_line_list(self,line,mach_list): - for x in mach_list: - if re.match(x,line): - return True - return False - - def parse_nm_file(self,file,dic): - """生成symbol字典 - Args - file: nm file路径 - dic:symbol字典 - return - """ - if self.symbol_dic_init==True: - return - with open(file,'r') as fp: - lines=fp.readlines() - for line in lines: - line=line.strip() - if len(line)==0: - continue - list = line.split('|') - if len(list)!=7: - continue - - sysmbol = Sysmbol() - sysmbol.key_name = list[0].strip() - sysmbol.addr = int(list[1].strip(),16) - sysmbol.class_type = list[2].strip() - sysmbol.type = list[3].strip() - if len(list[4].strip()): - sysmbol.size = int(list[4].strip(),16) - sysmbol.section = list[6].strip() - sysmbol.guess_size=0 - - dic[sysmbol.key_name] = sysmbol - if sysmbol.size: - pass - else: - pass - self.symbol_dic_init = True - -def tag_cmn_attr_process(tag): - if 'DW_AT_type' in tag.at_list: - str = tag.at_list['DW_AT_type'].val_attr.strip() - result = re.search('[<](\w*)[>]',str) - input("yyyyyyyy") - -def tag_process_variable(tag): - if 'DW_AT_name' in tag.at_list: - str = tag.at_list['DW_AT_name'].val_attr - result = re.search('\w+$',str) - tag.at_name=result[0] - - if 'DW_AT_location' in tag.at_list: - str = tag.at_list['DW_AT_location'].val_attr - result=re.findall(r'DW_OP_addr:\s*(\w*)',str) - if result: - tag.op_addr=int(result[0],16) - -def _parse_get_symbol_info(var_name): - if var_name not in _g_parse_ctrl.symbol_dic: - return None - return _g_parse_ctrl.symbol_dic[var_name] - -def _parse_get_u32_symbol_val(name): - addr = parse_get_symbol_addr(name) - obj=parse_memory_2_class(addr,c_uint,4) - addr=obj.value - return addr - -def _parse_get_symbol_addr(var_name): - symbol=parse_get_symbol_info(var_name) - if symbol==None: - return None - return symbol.addr - -def _parse_addr_2_function_name(addr): - for key in _g_parse_ctrl.symbol_dic: - symbol = _g_parse_ctrl.symbol_dic[key] - if symbol.type=='FUNC' and symbol.addr==addr: - return symbol.key_name - return None - -def _parse_addr_in_2_function_name(addr): - for key in _g_parse_ctrl.symbol_dic: - symbol = _g_parse_ctrl.symbol_dic[key] - size = symbol.size if symbol.size!=None else symbol.guess_size - if symbol.type=='FUNC' and addr>=symbol.addr and addr < (symbol.addr+size): - return symbol.key_name - return None - -def get_array_and_type_info(tag,member_tag): - entry_str = _g_parse_ctrl.get_at_type(tag) - if entry_str == None: - member_tag.member_type_tag=None#不支持 - return - new_tag = _g_parse_ctrl.get_tag_by_entry_name(entry_str) - if new_tag.type_str=='DW_TAG_array_type': - member_tag.member_array_tag = new_tag - elif new_tag.type_str=='DW_TAG_volatile_type' or new_tag.type_str=='DW_TAG_const_type': - pass - elif new_tag.type_str=='DW_TAG_typedef': - member_tag.member_type_tag = new_tag - elif (new_tag.type_str=='DW_TAG_base_type' - or new_tag.type_str=='DW_TAG_structure_type' - or new_tag.type_str=='DW_TAG_enumeration_type' - or new_tag.type_str=='DW_TAG_pointer_type' - or new_tag.type_str=='DW_TAG_union_type' ): - member_tag.member_type_tag = new_tag - elif new_tag.type_str=='DW_TAG_class_type': - member_tag.member_type_tag=None#不支持 - return - else: - print("[ASSERT][LINE=%d]"%(sys._getframe().f_lineno),member_tag.entry_str) - assert(False) - - if member_tag.member_type_tag==None: - get_array_and_type_info(member_tag,new_tag) - -def _traverse_g_var(global_file): - temp_dic_a={} - temp_dic_b={} - with open(global_file, "w+") as var_fp: - for key in _g_parse_ctrl.symbol_dic: - symbol = _g_parse_ctrl.symbol_dic[key] - if symbol.type=='OBJECT': - temp_dic_a[symbol.key_name]=1 - pass - - for tag in _g_parse_ctrl.tag_list: - if tag.type_str!='DW_TAG_variable': - continue - if tag.level!=1: - continue - at_name=_g_parse_ctrl.get_at_name(tag) - if at_name not in _g_parse_ctrl.symbol_dic: - continue - get_array_and_type_info(tag,tag) - if(tag.member_array_tag): - _g_parse_ctrl.process_phase_array_type(tag.member_array_tag) - if(tag.member_array_tag and tag.member_type_tag): - print("%s|0x%x|%s|%s|"%(at_name,_g_parse_ctrl.symbol_dic[at_name].addr,_g_parse_ctrl.symbol_dic[at_name].size,tag.member_type_tag.c_type_name),tag.member_array_tag.var_array,file=var_fp) - elif (tag.member_type_tag): - print("%s|0x%x|%s|%s"%(at_name,_g_parse_ctrl.symbol_dic[at_name].addr,_g_parse_ctrl.symbol_dic[at_name].size,tag.member_type_tag.c_type_name),file=var_fp) - else: - print("%s|0x%x|%s|%s"%(at_name,_g_parse_ctrl.symbol_dic[at_name].addr,_g_parse_ctrl.symbol_dic[at_name].size,''), file=var_fp) - -def parse_elf_step_1(debug_info_file,out_class_file,out_ctype_file,nm_file,global_file,diag_dir,xml_file): - type_name_list = parse_tools_xml(xml_file, debug_info_file, diag_dir) - _g_parse_ctrl.parse_nm_file(nm_file,_g_parse_ctrl.symbol_dic) - _g_parse_ctrl.process_phase_0(debug_info_file) - _g_parse_ctrl.process_phase1() - _g_parse_ctrl.process_phase2(out_class_file,'python',None) - _g_parse_ctrl.process_phase2(out_ctype_file,'c',type_name_list) - _traverse_g_var(global_file) - uapi_register_function('get_symbol_info',_parse_get_symbol_info) - uapi_register_function('get_u32_symbol_val',_parse_get_u32_symbol_val) - uapi_register_function('get_symbol_addr',_parse_get_symbol_addr) - uapi_register_function('addr_2_function_name',_parse_addr_2_function_name) - uapi_register_function('addr_in_2_function_name',_parse_addr_in_2_function_name) - -def parse_elf_step_2(nm_file): - _g_parse_ctrl.parse_nm_file(nm_file,_g_parse_ctrl.symbol_dic) - uapi_register_function('get_symbol_info',_parse_get_symbol_info) - uapi_register_function('get_u32_symbol_val',_parse_get_u32_symbol_val) - uapi_register_function('get_symbol_addr',_parse_get_symbol_addr) - uapi_register_function('addr_2_function_name',_parse_addr_2_function_name) - uapi_register_function('addr_in_2_function_name',_parse_addr_in_2_function_name) - -_g_parse_ctrl = ParseCtrl() - - diff --git a/build/script/parse_tool/parse_freertos.py b/build/script/parse_tool/parse_freertos.py deleted file mode 100755 index 51a2cd2..0000000 --- a/build/script/parse_tool/parse_freertos.py +++ /dev/null @@ -1,463 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_basic import * -from auto_class import * -from config import * - -OS_TASK_STATUS_UNUSED = 0x0001 -OS_TASK_STATUS_SUSPEND = 0x0002 -OS_TASK_STATUS_READY = 0x0004 -OS_TASK_STATUS_PEND = 0x0008 -OS_TASK_STATUS_RUNNING = 0x0010 -OS_TASK_STATUS_DELAY = 0x0020 -OS_TASK_STATUS_TIMEOUT = 0x0040 -OS_TASK_STATUS_PEND_TIME = 0x0080 -OS_TASK_FLAG_DETACHED = 0x0001 -OS_TASK_FLAG_SYSTEM = 0x0002 -OS_SWTMR_STATUS_UNUSED = 0 -OS_SWTMR_STATUS_DELETING =1 -OS_SWTMR_STATUS_CREATED=2 -OS_SWTMR_STATUS_TICKING=3 -queueQUEUE_TYPE_BASE=0 -queueQUEUE_TYPE_SET=0 -queueQUEUE_TYPE_MUTEX=1 -queueQUEUE_TYPE_COUNTING_SEMAPHORE=2 -queueQUEUE_TYPE_BINARY_SEMAPHORE=3 -queueQUEUE_TYPE_RECURSIVE_MUTEX=4 -CONTEXT_OFFSET=4 * 4 + 33 * 4 -#ctypes.addressof(parameter) - ctypes.addressof(parent_structure) - - -def _los_List_get_all_node(list_addr): - node_list=[] - node=parse_memory_2_class(list_addr,LOS_DL_LIST,sizeof(LOS_DL_LIST)) - while node.pstNext!=list_addr: - node_list.append(node.pstNext) - node = parse_memory_2_class(node.pstNext,LOS_DL_LIST,sizeof(LOS_DL_LIST)) - return (DEFINE_SUCCESS,node_list) - -def _addr_in_2_function_name(addr): - name=parse_addr_in_2_function_name(addr) - if name==None: - return hex(addr) - else: - return name - -class _PhaseFreertosCtrl: - def __init__(self): - self.core=None - self.info_fd = sys.__stdout__ - self.task_cnt=None - self.tcb_array = [] - self.ext_task_list=[] - self.ext_taskstatus_list=[] ##freertos - - self.heap_start = None - self.heap_end = None - self.heap_head = None - self.queue_cnt = configQUEUE_REGISTRY_SIZE - self.queue_array=[] - self.queue_ext_info=[] - self.timer_cnt = 0 - self.timer_array=[] - self.timer_ext_info=[] - #self.sem_cnt=LOSCFG_BASE_IPC_SEM_LIMIT - #self.sem_array=[] - self.sem_ext_info=[] - - self.excInfo=None - - self.isr_ext_info=None - - class _ExtPercpu: - def __init__(self): - self.handle_addr = None - self.per_cpu=None - self.g_tickCount=None - self.g_sysClock=None - self.g_tickPerSecond=None - self.g_cycle2NsScale=None - self.task_wait_addr=[] - self.timer_wait_addr=[] - self.g_intCount=None - - class _ExtTaskInfo: - def __init__(self): - self.handle_addr=None - self.pend_addr=None - self.name='unknown' - self.buttom=0 - self.peek_used=0 - self.over=0 - self.status_str=None - self.enter_name = 'unknown' - self.task_context = None - self.take_sem = None - - class _ExtTaskStatus: - def __init__(self): - self.xHandle=None - self.pcTaskName='unknown' - self.xTaskNumber=0 - self.eCurrentState=0 - self.uxCurrentPriority=0 - self.uxBasePriority=0 - self.ulRunTimeCounter=0 - self.pxStackBase = None - self.usStackHighWaterMark = 0 - - class _ExtTimerInfo: - def __init__(self): - self.handle_addr=None - self.func_name=None - - class _ExtSemInfo: - def __init__(self): - self.handle_addr=None - self.pend_task_list=[] - - class _ExtQueueInfo: - def __init__(self): - self.handle_addr=None - self.pend_read_task_list = [] - self.pend_write_task_list =[] - - class ExtIsrInfo: - def __init__(self): - self.isr_cnt = configHWI_MAX_VECTOR_CNT - self.pxAddr=None - self.pxHwiHandles_list = [] - - def make_isr_info(self): - self.isr_ext_info = self.ExtIsrInfo() - addr = parse_get_symbol_addr('pxHwiHandles') - self.isr_ext_info.pxAddr = parse_memory_2_class(addr,(uint32_t)*self.isr_ext_info.isr_cnt,sizeof((uint32_t)*self.isr_ext_info.isr_cnt)) - for temp_addr in self.isr_ext_info.pxAddr: - if temp_addr!=0: - pxHwiHandles = parse_memory_2_class(temp_addr, HwiHandle_t, sizeof(HwiHandle_t)) - self.isr_ext_info.pxHwiHandles_list.append(pxHwiHandles) - - - def print_isr_info(self): - print("\r\n---------------------content of 中断信息:---------------------",file=self.info_fd) - for hwi in self.isr_ext_info.pxHwiHandles_list: - if hwi.pxCb!=0 or hwi.xCounts!=0: - print("%s[0x%x][call_cnt=%d]"%(_addr_in_2_function_name(hwi.pxCb),hwi.pxCb,hwi.xCounts),file=self.info_fd) - print("",file=self.info_fd) - - def _make_task_info(self,pxList): - pxCurrentTCB = parse_get_symbol_addr('pxCurrentTCB') - if pxList.uxNumberOfItems > 0: - num = 0 - while num < pxList.uxNumberOfItems: - next_item = parse_memory_2_class(pxList.pxIndex, ListItem_t, sizeof(ListItem_t)) - if not next_item: - break - pxList.pxIndex = next_item.pxNext - pxTCB = parse_memory_2_class(next_item.pvOwner, TCB_t, sizeof(TCB_t)) - if pxTCB: - taskstatus = self._ExtTaskStatus() - taskstatus.xHandle = next_item.pvOwner - taskstatus.pcTaskName = pxTCB.pcTaskName - taskstatus.xTaskNumber = pxTCB.uxTCBNumber - if (next_item.pvOwner == pxCurrentTCB): - taskstatus.eCurrentState = 0 - else: - taskstatus.eCurrentState = 1 - taskstatus.uxCurrentPriority = pxTCB.uxPriority - taskstatus.uxBasePriority = pxTCB.uxBasePriority - #taskstatus.ulRunTimeCounter = pxTCB.ulRunTimeCounter - taskstatus.pxStackBase = pxTCB.pxStack - self.ext_taskstatus_list.append(taskstatus) - self.tcb_array.append(pxTCB) - num = num + 1 - - def make_all_task_info(self): - addr = parse_get_symbol_addr('uxCurrentNumberOfTasks') - obj=parse_memory_2_class(addr,c_uint,4) - self.task_cnt = obj.value - addr = parse_get_symbol_addr('pxReadyTasksLists') - pxReadyLists=parse_memory_2_class(addr, List_t*configMAX_PRIORITIES, sizeof(List_t)*configMAX_PRIORITIES) - for pxList in pxReadyLists: - self._make_task_info(pxList) - TaskListName = ['xDelayedTaskList1', 'xDelayedTaskList2', 'xPendingReadyList', 'xTasksWaitingTermination', 'xSuspendedTaskList'] - for tasklist_name in TaskListName: - addr = parse_get_symbol_addr(tasklist_name) - pxList = parse_memory_2_class(addr, List_t, sizeof(List_t)) - self._make_task_info(pxList) - - - - def _task_status_2_string(self,status): - str='' - if (status&OS_TASK_STATUS_UNUSED): - str=str+"unused," - if (status&OS_TASK_STATUS_RUNNING): - str=str+'runing,' - if (status&OS_TASK_STATUS_READY): - str=str+'ready,' - if (status&OS_TASK_STATUS_SUSPEND): - str=str+'suspend,' - if (status&OS_TASK_STATUS_PEND): - str=str+'pend,' - if (status&OS_TASK_STATUS_DELAY): - str=str+'delay,' - if (status&OS_TASK_STATUS_TIMEOUT): - str=str+'timeout,' - if (status&OS_TASK_STATUS_PEND_TIME): - str=str+'pendtime,' - return str - - def _make_task_extra_info(self): - i=0 - while i < self.task_cnt: - tcb = self.tcb_array[i] - ext_info=self.ext_task_list[i] - if tcb.taskStatus & OS_TASK_STATUS_UNUSED: #未使用任务返回 - i=i+1 - continue; - - ext_info.buttom = tcb.topOfStack+tcb.stackSize #计算栈buttom - ext_info.status_str = self._task_status_2_string(tcb.taskStatus) - if tcb.taskSem!=0: - ext_info.take_sem = parse_memory_2_class(tcb.taskSem,LosSemCB,sizeof(LosSemCB)) - - #生成taskname - addr=tcb.taskName - str = parse_memory_2_string(addr,32) - if str!=None: - ext_info.name=str - - #判断栈是否溢出 - obj = parse_memory_2_class(tcb.topOfStack,c_uint,sizeof(c_uint)) - if obj.value==0xCCCCCCCC: - ext_info.over=0 - else: - ext_info.over=1 - - #计算栈峰值 - addr = tcb.topOfStack+4 - while addr < ext_info.buttom: - obj = parse_memory_2_class(addr,c_uint,sizeof(c_uint)) - if obj.value != 0xCACACACA: - break - addr+=4 - ext_info.peek_used = ext_info.buttom-addr - - enter_name=parse_addr_2_function_name(tcb.taskEntry) - if enter_name!=None: - ext_info.enter_name = enter_name - - ext_info.task_context=parse_memory_2_class(tcb.stackPointer,TaskContext,sizeof(TaskContext)) - i=i+1 - - def print_task_short_info(self): - print("\r\n--------------------content of 任务信息摘要:--------------------",file=self.info_fd) - print('%4s|%20s|%4s|%10s|%10s|%s|%10s'%('xHandle','TaskName','xTaskNumber','eCurrentState','CurrentPriority','BasePriority','StackBase'),file=self.info_fd) - for taskstatus in self.ext_taskstatus_list: - print('0x%08x|%20s|%4d|%4d|0x%08x|0x%08x|0x%08x' - %(taskstatus.xHandle,taskstatus.pcTaskName,taskstatus.xTaskNumber,taskstatus.eCurrentState,taskstatus.uxCurrentPriority,taskstatus.uxBasePriority,taskstatus.pxStackBase),file=self.info_fd) - - def print_task_detail_info(self): - print("\r\n--------------------content of 任务详细信息:--------------------",file=self.info_fd) - print("说明:tcb任务控制块信息,context:任务上下文的寄存器信息,backtrace 栈回溯",file=self.info_fd) - for tcb in self.tcb_array: - print('',file=self.info_fd) - uapi_print_ctypes_obj('tcb',tcb,self.info_fd) - ext_info = parse_memory_2_class(tcb.pxTopOfStack+CONTEXT_OFFSET,exc_context_freertos_t,sizeof(exc_context_freertos_t)) - #打印寄存器信息 - print("[TASK]%s 寄存器:"%(tcb.pcTaskName),file=self.info_fd) - uapi_print_ctypes_obj('context',ext_info,self.info_fd) - - #打印back_trace - print("[TASK]%s back trace..."%(tcb.pcTaskName)) - print("[TASK]%s 栈回溯:"%(tcb.pcTaskName),file=self.info_fd) - sp = tcb.pxTopOfStack+CONTEXT_OFFSET - self.stack_back_trace(tcb.pxStack, sp) - #print("[TASK]%s 其它状态:"%(ext_info.name),file=self.info_fd) - - - def make_queue_info(self): - addr = parse_get_symbol_addr('xQueueRegistry') - i=0 - while i< self.queue_cnt: - obj=parse_memory_2_class(addr,QueueRegistryItem_t,sizeof(QueueRegistryItem_t)) - if obj: - queue_item=parse_memory_2_class(obj.xHandle,Queue_t,sizeof(Queue_t)) - self.queue_array.append(queue_item) - addr=addr+sizeof(QueueRegistryItem_t) - i=i+1 - - - def print_queue_info(self): - print("\r\n--------------------content of 消息队列信息:--------------------",file=self.info_fd) - print("说明:queueName队列名字,queueHandle队列的内存空间, queueType队列类型, queueLen队列长度, queueItemSize每个节点大小,queueUsed已用节点个数, queueAvailable剩余节点个数",file=self.info_fd) - i=0 - for queue in self.queue_array: - if queue!=None: - if queue.ucQueueType == queueQUEUE_TYPE_BASE: - uapi_print_ctypes_obj('queue',queue,self.info_fd) - print("",file=self.info_fd) - i=i+1 - print("",file=self.info_fd) - - def make_timer_info(self): - pxaddr = parse_get_u32_symbol_val('pxCurrentTimerList') - addrList = parse_memory_2_class(pxaddr, uint32_t, sizeof(uint32_t)) - if addrList: - pxList=parse_memory_2_class(addrList.value, List_t, sizeof(List_t)) - if pxList != None: - if pxList.uxNumberOfItems > 0: - while self.timer_cnt < pxList.uxNumberOfItems: - next_item = parse_memory_2_class(pxList.pxIndex, ListItem_t, sizeof(ListItem_t)) - pxList.pxIndex = next_item.pxNext - obj = parse_memory_2_class(next_item.pvOwner, Timer_t, sizeof(Timer_t)) - self.timer_array.append(obj) - self.timer_cnt = self.timer_cnt + 1 - - - def print_timer_info(self): - print("---------------------content of 定时器信息:---------------------",file=self.info_fd) - print("说明:SwTmr_Used定时器个数;SwTmr_Total定时器个数上限;timer_id定时器id;pxCallbackFunction回调函数的地址;xTimerPeriodInTicks调用周期;ucStatus(1:ACTIVE 2:STATICALLY_ALLOCATED 3:AUTORELOAD)",file=self.info_fd) - print("SwTmr_Used=%d, SwTmr_Total=unlimited"%(self.timer_cnt),file=self.info_fd) - i=0 - while i< self.timer_cnt: - timer=self.timer_array[i] - print("timer_id=%d %s[0x%x]"%(timer.pvTimerID,_addr_in_2_function_name(timer.pxCallbackFunction),timer.pxCallbackFunction),file=self.info_fd) - uapi_print_ctypes_obj('timer',timer,self.info_fd) - print('',file=self.info_fd) - i=i+1 - print("",file=self.info_fd) - - def _make_sem_extra_info(self): - i=0 - while i< self.sem_cnt: - sem=self.sem_array[i] - ext_info=self.sem_ext_info[i] - if sem.semStat==1: #used - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('semList',LosSemCB)) - for node_addr in addr_list: - ext_info.pend_task_list.append(node_addr) - i=i+1 - - def make_sem_info(self): - addr = parse_get_u32_symbol_val('g_osAllSem') - i=0 - while i< self.sem_cnt: - ext_info=self._ExtSemInfo() - obj=parse_memory_2_class(addr,LosSemCB,sizeof(LosSemCB)) - ext_info.handle_addr=addr - self.sem_array.append(obj) - self.sem_ext_info.append(ext_info) - addr=addr+sizeof(LosSemCB) - i=i+1 - self._make_sem_extra_info() - - def get_pending_task(self,addr_list): - list=[] - for addr in addr_list: - i=0 - while i < self.task_cnt: - ext_task = self.ext_task_list[i] - tcb = self.tcb_array[i] - if addr== ext_task.pend_addr: - list.append(tcb.taskId) - i=i+1 - return list - - def print_sem_info(self): - print("--------------------content of 信号量:--------------------",file=self.info_fd) - print("说明:SemName信号量名字,SemHandle信号量的地址, MaxCount信号量最大个数, Count已用个数",file=self.info_fd) - i=0 - for queue in self.queue_array: - if queue!=None: - if queue.ucQueueType==queueQUEUE_TYPE_COUNTING_SEMAPHORE or queue.ucQueueType==queueQUEUE_TYPE_BINARY_SEMAPHORE or queue.ucQueueType==queueQUEUE_TYPE_RECURSIVE_MUTEX: - uapi_print_ctypes_obj('Sem',queue,self.info_fd) - print("",file=self.info_fd) - i=i+1 - print("",file=self.info_fd) - - def make_crash_info(self): - addr = parse_get_symbol_addr('g_exc_buff_addr') - self.excInfo = parse_memory_2_class(addr,exc_context_t,sizeof(exc_context_t)) - - def print_crash_info(self): - print("--------------------content of 死机信息:--------------------",file=self.info_fd) - uapi_print_ctypes_obj('g_exc_buff_addr',self.excInfo,self.info_fd) - self.stack_back_trace(self.excInfo.task_context.sp+sizeof(task_context_t),self.excInfo.task_context.sp+0x1000) - - def stack_back_trace(self,start_addr,end_addr): - sp=start_addr - while sp < end_addr: - obj=parse_memory_2_class(sp,c_uint,sizeof(c_uint)) - name = parse_addr_in_2_function_name(obj.value-4) - if name: - print("[BACK Trace][addr=0x%08x][val=0x%08x]%s"%(sp,obj.value,name),file=self.info_fd) - else: - pass - #print("[BACK Trace][addr=0x%08x][val=0x%08x]"%(sp,obj.value),file=self.info_fd) - - sp=sp+4 - -_g_parse_freertos_ctrl=_PhaseFreertosCtrl() -def make_freertos_info(): - try: - _g_parse_freertos_ctrl.make_all_task_info() - except: - print("[EXCEPTION]make_all_task_info fail.") - try: - _g_parse_freertos_ctrl.make_queue_info() - except: - print("[EXCEPTION]make_queue_info fail.") - try: - _g_parse_freertos_ctrl.make_timer_info() - except: - print("[EXCEPTION]make_timer_info fail.") - try: - _g_parse_freertos_ctrl.make_crash_info() - except: - print("[EXCEPTION]make_crash_info fail.") - try: - _g_parse_freertos_ctrl.make_isr_info() - except: - print("[EXCEPTION]make_isr_info fail.") - -def print_freertos_info(): - try: - _g_parse_freertos_ctrl.print_isr_info() - except: - print("[EXCEPTION]print_isr_info fail.") - try: - _g_parse_freertos_ctrl.print_queue_info() - except: - print("[EXCEPTION]print_queue_info fail.") - try: - _g_parse_freertos_ctrl.print_timer_info() - except: - print("[EXCEPTION]print_timer_info fail.") - try: - _g_parse_freertos_ctrl.print_sem_info() - except: - print("[EXCEPTION]print_sem_info fail.") - try: - _g_parse_freertos_ctrl.print_task_short_info() - except: - print("[EXCEPTION]print_task_short_info fail.") - try: - _g_parse_freertos_ctrl.print_task_detail_info() - except: - print("[EXCEPTION]print_task_detail_info fail.") - try: - _g_parse_freertos_ctrl.print_crash_info() - except: - print("[EXCEPTION]print_crash_info fail.") - -def parse_freertos_info(log_fp): - _g_parse_freertos_ctrl.info_fd = log_fp - make_freertos_info() - print_freertos_info() - print("parse_freertos_info end!") diff --git a/build/script/parse_tool/parse_liteos.py b/build/script/parse_tool/parse_liteos.py deleted file mode 100755 index fbb44c4..0000000 --- a/build/script/parse_tool/parse_liteos.py +++ /dev/null @@ -1,761 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_basic import * -from auto_class import * -from config import * - -OS_TASK_STATUS_UNUSED = 0x0001 -OS_TASK_STATUS_SUSPEND = 0x0002 -OS_TASK_STATUS_READY = 0x0004 -OS_TASK_STATUS_PEND = 0x0008 -OS_TASK_STATUS_RUNNING = 0x0010 -OS_TASK_STATUS_DELAY = 0x0020 -OS_TASK_STATUS_TIMEOUT = 0x0040 -OS_TASK_STATUS_PEND_TIME = 0x0080 -OS_TASK_FLAG_DETACHED = 0x0001 -OS_TASK_FLAG_SYSTEM = 0x0002 -OS_SWTMR_STATUS_UNUSED = 0 -OS_SWTMR_STATUS_DELETING =1 -OS_SWTMR_STATUS_CREATED=2 -OS_SWTMR_STATUS_TICKING=3 -#ctypes.addressof(parameter) - ctypes.addressof(parent_structure) - - -def _los_List_get_all_node(list_addr): - node_list=[] - node=parse_memory_2_class(list_addr,LOS_DL_LIST,sizeof(LOS_DL_LIST)) - if node: - while node.pstNext!=list_addr: - node_list.append(node.pstNext) - node = parse_memory_2_class(node.pstNext,LOS_DL_LIST,sizeof(LOS_DL_LIST)) - return (DEFINE_SUCCESS,node_list) - -def _addr_in_2_function_name(addr): - name=parse_addr_in_2_function_name(addr) - if name==None: - return hex(addr) - else: - return name - -class _PhaseLiteosCtrl: - def __init__(self): - self.core=None - self.info_fd = sys.__stdout__ - self.task_cnt=None - self.tcb_array = [] - self.ext_task_list=[] - - self.heap_start = None - self.heap_end = None - self.heap_head = None - self.queue_cnt = LOSCFG_BASE_IPC_QUEUE_LIMIT - self.queue_array=[] - self.queue_ext_info=[] - self.timer_cnt = LOSCFG_BASE_CORE_SWTMR_LIMIT - self.timer_array=[] - self.timer_ext_info=[] - self.sem_cnt=LOSCFG_BASE_IPC_SEM_LIMIT - self.sem_array=[] - self.sem_ext_info=[] - - self.excInfo=None - - self.isr_ext_info=None - self.version=None - - class _ExtPercpu: - def __init__(self): - self.handle_addr = None - self.per_cpu=None - self.g_tickCount=None - self.g_sysClock=None - self.g_tickPerSecond=None - self.g_cycle2NsScale=None - self.task_wait_addr=[] - self.timer_wait_addr=[] - self.g_intCount=None - - class _ExtTaskInfo: - def __init__(self): - self.handle_addr=None - self.pend_addr=None - self.name='unknown' - self.buttom=0 - self.peek_used=0 - self.over=0 - self.status_str=None - self.enter_name = 'unknown' - self.task_context = None - self.take_sem = None - - class _ExtTimerInfo: - def __init__(self): - self.handle_addr=None - self.func_name=None - - class _ExtSemInfo: - def __init__(self): - self.handle_addr=None - self.pend_task_list=[] - - class _ExtQueueInfo: - def __init__(self): - self.handle_addr=None - self.pend_read_task_list = [] - self.pend_write_task_list =[] - - class ExtIsrInfo: - def __init__(self): - self.isr_cnt = LOSCFG_PLATFORM_HWI_LIMIT - self.g_hwiForm=None - - def make_isr_info(self): - self.isr_ext_info = self.ExtIsrInfo() - addr = parse_get_symbol_addr('g_hwiForm') - if self.version == 207: - self.isr_ext_info.g_hwiForm = parse_memory_2_class(addr,HwiHandleInfo*self.isr_ext_info.isr_cnt,sizeof(HwiHandleInfo*self.isr_ext_info.isr_cnt)) - elif self.version == 208: - self.isr_ext_info.g_hwiForm = parse_memory_2_class(addr,HwiHandleInfo*self.isr_ext_info.isr_cnt,sizeof(HwiHandleInfo*self.isr_ext_info.isr_cnt)) - - def print_isr_info(self): - print("\r\n--------------------content of 中断信息:--------------------",file=self.info_fd) - if self.version == 207: - for hwi in self.isr_ext_info.g_hwiForm: - if hwi.hook!=0 or hwi.respCount!=0: - print("%s[0x%x][call_cnt=%d]"%(_addr_in_2_function_name(hwi.hook),hwi.hook,hwi.respCount),file=self.info_fd) - elif self.version == 208: - for hwi in self.isr_ext_info.g_hwiForm: - if hwi.hook!=0 or hwi.respCount!=0: - print("%s[0x%x][call_cnt=%d]"%(_addr_in_2_function_name(hwi.hook),hwi.hook,hwi.respCount),file=self.info_fd) - - def make_per_cpu_info(self): - self.core=self._ExtPercpu() - self.core.handle_addr = parse_get_symbol_addr('g_percpu') - self.core.per_cpu = parse_memory_2_class(self.core.handle_addr,Percpu,sizeof(Percpu)) - - addr = parse_get_symbol_addr('g_tickCount') - if addr: - obj=parse_memory_2_class(addr,c_ulonglong,sizeof(c_ulonglong)) - self.core.g_tickCount=obj.value - - addr = parse_get_symbol_addr('g_sysClock') - if addr: - obj=parse_memory_2_class(addr,c_uint,sizeof(c_uint)) - self.core.g_sysClock=obj.value - - addr = parse_get_symbol_addr('g_intCount') - if addr: - obj=parse_memory_2_class(addr,c_uint,sizeof(c_uint)) - self.core.g_intCount=obj.value - - addr = parse_get_symbol_addr('g_tickPerSecond') - if addr: - obj=parse_memory_2_class(addr,c_uint,sizeof(c_uint)) - self.core.g_tickPerSecond=obj.value - - addr = parse_get_symbol_addr('g_cycle2NsScale') - if addr: - obj=parse_memory_2_class(addr,c_double,sizeof(c_double)) - self.core.g_cycle2NsScale=obj.value - (ret,self.core.task_wait_addr) = _los_List_get_all_node(self.core.per_cpu.taskSortLink.sortLink) - - (ret,self.core.timer_wait_addr) = _los_List_get_all_node(self.core.per_cpu.swtmrSortLink.sortLink) - - def print_per_cpu_info(self): - print("\r\n--------------------content of 调度信息汇总:--------------------",file=self.info_fd) - print("说明:taskLockCnt锁任务嵌套次数",file=self.info_fd) - if self.core.g_cycle2NsScale: - print("g_tickCount=%ull,g_sysClock=%u,g_tickPerSecond=%u,g_cycle2NsScale=%f"%(self.core.g_tickCount,self.core.g_sysClock,self.core.g_tickPerSecond,self.core.g_cycle2NsScale),file=self.info_fd) - else: - print("g_tickCount=%ull,g_sysClock=%u,g_tickPerSecond=%u"%(self.core.g_tickCount,self.core.g_sysClock,self.core.g_tickPerSecond),file=self.info_fd) - - uapi_print_ctypes_obj('schedule',self.core.per_cpu,self.info_fd) - - delay_tick=0 - for x in self.core.task_wait_addr: - x = x-ctype_member_offset('sortList.sortLinkNode',LosTaskCB) - i=0 - while i< self.task_cnt: - tcb=self.tcb_array[i] - ext_info=self.ext_task_list[i] - if ext_info.handle_addr==x: - delay_tick=delay_tick+tcb.sortList.idxRollNum - print("任务等待剩余时间:%s[%d][剩余时间 delay=%d tick][idxRollNum=%d]"%(ext_info.name,tcb.taskId,delay_tick,tcb.sortList.idxRollNum),file=self.info_fd) - i=i+1 - - delay_tick=0 - for x in self.core.timer_wait_addr: - x = x-ctype_member_offset('sortList.sortLinkNode',LosSwtmrCB) - i=0 - while i< self.timer_cnt: - timer=self.timer_array[i] - ext_info=self.timer_ext_info[i] - if ext_info.handle_addr==x: - delay_tick=delay_tick+timer.sortList.idxRollNum - print("定时器到期剩余时间:%s[%d][剩余时间=%d tick][idxRollNum=%d]"%(ext_info.func_name,timer.timerId,delay_tick,timer.sortList.idxRollNum),file=self.info_fd) - i=i+1 - - def make_task_info(self): - addr = parse_get_symbol_addr('g_taskMaxNum') - obj=parse_memory_2_class(addr,c_uint,4) - self.task_cnt = obj.value - - addr = parse_get_symbol_addr('g_osTaskCBArray') - obj=parse_memory_2_class(addr,c_uint,4) - addr=obj.value - i=0 - while i < self.task_cnt: - ext_info = self._ExtTaskInfo() - obj=parse_memory_2_class(addr,LosTaskCB,sizeof(LosTaskCB)) - self.tcb_array.append(obj) - self.ext_task_list.append(ext_info) - ext_info.handle_addr=addr - ext_info.pend_addr = ext_info.handle_addr+ctype_member_offset('pendList',LosTaskCB) - addr=addr+sizeof(LosTaskCB) - i=i+1 - self._make_task_extra_info() - - def _task_status_2_string(self,status): - str='' - if (status&OS_TASK_STATUS_UNUSED): - str=str+"unused," - if (status&OS_TASK_STATUS_RUNNING): - str=str+'runing,' - if (status&OS_TASK_STATUS_READY): - str=str+'ready,' - if (status&OS_TASK_STATUS_SUSPEND): - str=str+'suspend,' - if (status&OS_TASK_STATUS_PEND): - str=str+'pend,' - if (status&OS_TASK_STATUS_DELAY): - str=str+'delay,' - if (status&OS_TASK_STATUS_TIMEOUT): - str=str+'timeout,' - if (status&OS_TASK_STATUS_PEND_TIME): - str=str+'pendtime,' - return str - - def _make_task_extra_info(self): - i=0 - while i < self.task_cnt: - tcb = self.tcb_array[i] - ext_info=self.ext_task_list[i] - if tcb.taskStatus & OS_TASK_STATUS_UNUSED: #未使用任务返回 - i=i+1 - continue; - - ext_info.buttom = tcb.topOfStack+tcb.stackSize #计算栈buttom - ext_info.status_str = self._task_status_2_string(tcb.taskStatus) - if tcb.taskSem!=0: - ext_info.take_sem = parse_memory_2_class(tcb.taskSem,LosSemCB,sizeof(LosSemCB)) - - #生成taskname - addr=tcb.taskName - str = parse_memory_2_string(addr,32) - if str!=None: - ext_info.name=str - - #判断栈是否溢出 - obj = parse_memory_2_class(tcb.topOfStack,c_uint,sizeof(c_uint)) - if obj.value==0xCCCCCCCC: - ext_info.over=0 - else: - ext_info.over=1 - - #计算栈峰值 - addr = tcb.topOfStack+4 - while addr < ext_info.buttom: - obj = parse_memory_2_class(addr,c_uint,sizeof(c_uint)) - if obj.value != 0xCACACACA: - break - addr+=4 - ext_info.peek_used = ext_info.buttom-addr - - enter_name=parse_addr_2_function_name(tcb.taskEntry) - if enter_name!=None: - ext_info.enter_name = enter_name - if self.version == 207: - ext_info.task_context=parse_memory_2_class(tcb.stackPointer,TaskContext,sizeof(TaskContext)) - elif self.version == 208: - ext_info.task_context=parse_memory_2_class(tcb.stackPointer,TaskContext,sizeof(TaskContext)) - else: - ext_info.task_context=parse_memory_2_class(tcb.stackPointer,td_u32,sizeof(td_u32)) - i=i+1 - - def print_task_short_info(self): - print("\r\n--------------------content of 任务信息摘要:--------------------",file=self.info_fd) - print('%4s|%20s|%4s|%10s|%10s|%s|%10s|%10s|%10s|%4s|%15s|'%('id','task_name','pri','stackSize','topOfStack','ButtomOfStack','sp','cur_used','peak_used','ovf','status'),file=self.info_fd) - i=0 - while i < self.task_cnt: - tcb = self.tcb_array[i] - ext_info = self.ext_task_list[i] - if not tcb.taskStatus & OS_TASK_STATUS_UNUSED: - print('%4d|%20s|%4d|0x%08x|0x%08x|0x%08x |0x%08x|0x%08x|0x%08x|%4d|%15s|' - %(i,ext_info.name,tcb.priority,tcb.stackSize,tcb.topOfStack,ext_info.buttom,tcb.stackPointer,0,ext_info.peek_used,ext_info.over,ext_info.status_str),file=self.info_fd) - i=i+1 - - def print_task_detail_info(self): - print("\r\n--------------------content of 任务详细信息:--------------------",file=self.info_fd) - print("说明:tcb任务控制块信息,context:任务上下文的寄存器信息,backtrace 栈回溯",file=self.info_fd) - i=0 - while i < self.task_cnt: - print('',file=self.info_fd) - tcb = self.tcb_array[i] - uapi_print_ctypes_obj('tcb',tcb,self.info_fd) - ext_info = self.ext_task_list[i] - i=i+1 - if tcb.taskStatus & OS_TASK_STATUS_UNUSED: - continue - #打印寄存器信息 - print("[TASK]%s 寄存器:"%(ext_info.name),file=self.info_fd) - uapi_print_ctypes_obj('context',ext_info.task_context,self.info_fd) - - #打印back_trace - print("[TASK]%s 栈回溯:"%(ext_info.name),file=self.info_fd) - if self.version == 207: - sp = tcb.stackPointer+sizeof(TaskContext) - elif self.version == 208: - sp = tcb.stackPointer+sizeof(TaskContext) - else: - sp = tcb.stackPointer - self.stack_back_trace(sp,tcb.topOfStack + tcb.stackSize) - print("[TASK]%s 其它状态:"%(ext_info.name),file=self.info_fd) - if ext_info.take_sem: - print("[waitting_sem][id=0x%08x]"%(ext_info.take_sem.semId),file=self.info_fd) - - def make_heap_info(self): - addr = parse_get_symbol_addr('m_aucSysMem0') - obj=parse_memory_2_class(addr,c_uint,4) - self.heap_start=obj.value - if self.version == 207: - self.heap_head=parse_memory_2_class(self.heap_start,LosMemPoolInfo,sizeof(LosMemPoolInfo)) - if self.heap_head: - self.heap_end = self.heap_start + self.heap_head.size - elif self.version == 208: - self.heap_head=parse_memory_2_class(self.heap_start,LosMemPoolInfo,sizeof(LosMemPoolInfo)) - if self.heap_head: - self.heap_end = self.heap_start + self.heap_head.size - - - def print_heap_info(self): - print("--------------------content of 内存堆信息:--------------------",file=self.info_fd) - self.print_heap_head_info() - self.print_heap_from_head() - self.print_heap_from_tail() - - def print_heap_head_info(self): - pass - - def print_heap_from_head(self): - print("从头遍历内存池:",file=self.info_fd) - print("说明:node内存节点地址,usr用户空间地址(申请对齐内存场景不准),size内存大小,used是否占用",file=self.info_fd) - if self.heap_head: - addr = self.heap_head.head - while addr >= self.heap_start and addr <= self.heap_end: - node = parse_memory_2_class(addr,LosHeapNode,sizeof(LosHeapNode)) - if(node.size==0): - break; - str="[node=0x%x][usr=0x%x][prev=0x%x][size=0x%x][used=%d]"%(addr,addr+8,node.prev,node.size,node.used) - if hasattr(LosHeapNode,'lr'): - i=0 - while i< sizeof(node.lr)/sizeof(c_uint): - str="%s[%s][0x%x]"%(str,_addr_in_2_function_name(node.lr[i]),node.lr[i]) - i=i+1 - print(str,file=self.info_fd) - addr=addr+sizeof(LosHeapNode)+node.size - - def print_heap_from_tail(self): - print("从尾遍历内存池:",file=self.info_fd) - print("说明:node内存节点地址,usr用户空间地址(申请对齐内存场景不准),size内存大小,used是否占用",file=self.info_fd) - if self.heap_head: - addr = self.heap_head.tail - while addr >= self.heap_start and addr <= self.heap_end: - node = parse_memory_2_class(addr,LosHeapNode,sizeof(LosHeapNode)) - str="[node][addr=0x%x][usr=0x%x][prev=0x%x][size=0x%x][used=%d]"%(addr,addr+8,node.prev,node.size,node.used) - print(str,file=self.info_fd) - if addr==self.heap_head.head: - break - addr=node.prev - - def make_queue_info(self): - addr = parse_get_u32_symbol_val('g_osAllQueue') - i=0 - while i< self.queue_cnt: - ext_info=self._ExtQueueInfo() - obj=parse_memory_2_class(addr,LosQueueCB,sizeof(LosQueueCB)) - ext_info.handle_addr=addr - self.queue_array.append(obj) - self.queue_ext_info.append(ext_info) - addr=addr+sizeof(LosQueueCB) - i=i+1 - self._make_queue_ext_info() - - def _make_queue_ext_info(self): - i=0 - while i< self.queue_cnt: - queue=self.queue_array[i] - ext_info=self.queue_ext_info[i] - if queue and queue.queueState==1: #used - if self.version == 207: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB)) - elif self.version == 208: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB)) - else: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB) + 4) - for node_addr in addr_list: - ext_info.pend_read_task_list.append(node_addr) - if self.version == 207: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB)+sizeof(LOS_DL_LIST)) - elif self.version == 208: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB)+sizeof(LOS_DL_LIST)) - else: - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('readWriteList',LosQueueCB) + 4 + sizeof(LOS_DL_LIST)) - for node_addr in addr_list: - ext_info.pend_write_task_list.append(node_addr) - i=i+1 - - def print_queue_info(self): - print("\r\n--------------------content of 消息队列信息:--------------------",file=self.info_fd) - print("说明:queueHandle队列的内存空间,queueLen队列长度,queueSize单个节点大小,queueId队列id,readWriteableCnt[0]当前队列中有几个数据,readWriteableCnt[1]当前队列中有几个剩余空间",file=self.info_fd) - print("",file=self.info_fd) - i=0 - while i< self.queue_cnt: - queue=self.queue_array[i] - ext_info=self.queue_ext_info[i] - if queue.queueState==1: - uapi_print_ctypes_obj('queue',queue,self.info_fd) - list=self.get_pending_task(ext_info.pend_read_task_list) - print("等待读该消息队列的任务ID:",list,file=self.info_fd) - list=self.get_pending_task(ext_info.pend_write_task_list) - print("等待写该消息队列的任务ID:",list,file=self.info_fd) - print("",file=self.info_fd) - i=i+1 - - def _make_timer_ext_info(self): - i=0 - while i< self.timer_cnt: - timer=self.timer_array[i] - ext_info=self.timer_ext_info[i] - if timer.state==OS_SWTMR_STATUS_UNUSED or timer.state==OS_SWTMR_STATUS_DELETING: - i=i+1 - continue - ext_info.func_name = parse_addr_2_function_name(timer.handler) - i=i+1 - - def make_timer_info(self): - addr = parse_get_u32_symbol_val('g_osSwtmrCBArray') - i=0 - while i< self.timer_cnt: - obj=parse_memory_2_class(addr,LosSwtmrCB,sizeof(LosSwtmrCB)) - ext_info=self._ExtTimerInfo() - self.timer_ext_info.append(ext_info) - self.timer_array.append(obj) - ext_info.handle_addr=addr - - addr=addr+sizeof(LosSwtmrCB) - i=i+1 - self._make_timer_ext_info() - - def print_timer_info(self): - print("--------------------content of 定时器信息:--------------------",file=self.info_fd) - print("说明:timer_id定时器id,handler回调函数的地址(已解析),state(0:未使用 1:删除 2:创建 3:执行中),mode(1:周期 2:单次)",file=self.info_fd) - print("\t overrun周期性定时器执行次数,arg用户参数,inProcess到期已添加到待执行队列",file=self.info_fd) - print('',file=self.info_fd) - i=0 - while i< self.timer_cnt: - timer=self.timer_array[i] - ext_info=self.timer_ext_info[i] - if timer.state==OS_SWTMR_STATUS_UNUSED or timer.state==OS_SWTMR_STATUS_DELETING: - i=i+1 - continue - print("timer_id=%d %s[0x%x]"%(timer.timerId,ext_info.func_name,timer.handler),file=self.info_fd) - uapi_print_ctypes_obj('timer',timer,self.info_fd) - print('',file=self.info_fd) - i=i+1 - - def _make_sem_extra_info(self): - i=0 - while i< self.sem_cnt: - sem=self.sem_array[i] - ext_info=self.sem_ext_info[i] - if sem.semStat==1: #used - (ret,addr_list)=_los_List_get_all_node(ext_info.handle_addr + ctype_member_offset('semList',LosSemCB)) - for node_addr in addr_list: - ext_info.pend_task_list.append(node_addr) - i=i+1 - - def make_sem_info(self): - addr = parse_get_u32_symbol_val('g_osAllSem') - i=0 - while i< self.sem_cnt: - ext_info=self._ExtSemInfo() - obj=parse_memory_2_class(addr,LosSemCB,sizeof(LosSemCB)) - ext_info.handle_addr=addr - self.sem_array.append(obj) - self.sem_ext_info.append(ext_info) - addr=addr+sizeof(LosSemCB) - i=i+1 - self._make_sem_extra_info() - - def get_pending_task(self,addr_list): - list=[] - for addr in addr_list: - i=0 - while i < self.task_cnt: - ext_task = self.ext_task_list[i] - tcb = self.tcb_array[i] - if addr== ext_task.pend_addr: - list.append(tcb.taskId) - i=i+1 - return list - - def print_sem_info(self): - print("--------------------content of 信号量:--------------------",file=self.info_fd) - print("说明:semType(0:计数信号量 1:互斥信号量),semCount剩余信号量个数",file=self.info_fd) - print("",file=self.info_fd) - i=0 - while i< self.sem_cnt: - sem=self.sem_array[i] - ext_info=self.sem_ext_info[i] - if sem.semStat: - uapi_print_ctypes_obj('sem',sem,self.info_fd) - list=self.get_pending_task(ext_info.pend_task_list) - print("等待该信号量的任务ID:",list,file=self.info_fd) - print('',file=self.info_fd) - i=i+1 - - def make_crash_info(self): - addr = parse_get_symbol_addr('g_excInfo') - self.excInfo = parse_memory_2_class(addr,ExcInfo,sizeof(ExcInfo)) - - def print_crash_info(self): - print("--------------------content of 死机信息:--------------------",file=self.info_fd) - uapi_print_ctypes_obj('g_excInfo',self.excInfo,self.info_fd) - if self.excInfo.context!=0: - obj=parse_memory_2_class(self.excInfo.context,ExcContext,sizeof(ExcContext)) - uapi_print_ctypes_obj('context',obj,self.info_fd) - if self.version == 207: - self.stack_back_trace(obj.taskContext.sp+sizeof(TaskContext),obj.taskContext.sp+0x1000) - elif self.version == 208: - self.stack_back_trace(obj.taskContext.sp+sizeof(TaskContext),obj.taskContext.sp+0x1000) - else: - self.stack_back_trace(obj.SP, obj.SP + 0x1000) - - - - def stack_back_trace(self,start_addr,end_addr): - sp=start_addr - while sp < end_addr: - obj=parse_memory_2_class(sp,c_uint,sizeof(c_uint)) - if obj: - name = parse_addr_in_2_function_name(obj.value-4) - if name: - print("[BACK Trace][addr=0x%08x][val=0x%08x]%s"%(sp,obj.value,name),file=self.info_fd) - else: - pass - #print("[BACK Trace][addr=0x%08x][val=0x%08x]"%(sp,obj.value),file=self.info_fd) - - sp=sp+4 - -_g_parse_liteos_ctrl=_PhaseLiteosCtrl() -def make_liteos_info(): - try: - _g_parse_liteos_ctrl.make_per_cpu_info() - except: - print("[EXCEPTION]make_per_cpu_info fail.") - try: - _g_parse_liteos_ctrl.make_task_info() - except: - print("[EXCEPTION]make_task_info fail.") - if _g_parse_liteos_ctrl.version != 208: - try: - _g_parse_liteos_ctrl.make_queue_info() - except: - print("[EXCEPTION]make_queue_info fail.") - try: - _g_parse_liteos_ctrl.make_heap_info() - except: - print("[EXCEPTION]make_heap_info fail.") - try: - _g_parse_liteos_ctrl.make_timer_info() - except: - print("[EXCEPTION]make_timer_info fail.") - try: - _g_parse_liteos_ctrl.make_sem_info() - except: - print("[EXCEPTION]make_sem_info fail.") - try: - _g_parse_liteos_ctrl.make_crash_info() - except: - print("[EXCEPTION]make_crash_info fail.") - try: - _g_parse_liteos_ctrl.make_isr_info() - except: - print("[EXCEPTION]make_isr_info fail.") - -def print_liteos_info(): - try: - _g_parse_liteos_ctrl.print_isr_info() - except: - print("[EXCEPTION]print_isr_info fail.") - try: - _g_parse_liteos_ctrl.print_per_cpu_info() - except: - print("[EXCEPTION]print_per_cpu_info fail.") - if _g_parse_liteos_ctrl.version != 208: - try: - _g_parse_liteos_ctrl.print_queue_info() - except: - print("[EXCEPTION]print_queue_info fail.") - try: - _g_parse_liteos_ctrl.print_timer_info() - except: - print("[EXCEPTION]print_timer_info fail.") - try: - _g_parse_liteos_ctrl.print_heap_info() - except: - print("[EXCEPTION]print_heap_info fail.") - try: - _g_parse_liteos_ctrl.print_sem_info() - except: - print("[EXCEPTION]print_sem_info fail.") - try: - _g_parse_liteos_ctrl.print_task_short_info() - except: - print("[EXCEPTION]print_task_short_info fail.") - try: - _g_parse_liteos_ctrl.print_task_detail_info() - except: - print("[EXCEPTION]print_task_detail_info fail.") - try: - _g_parse_liteos_ctrl.print_crash_info() - except: - print("[EXCEPTION]print_crash_info fail.") - -def parse_liteos206_info(log_fp): - _g_parse_liteos_ctrl.info_fd = log_fp - _g_parse_liteos_ctrl.version = 206 - make_liteos_info() - print_liteos_info() - -def parse_liteos207_info(log_fp): - _g_parse_liteos_ctrl.info_fd = log_fp - _g_parse_liteos_ctrl.version = 207 - make_liteos_info() - print_liteos_info() - -def parse_liteos208_info(log_fp): - _g_parse_liteos_ctrl.info_fd = log_fp - _g_parse_liteos_ctrl.version = 208 - make_liteos_info() - print_liteos_info() - -''' -context.mstatus(mcause)=0x80207800 -context.mepc=0x12530 -context.tp=0xcacacaca -context.sp=0xcacacaca -context.s11=0x4040404--未压栈(中断场景) -context.s10=0x5050505--未压栈 -context.s9=0x6060606--未压栈 -context.s8=0x7070707--未压栈 -context.s7=0x8080808--未压栈 -context.s6=0x9090909--未压栈 -context.s5=0x80206088--未压栈 -context.s4=0x20008000--未压栈 -context.s3=0x80206080--未压栈 -context.s2=0x200079dc--未压栈 -context.s1=0x0--未压栈 -context.s0=0x20007a74--未压栈 - -context.t6=0x4040404 -context.t5=0x5050505 -context.t4=0x6060606 -context.t3=0x7070707 -context.a7=0x8080808 -context.a6=0x9090909 -context.a5=0xa0a0a0a -context.a4=0xb0b0b0b -context.a3=0xc0c0c0c -context.a2=0xd0d0d0d -context.a1=0xe0e0e0e -context.a0=0xf0f0f0f -context.t2=0x10101010 -context.t1=0x11111111 -context.t0=0x12121212 -context.ra=0x13131313 - -context.fs11=0x20202020--(进中断)未压栈 -context.fs10=0x21212121--未压栈 -context.fs9=0x22222222--未压栈 -context.fs8=0x23232323--未压栈 -context.fs7=0x24242424--未压栈 -context.fs6=0x25252525--未压栈 -context.fs5=0x26262626--未压栈 -context.fs4=0x27272727--未压栈 -context.fs3=0x28282828--未压栈 -context.fs2=0x29292929--未压栈 -context.fs1=0x2a2a2a2a--未压栈 -context.fs0=0x2b2b2b2b--未压栈 - -context.ft11=0x20202020 -context.ft10=0x21212121 -context.ft9=0x22222222 -context.ft8=0x23232323 -context.fa7=0x24242424 -context.fa6=0x25252525 -context.fa5=0x26262626 -context.fa4=0x27272727 -context.fa3=0x28282828 -context.fa2=0x80206088 -context.fa1=0x20008000 -context.fa0=0x80206080 -context.ft7=0x20009000 -context.ft6=0x20007ad4 -context.ft5=0x20007ad4 -context.ft4=0x11f5a -context.ft3=0x32 -context.ft2=0x20007ad4 -context.ft1=0x20007a70 -context.ft0=0x117a2 -context.fcsr=0x0 -context.reserved[0]=0x0 -context.reserved[1]=0x20007a74 -context.reserved[2]=0x12530 - - -typedef struct { - uint32_t ccause; - uint32_t mcause; - uint32_t mtval; - uint32_t gp; - TaskContext taskContext; -} ExcContext; - -typedef struct { - uint16_t phase; /**< Exception occurrence phase: 0 indicates that the exception occurs during - * initialization, 1 indicates that the exception occurs during task, 2 - * indicates that the exception occurs during interrupt, and 3 indicates that - * the exception occurs during exception. - */ - uint16_t type; /**< Type of exception, refer to no. 1-19 listed above for exceptions */ - uint32_t faultAddr; /**< A precise address access error indicates the error access address where - * the exception occurred. - */ - uint32_t thrdPid; /**< An exception occurs in the interrupt, indicating the interrupt number. An - * exception occurs in the task, indicating the task id, or 0xffffffff if it - * occurs during initialization - */ - uint16_t nestCnt; /**< The number of nested exceptions, currently only support the first time the - * exception into the implementation of the registered hook function - */ - uint16_t reserved; /**< Reserved */ - ExcContext *context; /**< The hardware context at which an exception to an automatic stack floating point - * register occurs - */ -} ExcInfo; -''' diff --git a/build/script/parse_tool/parse_main_freertos_phase2.py b/build/script/parse_tool/parse_main_freertos_phase2.py deleted file mode 100755 index 266ae79..0000000 --- a/build/script/parse_tool/parse_main_freertos_phase2.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_elf import * -from parse_freertos import * -from parse_module_diag import * -from auto_class import * -from parse_basic import * -from parse_print_global_var import * -import json -import argparse - -if __name__ == '__main__': - print("Running python at", sys.executable, - " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) - argp = argparse.ArgumentParser(description='Parse entry step2:') - argp.add_argument('--nm_file', type=str, help='nm file path.') - argp.add_argument('--bin_list', type=str, help='-bin_list:"name1|addr1|size1|name2|addr2|size2".') - argp.add_argument('--result', type=str, help='memory result file') - argp.add_argument('--global_file', type=str, help='global file path') - args = argp.parse_args() - print("args:") - print(args) - - bin_list = args.bin_list.split("|") - key_list = ["name", "addr", "size"] - bin_dict = {} - temp_list = [] - for i in range(len(bin_list)): - bin_dict[key_list[i%3]] = bin_list[i] - if (i%3 == 2): - temp_list.append(bin_dict) - bin_dict = {} - parse_elf_step_2(args.nm_file) - for item in temp_list: - addr = int(item["addr"]) - size = int(item["size"]) - parse_memory_register(item["name"], addr, size) - - with open(args.result,'w+') as log_fp: - parse_freertos_info(log_fp) - try: - parse_print_global_var(args.global_file, log_fp) - except: - print("[EXCEPTION]parse_print_global_var fail.") - - - - diff --git a/build/script/parse_tool/parse_main_liteos206_phase2.py b/build/script/parse_tool/parse_main_liteos206_phase2.py deleted file mode 100755 index f5dc8b3..0000000 --- a/build/script/parse_tool/parse_main_liteos206_phase2.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_elf import * -from parse_liteos import * -from parse_module_diag import * -from auto_class import * -from parse_basic import * -from parse_print_global_var import * -import json -import argparse - -if __name__ == '__main__': - print("Running python at", sys.executable, - " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) - argp = argparse.ArgumentParser(description='Parse entry step2:') - argp.add_argument('--nm_file', type=str, help='nm file path.') - argp.add_argument('--bin_list', type=str, help='-bin_list:"name1|addr1|size1|name2|addr2|size2".') - argp.add_argument('--result', type=str, help='memory result file') - argp.add_argument('--global_file', type=str, help='global file path') - args = argp.parse_args() - print("args:") - print(args) - - bin_list = args.bin_list.split("|") - key_list = ["name", "addr", "size"] - bin_dict = {} - temp_list = [] - for i in range(len(bin_list)): - bin_dict[key_list[i%3]] = bin_list[i] - if (i%3 == 2): - temp_list.append(bin_dict) - bin_dict = {} - parse_elf_step_2(args.nm_file) - for item in temp_list: - addr = int(item["addr"]) - size = int(item["size"]) - parse_memory_register(item["name"], addr, size) - - with open(args.result,'w+') as log_fp: - parse_liteos206_info(log_fp) - try: - parse_print_global_var(args.global_file, log_fp) - except: - print("[EXCEPTION]parse_print_global_var fail.") - - - - diff --git a/build/script/parse_tool/parse_main_liteos207_phase2.py b/build/script/parse_tool/parse_main_liteos207_phase2.py deleted file mode 100755 index 874e84d..0000000 --- a/build/script/parse_tool/parse_main_liteos207_phase2.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from parse_elf import * -from parse_liteos import * -from parse_module_diag import * -from auto_class import * -from parse_basic import * -from parse_print_global_var import * -import json -import argparse - -if __name__ == '__main__': - print("Running python at", sys.executable, - " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) - argp = argparse.ArgumentParser(description='Parse entry step2:') - argp.add_argument('--nm_file', type=str, help='nm file path.') - argp.add_argument('--bin_list', type=str, help='-bin_list:"name1|addr1|size1|name2|addr2|size2".') - argp.add_argument('--result', type=str, help='memory result file') - argp.add_argument('--global_file', type=str, help='global file path') - args = argp.parse_args() - print("args:") - print(args) - - bin_list = args.bin_list.split("|") - key_list = ["name", "addr", "size"] - bin_dict = {} - temp_list = [] - for i in range(len(bin_list)): - bin_dict[key_list[i%3]] = bin_list[i] - if (i%3 == 2): - temp_list.append(bin_dict) - bin_dict = {} - parse_elf_step_2(args.nm_file) - for item in temp_list: - addr = int(item["addr"]) - size = int(item["size"]) - parse_memory_register(item["name"], addr, size) - - with open(args.result,'w+') as log_fp: - parse_liteos207_info(log_fp) - try: - parse_print_global_var(args.global_file, log_fp) - except: - print("[EXCEPTION]parse_print_global_var fail.") - - - - diff --git a/build/script/parse_tool/parse_main_liteos208_phase2.py b/build/script/parse_tool/parse_main_liteos208_phase2.py deleted file mode 100755 index f086b53..0000000 --- a/build/script/parse_tool/parse_main_liteos208_phase2.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - -import sys,string,re,os -sys.path.append('.') - -from ctypes import * -from parse_elf import * -from parse_liteos import * -from parse_module_diag import * -from auto_class import * -from parse_basic import * -from parse_print_global_var import * -import json -import argparse - -if __name__ == '__main__': - print("Running python at", sys.executable, - " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) - argp = argparse.ArgumentParser(description='Parse entry step2:') - argp.add_argument('--nm_file', type=str, help='nm file path.') - argp.add_argument('--bin_list', type=str, help='-bin_list:"name1|addr1|size1|name2|addr2|size2".') - argp.add_argument('--result', type=str, help='memory result file') - argp.add_argument('--global_file', type=str, help='global file path') - args = argp.parse_args() - print("args:") - print(args) - - bin_list = args.bin_list.split("|") - key_list = ["name", "addr", "size"] - bin_dict = {} - temp_list = [] - for i in range(len(bin_list)): - bin_dict[key_list[i%3]] = bin_list[i] - if (i%3 == 2): - temp_list.append(bin_dict) - bin_dict = {} - parse_elf_step_2(args.nm_file) - for item in temp_list: - addr = int(item["addr"]) - size = int(item["size"]) - parse_memory_register(item["name"], addr, size) - - with open(args.result,'w+') as log_fp: - parse_liteos208_info(log_fp) - try: - parse_print_global_var(args.global_file, log_fp) - except: - print("[EXCEPTION]parse_print_global_var fail.") - - - - diff --git a/build/script/parse_tool/parse_main_phase1.py b/build/script/parse_tool/parse_main_phase1.py deleted file mode 100755 index 1f06174..0000000 --- a/build/script/parse_tool/parse_main_phase1.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -sys.path.append(os.path.split(os.path.realpath(__file__))[0]) -from ctypes import * -from parse_elf import * -import json - -if __name__ == '__main__': - print("Running parse step1 at", sys.executable, - " version:%d.%d.%d " % (sys.version_info[0], sys.version_info[1], sys.version_info[2])) - out_dir = sys.argv[1] - debug_file = sys.argv[2] - nm_file = sys.argv[3] - xml_file = sys.argv[4] - - if not os.path.isdir(out_dir): - os.makedirs(out_dir) - parse_elf_step_1(debug_file, - os.path.join(out_dir, 'auto_class.py'), - os.path.join(out_dir, 'auto_struct.txt'), - nm_file, - os.path.join(out_dir, 'global.txt'), - out_dir, - xml_file - ) - print("Build parse tool success.") diff --git a/build/script/parse_tool/parse_module_diag.py b/build/script/parse_tool/parse_module_diag.py deleted file mode 100755 index 60353b4..0000000 --- a/build/script/parse_tool/parse_module_diag.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -from auto_class import * -from config import * - -class _PhaseCtrl: - def __init__(self): - self.dfx_stat=None - - def make_diag_info(self): - addr = parse_get_symbol_addr('g_zdiag_dfx_stat') - obj=parse_memory_2_class(addr,zdiag_dfx_stat,sizeof(zdiag_dfx_stat)) - self.dfx_stat=obj - def print_diag_info(self): - uapi_print_ctypes_obj('diag_dfx_stat',self.dfx_stat) - -_g_parse_ctrl=_PhaseCtrl() - -def parase_diag_info(): - _g_parse_ctrl.make_diag_info() - _g_parse_ctrl.print_diag_info() \ No newline at end of file diff --git a/build/script/parse_tool/parse_print_global_var.py b/build/script/parse_tool/parse_print_global_var.py deleted file mode 100755 index 2224f90..0000000 --- a/build/script/parse_tool/parse_print_global_var.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * - -import auto_class as auto_class -from parse_basic import * -import json - -def _process_g_var(list,result_fp): - name=list[0].strip() - addr=int(list[1],16) - size=list[2] - type_name=list[3].strip() - - if hasattr(auto_class, type_name): - class_obj=getattr(auto_class, type_name) - if class_obj==None: - return - #if sizeof(class_obj)!=size: - # return - obj = parse_memory_2_class(addr,class_obj,sizeof(class_obj)) - if(obj): - uapi_print_ctypes_obj(name,obj,fd=result_fp) - print('',file=result_fp) - -def _process_g_array_item(name,addr,class_obj,result_fp): - pass - -def _process_g_array(list,result_fp): - name=list[0].strip() - addr=int(list[1],16) - size=list[2] - type_name=list[3].strip() - str=list[4].strip() - array_list=json.loads(str) - - if hasattr(auto_class, type_name): - class_obj=getattr(auto_class, type_name) - if class_obj==None: - return - for n in array_list[::-1]: - class_obj=class_obj*n - if sizeof(class_obj)!=size: - return - obj = parse_memory_2_class(addr,class_obj,sizeof(class_obj)) - if(obj): - uapi_print_ctypes_obj(name,obj,fd=result_fp) - print('',file=result_fp) - -def _process_lines(lines,result_fp): - print("----------------------content of 全局变量:----------------------",file=result_fp) - for line in lines: - line=line.strip() - list=line.split('|') - if len(list)==4: - _process_g_var(list,result_fp) - elif len(list)==5: - _process_g_array(list,result_fp) - -def parse_print_global_var(var_file,result_fp): - with open(var_file,'r') as fp: - lines=fp.readlines() - _process_lines(lines,result_fp) - print("parse_print_global_var end!") - - diff --git a/build/script/parse_tool/xml_main.py b/build/script/parse_tool/xml_main.py deleted file mode 100755 index f74c992..0000000 --- a/build/script/parse_tool/xml_main.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys,string,re,os -from ctypes import * -import json -from xml.etree import ElementTree as ET - - -def _xml_parse_tree(file): - tree = ET.parse(file) - root = tree.getroot() - return (tree,root) - - -def _xml_find_son_by_tag(parent,tag_name): - match_list=[] - for child in parent: - if(child.tag==tag_name): - match_list.append(child) - return match_list - - -def _xml_find_child_by_tag(match_list,parent,tag_name): - for child in parent: - if(child.tag==tag_name): - match_list.append(child) - _xml_find_child_by_tag(match_list,child,tag_name) - -def _parse_create_struct_file(struct_list,debug_info_file,out_file): - #print(struct_list) - #print(out_file) - with open(out_file,'w+') as fp: - print(struct_list,file=fp) - -def parse_tools_xml(xml_file,debug_info_file,out_idr): - (tree,root)=_xml_parse_tree(xml_file) - list=_xml_find_son_by_tag(root,'GROUP') - item_list=[] - for item in list: - if 'AUTO_STRUCT' in item.attrib and item.attrib['AUTO_STRUCT']=="YES": - item_list.append(item) - result_list = [] - for item in item_list: - req_list=[] - ind_list=[] - struct_list=[] - _xml_find_child_by_tag(req_list,item,'REQ') - _xml_find_child_by_tag(ind_list,item,'IND') - for req in req_list: - struct_list.append(req.attrib['STRUCTURE']) - for ind in ind_list: - struct_list.append(ind.attrib['STRUCTURE']) - #_parse_create_struct_file(struct_list,debug_info_file,os.path.join(out_idr,item.attrib['DATA_STRUCT_FILE'])) - result_list.extend(struct_list) - return result_list diff --git a/build/script/patch/patch_riscv.py b/build/script/patch/patch_riscv.py deleted file mode 100755 index 44b683f..0000000 --- a/build/script/patch/patch_riscv.py +++ /dev/null @@ -1,444 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ============================================================================ -# @brief riscv ROM Patch File -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. -# ============================================================================ -import struct -import ctypes -import sys -import os -import shutil -import traceback - -dir_name = os.path.dirname(os.path.realpath(__file__)) -info_item = [ - "Device_Code_Version", - "Patch_Cpu_Core", - "Patch_File_Address", - "Patch_TBL_Address", - "Patch_TBL_Run_Address", - "Table_Max_Size", - "Table_Reg_Size", - "ROM_Address", - "ROM_Size", - "CMP_Bin_File", - "TBL_Bin_File", - "RW_Bin_File", - "TABLE_REG_CONUT", - ] - -# The default value is 4. -# The value will be set based on long jump or short jump for linx131. -CMP_HEAD_LEN = 3 -g_cmp_total_len = 131 # 128个比较表 + 3个头部信息 -CMP_REG_SIZE = 4 -PATCH_COUNT_REG_INDEX = 2 -DATA_PATCH_COUNT = 2 -pid = str(os.getpid()) - - -# 目录转换 -def get_dir(dir_in): - return os.path.join(dir_name, dir_in) - -def remove_bin_file(): - os.remove(get_dir(pid + "cmp.bin")) if os.path.exists(get_dir(pid + "cmp.bin")) else None - os.remove(get_dir(pid + "tbl.bin")) if os.path.exists(get_dir(pid + "tbl.bin")) else None - os.remove(get_dir(pid + "rw.bin")) if os.path.exists(get_dir(pid + "rw.bin")) else None - -# 转换成bin文件 -def copy_bin_file(str_dst, str_src): - try: - with open(str_src, "rb")as file_src: - try: - with open(str_dst, "wb+")as file_dst: - byte = file_src.read(1) - while byte: - file_dst.write(byte) - byte = file_src.read(1) - file_dst.close() - except Exception as e: - print("Error: %s Can't Open!" % file_dst) - remove_bin_file() - sys.exit(1) - file_src.close() - except Exception as e: - print("Error: %s Can't Open!" % str_src) - remove_bin_file() - sys.exit(1) - - -# 生成bin文件 -def merge_output_file(files): - try: - reg_size = int(files['Table_Reg_Size']) - max_size = int(files['Table_Max_Size']) - with open(get_dir(files['RW_Bin_File']), "rb+") as file_rw: - try: - with open(get_dir(files['TBL_Bin_File']), "rb+")as file_table: - data_num = int(files['TABLE_REG_CONUT']) * reg_size - data_table = [] - for num in range(data_num): - data_table.append(0) - buff = file_table.read(1) - j = 0 - while buff: - data_table[j] = struct.unpack(' g_cmp_total_len: # 128个比较表 + 头部信息 - print("Error: CMP Packet is larger than CMP Reg Capacitance") - while cmp_count < g_cmp_total_len - 3: - cmp_content.append(0) - cmp_count += 1 - - return cmp_content - - -def get_table_content_for_short_jump(files, func_addrs, func_patch_addrs, version, bt_rom_file_in): - table_content = [] - bit0_to6 = 0x6F - bit7_to11 = 0x5 << 7 - - func_num = len(func_addrs) - index = 0 - while index < func_num: - func_addr = int(func_addrs[index], 16) - func_patch_addr = int(func_patch_addrs[index], 16) - - off_addr = func_patch_addr - func_addr - - off_bit1_to10 = (off_addr & 0x7fe) >> 1 - off_bit12_to19 = (off_addr & 0xff000) >> 12 - off_bit11 = (off_addr & 0x800) >> 11 - off_bit20 = (off_addr & 0x100000) >> 20 - - bit_code = bit0_to6 + bit7_to11 + (off_bit12_to19 << 12) + (off_bit11 << 20) + (off_bit1_to10 << 21) + (off_bit20 << 31) - table_content.append(bit_code) - index += 1 - - table_count = len(table_content) - if table_count > int(files['TABLE_REG_CONUT']): # 128个比较表 - print("Error: TABLE Packet is larger than CMP Reg Capacitance") - sys.exit(1) - while table_count < int(files['TABLE_REG_CONUT']): - table_content.append(0) - table_count += 1 - - return table_content - -def get_table_content_for_long_jump(files, func_addrs, func_patch_addrs, version, bt_rom_file_in): - table_content = [] - auipc_opt_bits = 0x17 - jalr_opt_bits = 0x67 - base_addr_bits = 0x6 # x6 - jalr_bit12_to14 = 0x0 << 12 - jalr_bit7_to11 = 0x0 << 7 - - func_num = len(func_addrs) - index = 0 - while index < func_num: - func_addr = int(func_addrs[index], 16) - func_patch_addr = int(func_patch_addrs[index], 16) - - off_addr = func_patch_addr - func_addr - off_bit12_to31 = off_addr & 0xfffff000 - off_bit0_to11 = off_addr & 0xfff - if off_bit0_to11 > 0x7FF: - off_bit12_to31 = off_bit12_to31 + 0x1000 - off_bit0_to11 = 0x1000 - off_bit0_to11 - off_bit0_to11 = (~off_bit0_to11 + 1) & 0xfff - - auipc_bit_code = auipc_opt_bits + (base_addr_bits << 7) + off_bit12_to31 - table_content.append(auipc_bit_code) - - jalr_bit_code = jalr_opt_bits + jalr_bit7_to11 + jalr_bit12_to14 + (base_addr_bits << 15) + (off_bit0_to11 << 20) - table_content.append(jalr_bit_code) - - index += 1 - - table_count = len(table_content) - if table_count > 2 * int(files['TABLE_REG_CONUT']): # 128个比较表 - print("Error: TABLE Packet is larger than CMP Reg Capacitance") - sys.exit(1) - while table_count < 2 * int(files['TABLE_REG_CONUT']): - table_content.append(0) - table_content.append(0) - table_count += 2 - - return table_content - -def create_patch(patch_info, nm_file_in, rom_bin_file): - global g_cmp_total_len - file_all = get_patch_info(patch_info) - g_cmp_total_len = int(file_all['TABLE_REG_CONUT']) + 3 - core = file_all['Patch_Cpu_Core'] - funs = get_func_name(patch_info, 0) - funs_patch = get_func_name(patch_info, 1) - nm_contents = get_nm_content(nm_file_in) - func_addrs = get_func_addr(funs, nm_contents, "GCC") - func_patch_addrs = get_func_addr(funs_patch, nm_contents, "GCC") - cmp_contents = get_cmp_content(func_addrs, file_all['Patch_TBL_Run_Address'], file_all['Device_Code_Version']) - reg_size = int(file_all['Table_Reg_Size']) - if reg_size == 4: - table_contents = get_table_content_for_short_jump(file_all, func_addrs, func_patch_addrs, file_all['Device_Code_Version'], rom_bin_file) - elif reg_size == 8: - table_contents = get_table_content_for_long_jump(file_all, func_addrs, func_patch_addrs, file_all['Device_Code_Version'], rom_bin_file) - else: - print("ErrorCore %s for rom patch" % core) - creat_bin_file(get_dir(file_all['CMP_Bin_File']), cmp_contents, file_all['CMP_Bin_File']) - creat_bin_file(get_dir(file_all['TBL_Bin_File']), table_contents, file_all['TBL_Bin_File']) - -def output_bin_file(file_all, output_dir_in, ram_bin_file): - if os.path.exists(os.path.join(output_dir_in, ram_bin_file)): - shutil.move(os.path.join(output_dir_in, ram_bin_file), os.path.join(output_dir_in, "unpatch.bin")) - if os.path.exists(os.path.join(output_dir_in, "rw.bin")): - os.remove(os.path.join(output_dir_in, "rw.bin")) - shutil.move(get_dir(file_all['RW_Bin_File']), os.path.join(output_dir_in, ram_bin_file)) - os.remove(get_dir(file_all['CMP_Bin_File'])) - os.remove(get_dir(file_all['TBL_Bin_File'])) - print("Generating %s..." % ram_bin_file) - - -def get_patch_addr(patch_info, ram_bin_file, output_dir_in): - file_all = get_patch_info(patch_info) - funs = get_func_name(patch_info, 0) - funs_patch = get_func_name(patch_info, 1) - copy_bin_file(get_dir(file_all['RW_Bin_File']), ram_bin_file) - merge_output_file(file_all) - output_bin_file(file_all, output_dir_in, ram_bin_file) - -if __name__ == "__main__": - if(len(sys.argv) == 8): - ram_bin_file = sys.argv[1] - rom_bin_file = sys.argv[2] - nm_file = sys.argv[3] - partch_config_dir = sys.argv[4] - core = sys.argv[5] - target_name = sys.argv[6] - output_dir = sys.argv[7] - - if os.path.exists(os.path.join(partch_config_dir, f'{target_name}.cfg')): - patch_info = os.path.join(partch_config_dir, f'{target_name}.cfg') - else: - patch_info = os.path.join(partch_config_dir, f'{core}.cfg') - - create_patch(patch_info, nm_file, rom_bin_file) - get_patch_addr(patch_info, ram_bin_file, output_dir) - - else: - print( - "Usage: %s " - "" % os.path.basename(sys.argv[0])) - sys.exit(1) diff --git a/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-37.pyc b/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-37.pyc deleted file mode 100755 index be795c8..0000000 Binary files a/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-37.pyc and /dev/null differ diff --git a/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-39.pyc b/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-39.pyc deleted file mode 100644 index 5858e99..0000000 Binary files a/build/script/rom_ram_callback/__pycache__/gen_rom_ram_callback.cpython-39.pyc and /dev/null differ diff --git a/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-37.pyc b/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-37.pyc deleted file mode 100755 index 505c025..0000000 Binary files a/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-37.pyc and /dev/null differ diff --git a/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-39.pyc b/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-39.pyc deleted file mode 100644 index 947fbd2..0000000 Binary files a/build/script/rom_ram_callback/__pycache__/strip_undef_symbols.cpython-39.pyc and /dev/null differ diff --git a/build/script/rom_ram_callback/gen_rom_ram_callback.py b/build/script/rom_ram_callback/gen_rom_ram_callback.py deleted file mode 100755 index 6ee247f..0000000 --- a/build/script/rom_ram_callback/gen_rom_ram_callback.py +++ /dev/null @@ -1,503 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved. - -import sys -import os -import re -import time - -# .o中得到的undef symbols -undef_rom_symbol_list = [] -# 待处理的undef symbls, 全局函数和全局变量,再通过elf目标区分符号的类型 -undef_result_symbols_list = [] -# 需要处理的rom-ram 函数符号列表 -rom_func_list = [] -# 需要处理的rom-ram 数据区符号列表 -rom_data_list = [] -# 特殊undef symbols过滤列表 -undef_list_filter = [] -# 包含所有全局链接符号的字典 -dict_all_symbols_glb = dict() -# 被优化或者特殊ROM-RAM call符号列表 -rom_ram_call_leacy_list = [] - -# 长跳中转函数后缀名 -romcallback_suffix_str = "_veneer_rom" -romcallback_prefix_str = "__wrap_" -romcallback_real_prefix = "__real_" - -# filenames from outside -# undef symbols from elf -# nm -u ~/wifi_rom.o |awk '{print $NF}' > ~/wifi_rom.undef -undef_file_str = "undef_file" - -# undef symbols filter list, remove special symbols from undef_file -undef_filter_str = "undef_filter" - -# relocation information file, include all rel info for undef symbols, file maybe huge large -# readelf -W -r ~/wifi_rom.o > ~/wifi_rom.rel -rel_file_str = "rel_file" - -# all compile symbols from elf file -# readelf -W -s ~/asic.elf > ~/image_symbols.list -image_elf_str = "image_elf" - -# link script section config file, rw section config list -region_file_str = "region_file" - -# result files -# source code auto gen -# veneer long jump assemable code -rom_file_str = "rom_file" -# redefine macros for undef function symbols -auto_redefine_macro_file_str = "auto_redefine_macro_file" -# undef symbols function & data report list -rom_ram_call_func_file_str = "rom_ram_call_func_file" -rom_ram_call_data_file_str = "rom_ram_call_data_file" -rom_ram_call_leacy_file_str = "rom_ram_call_leacy_file" -rom_ram_data_leacy_file_str = "data_leacy_file" -# rom-ram function & data fix section define link scripts -lds_data_file_str = "lds_data_file" -func_lds_file_str = "func_lds_file" - -none_path = "null" - -argv_list = { - undef_file_str: none_path, - undef_filter_str: none_path, - rel_file_str: none_path, - image_elf_str: none_path, - region_file_str: none_path, - rom_file_str: none_path, - auto_redefine_macro_file_str: none_path, - rom_ram_call_func_file_str: none_path, - rom_ram_call_data_file_str: none_path, - rom_ram_call_leacy_file_str: none_path, - lds_data_file_str: none_path, - func_lds_file_str: none_path, - rom_ram_data_leacy_file_str: none_path, - # cpu target(arm32, riscv32.) - "target": "arm32" -} - -input_file_list = { - undef_file_str: "rom_bin.undef", - undef_filter_str: "undef_rom_filter.list", - rel_file_str: "rom_bin.rel", - image_elf_str: "image_symbol.list", - region_file_str: "region.list", - rom_file_str: "rom_callback.S", - auto_redefine_macro_file_str: "rom_callback_wrap.cmake", - rom_ram_call_func_file_str: "rom_ram_func.list", - rom_ram_call_data_file_str: "rom_ram_call_data.list", - rom_ram_call_leacy_file_str: "rom_ram_call_leacy.list", - lds_data_file_str: "data.lds", - func_lds_file_str: "function.lds", - rom_ram_data_leacy_file_str: "data_leacy.list" -} - - -def check_file_exist(path): - if not os.path.exists(path): - err_msg = "path: " + path + " not exist!!" - print_manual(err_msg) - sys.exit(1) - - -# 根据数据符号名查找地址判断符号是zi还是rw符号,根据配置文件定义生成链接脚本定义,在lds中自己调用 -def rom_parse_region_file_list(): - rom_data_list_dict = dict() - for var in rom_data_list: - rom_data_list_dict[var] = dict_all_symbols_glb.get(var) - check_file_exist(argv_list[region_file_str]) - with open(argv_list[region_file_str], "r") as region_file, open(argv_list[lds_data_file_str], "w+") as lds_data_file: - line = region_file.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if line.find('#', 0, 1) >= 0: - line = region_file.readline() - continue - if line.split(",").__len__() != 4: - print("invalid region item:%s, must be 4 cols" % line) - sys.exit(1) - region_len = line.split(",").__len__() - region_type = line.split(",")[0] - region_name = line.split(",")[1] - region_begin = line.split(",")[2] - region_end = line.split(",")[3] - if not dict_all_symbols_glb.get(region_begin): - # 找不到_SXXXX 或者_EXXXX 直接报错 - print("can't found %s in image symbols list, break" % region_begin) - sys.exit(1) - if not dict_all_symbols_glb.get(region_end): - # 找不到_SXXXX 或者_EXXXX 直接报错 - print("can't found %s in image symbols list, break" % region_end) - sys.exit(1) - # 处理数据符号 - region_begin_value = dict_all_symbols_glb[region_begin] - region_end_value = dict_all_symbols_glb[region_end] - # print("region %s:%s [0x%x:0x%x]" % (region_begin, region_end, region_begin_value, region_end_value)) - if region_end_value == region_begin_value: - # 区间相等,为空段 - # print("empty region, skip") - print("#define %s" % region_name, file=lds_data_file) - elif region_end_value < region_begin_value: - print("invalid region range %s:%s [0x%x:0x%x]" % ( - region_begin, region_end, region_begin_value, region_end_value)) - sys.exit(1) - else: - # 遍历所有的数据符号,加入对应的分区 - # 遍历所有的需要处理的变量符号(包括data & bss) - lds_str = "" - for var in rom_data_list: - if not dict_all_symbols_glb.get(var): - # fatal err - print("can't found %s in dict" % var) - if not rom_data_list_dict.get(var): - # 当前符号已经处理过 - print("%s been dealt with in dict" % var) - continue - var_address = dict_all_symbols_glb[var] - if (var_address >= region_begin_value) and (var_address < region_end_value): - # 符号地址落在该region范围内 - # print("%s in region %s" % (var, line)) - lds_str = ("%sKEEP(*.o*(.%s.%s));" % (lds_str, region_type, var)) - del rom_data_list_dict[var] - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=lds_data_file) - print("#define %s _S%s = .;%s; _E%s = .;" % (region_name, region_name, lds_str, region_name), file=lds_data_file) - print("#else", file=lds_data_file) - print("#define %s _S%s = .;%s; _E%s = .;" % (region_name, region_name, "", region_name), file=lds_data_file) - print("#endif", file=lds_data_file) - line = region_file.readline() - - # 保存没有被处理的变量符号,这些符号不在region list 范围内,可能是指定地址存放,不需要脚本处理 - with open(argv_list[rom_ram_data_leacy_file_str], "w+") as rom_ram_data_leacy_file: - for key in rom_data_list_dict: - print("0x%x %s" % (rom_data_list_dict[key], key), file=rom_ram_data_leacy_file) - return True - - -# 生成函数段定义链接脚本宏文件 -def rom_function_lds_gen(): - with open(argv_list[func_lds_file_str], "w+") as func_lds_file: - lds_str = "" - for var in rom_func_list: - # 中转函数按照8字节对齐,2条4字节指令,riscv短指令只有4字节,ARM统一8字节, 一律按照8字节对齐 - lds_str = ("%s . = ALIGN(8); KEEP(*.o*(.%s.romcall.text));" % (lds_str, var)) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=func_lds_file) - # 跳转函数,不区分模块 - print("#define VENEER_TEXT _SVENEER_TEXT = .;%s_EVENEER_TEXT = .;. = ALIGN(8);" % lds_str, file=func_lds_file) - print("#else", file=func_lds_file) - print("#define VENEER_TEXT", file=func_lds_file) - print("#endif", file=func_lds_file) - - -rom_rel_ro_list = ['Relocation section \'.rel.text', - 'Relocation section \'.rel.rodata', - 'Relocation section \'.rela.text', - 'Relocation section \'.rela.rodata'] - - -def rom_rel_check_ro_section(line): - for ro in rom_rel_ro_list: - if line.find(ro) >= 0: - return True - return False - - -# 解析rom.o中的代码段范围内undef符号列表 -def rom_rel_load(): - # global undef_rom_symbol_list - check_file_exist(argv_list[rel_file_str]) - with open(argv_list[rel_file_str], "r") as rel_file: - line = rel_file.readline() - while line: - # line = rel_file.readline() - if rom_rel_check_ro_section(line): - # print("%s" % line) - # skip Offset row - line = rel_file.readline() - line = rel_file.readline() - while line: - if line.find('0', 0, 1) < 0: - break - if line.split().__len__() < 5: - line = rel_file.readline() - continue - # print("%s" % line) - # print ("%s %s" % (line.split()[2],line.split()[4])) - rel_type = line.split()[2] - # rel 文件 第5列表示符号名称, 如果解析错误,说明readelf 版本可能不匹配 - rel_symbol_name = line.split()[4] - # print("%s %s" % (rel_type, rel_symbol_name)) - if undef_rom_symbol_list.count(rel_symbol_name) <= 0: - line = rel_file.readline() - continue - if undef_result_symbols_list.count(rel_symbol_name) <= 0: - undef_result_symbols_list.append(rel_symbol_name) - # alg_autorate_init_user_legacy_rate_set_capability_extend - # print("%s" % rel_symbol_name) - line = rel_file.readline() - else: - line = rel_file.readline() - - -# 根据elf信息给undef symbols分类,函数还是数据类型 -def undef_symbols_type_process(): - global undef_result_symbols_list - func_list = [] - data_list = [] - check_file_exist(argv_list[image_elf_str]) - with open(argv_list[image_elf_str], "r") as image_elf: - line = image_elf.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - - if (line.split().__len__() != 8) or len(line) <= 0 or (line.split()[4] != "GLOBAL"): - # if line.split().__len__() == 8: - # print("image1 elf: %s %s %s" % (line.split()[3], line.split()[4], line.split()[7])) - line = image_elf.readline() - continue - else: - symbol_name = line.split()[7] - symbol_address = int(line.split()[1], 16) - if dict_all_symbols_glb.get(symbol_name): - print("symbol name:%s repeat" % symbol_name) - else: - dict_all_symbols_glb[symbol_name] = symbol_address - # print("add dict %s => %s" % (symbol_name, symbol_address)) - # print("image2 elf: %s %s %s" % (line.split()[3], line.split()[4], line.split()[7])) - if line.split()[3] == "FUNC": - # print("FUNC: %s" % line.split()[7]) - func_list.append(line.split()[7]) - if line.split()[3] == "OBJECT": - # print("DATA: %s" % line.split()[7]) - data_list.append(line.split()[7]) - line = image_elf.readline() - - for symbol_i in undef_result_symbols_list: - # print("symbol_i: %s" % symbol_i) - if func_list.count(symbol_i) > 0: - # 类型是函数,去重 - # print("symbol_i: %s" % symbol_i) - if rom_func_list.count(symbol_i) <= 0: - rom_func_list.append(symbol_i) - elif data_list.count(symbol_i) > 0: - # 类型是数据,去重 - # print("symbol_i: %s" % symbol_i) - if rom_data_list.count(symbol_i) <= 0: - rom_data_list.append(symbol_i) - else: - # 未识别符号,可能被编译器优化或者是特殊定义符号 - print("unkown undef symbol type: %s, not function or data or removed when ld" % symbol_i) - rom_ram_call_leacy_list.append(symbol_i) - rom_func_list.sort() - rom_data_list.sort() - rom_ram_call_leacy_list.sort() - - -def classify_undef_symbols(): - with open(argv_list[rom_ram_call_func_file_str], "w+") as rom_ram_call_func_file, open(argv_list[rom_ram_call_data_file_str], "w+") as rom_ram_call_data_file, open(argv_list[rom_ram_call_leacy_file_str], "w+") as rom_ram_call_leacy_file: - for func_i in rom_func_list: - # 重定向汇编中引用的外部函数符号需要处理 - print("%s" % func_i, file=rom_ram_call_func_file) - for data_i in rom_data_list: - # 重定向汇编中引用的外部数据符号需要处理 - print("%s" % data_i, file=rom_ram_call_data_file) - for undef_i in undef_rom_symbol_list: - # 重定向汇编中未使用的外部数据和函数符号认为不影响ROM码点,可以不处理 - if (rom_func_list.count(undef_i) <= 0) and (rom_data_list.count(undef_i) <= 0): - print("%s" % undef_i, file=rom_ram_call_leacy_file) - for sym in rom_ram_call_leacy_list: - print("%s" % sym, file=rom_ram_call_leacy_file) - - -def undef_symbol_filter_load(): - global undef_filter - check_file_exist(argv_list[undef_filter_str]) - with open(argv_list[undef_filter_str], "r") as undef_filter: - line = undef_filter.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if (len(line) > 0) and (line.find('#', 0, 1) < 0): - undef_list_filter.append(line) - line = undef_filter.readline() - - -def undef_symbol_load(): - check_file_exist(argv_list[undef_file_str]) - with open(argv_list[undef_file_str], "r") as undef_file: - white_list = ["OsIdleTask"] - line = undef_file.readline() - # global undef_rom_symbol_list - global undef_list_filter - global undef_result_symbols_list - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if line.split().__len__() < 2: - print("error format for %s file, str=%s" % (argv_list[undef_file_str], line)) - sys.exit(1) - if line.split()[0] != 'U': - continue - line = line.split()[1] - if undef_list_filter.count(line) <= 0: - # undef_result_symbols_list.append(line) - undef_rom_symbol_list.append(line) - else: - print("filter undef symbol %s" % line) - line = undef_file.readline() - undef_rom_symbol_list.extend(white_list) - undef_rom_symbol_list.sort() - -# 宏替换改成链接替换 --wrap=symbol -def rom_gen_arm32_assemfile(): - with open(argv_list[rom_file_str], "w+") as rom_file: - print("/*", file=rom_file) - print(" * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved.", file=rom_file) - print(" * Description: Rom Callback Functions by Assemble(arm32), Auto Generate by Python.", file=rom_file) - print(" * Author: Platform", file=rom_file) - # print(" * Create: %s" % time.strftime("%Y-%m-%d", time.localtime()), file=rom_file) - print(" */", file=rom_file) - print("", file=rom_file) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=rom_file) - # print(".code 32", file=rom_file) - print(".thumb", file=rom_file) - print(".syntax unified", file=rom_file) - # print("#include \"rom_callback.h\"", file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = 0 - for list_line in rom_func_list: - print(".section .%s.romcall.text, \"ax\"" % list_line, file=rom_file) - print(".globl %s%s" % (romcallback_prefix_str, list_line), file=rom_file) - print(".type %s%s, %%function" % (romcallback_prefix_str, list_line), file=rom_file) - print("%s%s:" % (romcallback_prefix_str, list_line), file=rom_file) - print(" LDR PC, =%s%s" % (romcallback_real_prefix, list_line), file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = veneer_rom_cnt + 1 - print(".end", file=rom_file) - # print("// %d veneer functions" % veneer_rom_cnt, file=rom_file) - print("#endif // _PRE_FEATURE_VENEER_ROM", file=rom_file) - -# 宏替换改成链接替换 --wrap=symbol -def rom_gen_riscv32_assemfile(): - with open(argv_list[rom_file_str], "w+") as rom_file: - print("/*", file=rom_file) - print(" * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved.", file=rom_file) - print(" * Description: Rom Callback Functions by Assemble(riscv32), Auto Generate by Python.", file=rom_file) - print(" * Author: Platform", file=rom_file) - # print(" * Create: %s" % time.strftime("%Y-%m-%d", time.localtime()), file=rom_file) - print(" */", file=rom_file) - print("", file=rom_file) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=rom_file) - # print(".code 32", file=rom_file) - # print("#include \"rom_callback.h\"", file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = 0 - for list_line in rom_func_list: - # 这里对齐不顶用,在link script脚本里按照8字节对齐,因为riscv的tail指令在长跳和短跳时链接后的汇编长度会不一样,统一对齐到8字节 - # print(".align 8", file=rom_file) - print(".section .%s.romcall.text, \"ax\"" % list_line, file=rom_file) - print(".globl %s%s" % (romcallback_prefix_str, list_line), file=rom_file) - print(".type %s%s, %%function" % (romcallback_prefix_str, list_line), file=rom_file) - print("%s%s:" % (romcallback_prefix_str, list_line), file=rom_file) - print(" tail %s%s" % (romcallback_real_prefix, list_line), file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = veneer_rom_cnt + 1 - # print(".end", file=rom_file) - # print("// %d veneer functions" % veneer_rom_cnt, file=rom_file) - print("#endif // _PRE_FEATURE_VENEER_ROM", file=rom_file) - -# 宏替换改成链接替换!! -def rom_gen_macros_redefine_file(): - with open(argv_list[auto_redefine_macro_file_str], "w+") as auto_redefine_macro_file: - # auto file header gen - print("# rom callback wrap function config, auto gen by py!", file=auto_redefine_macro_file) - print("set(CMAKE_CB_FLGAS ${CMAKE_CB_FLGAS} -Wl", end="", file=auto_redefine_macro_file) - for list_line in rom_func_list: - # output redefine macros to rom sections - print(",--wrap=%s" % list_line, end="", file=auto_redefine_macro_file) - print(")", file=auto_redefine_macro_file) - -def rom_func_source_gen(): - rom_gen_macros_redefine_file() - target_str = argv_list["target"] - if target_str == "arm32": - rom_gen_arm32_assemfile() - elif target_str == "riscv32": - rom_gen_riscv32_assemfile() - else: - print("unsupport target: %s" % target_str) - sys.exit(1) - - -def print_manual(err_msg): - print("%s " % err_msg) - print("%s argument=xxx" % sys.argv[0]) - print("arguments: ") - for key in argv_list: - print("%s=..." % key) - - -def dump_all_arguments(): - print("input arguments information: ") - for key in argv_list: - print("argument: %s=%s" % (key, argv_list[key])) - - -def print_unkown_arg(msg): - err_msg = "unknown argument: " + msg - print_manual(err_msg) - sys.exit(1) - - -def print_input_arg(msg): - print("%s" % msg) - for arg in sys.argv[1:]: - print("%s" % arg) - - -def parse_args(target, output): - for key, value in argv_list.items(): - if key == "target": - argv_list["target"] = target - else: - file_path = os.path.join(output, input_file_list[key]) - # check_file_exist(file_path) - argv_list[key] = file_path - dump_all_arguments() - - -def init_val(): - global undef_rom_symbol_list - global undef_result_symbols_list - global rom_func_list - global rom_data_list - global undef_list_filter - global dict_all_symbols_glb - global rom_ram_call_leacy_list - undef_rom_symbol_list = [] - undef_result_symbols_list = [] - rom_func_list = [] - rom_data_list = [] - undef_list_filter = [] - dict_all_symbols_glb = dict() - rom_ram_call_leacy_list = [] - -# input argvs: -# output argvs -def gen_rom_ram_callback(target, output): - parse_args(target, output) - init_val() - undef_symbol_filter_load() - undef_symbol_load() - rom_rel_load() - undef_symbols_type_process() - classify_undef_symbols() - rom_func_source_gen() - rom_parse_region_file_list() - rom_function_lds_gen() diff --git a/build/script/rom_ram_callback/gen_rom_ram_callback_v1.py b/build/script/rom_ram_callback/gen_rom_ram_callback_v1.py deleted file mode 100755 index ada1879..0000000 --- a/build/script/rom_ram_callback/gen_rom_ram_callback_v1.py +++ /dev/null @@ -1,506 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved. - -import sys -import os -import re -import time - -# .o中得到的undef symbols -undef_rom_symbol_list = [] -# 待处理的undef symbls, 全局函数和全局变量,再通过elf目标区分符号的类型 -undef_result_symbols_list = [] -# 需要处理的rom-ram 函数符号列表 -rom_func_list = [] -# 需要处理的rom-ram 数据区符号列表 -rom_data_list = [] -# 特殊undef symbols过滤列表 -undef_list_filter = [] -# 包含所有全局链接符号的字典 -dict_all_symbols_glb = dict() -# 被优化或者特殊ROM-RAM call符号列表 -rom_ram_call_leacy_list = [] - -# 长跳中转函数后缀名 -romcallback_suffix_str = "_veneer_rom" - -# filenames from outside -# undef symbols from elf -# nm -u ~/wifi_rom.o |awk '{print $NF}' > ~/wifi_rom.undef -undef_file_str = "undef_file" - -# undef symbols filter list, remove special symbols from undef_file -undef_filter_str = "undef_filter" - -# relocation information file, include all rel info for undef symbols, file maybe huge large -# readelf -W -r ~/wifi_rom.o > ~/wifi_rom.rel -rel_file_str = "rel_file" - -# all compile symbols from elf file -# readelf -W -s ~/asic.elf > ~/image_symbols.list -image_elf_str = "image_elf" - -# link script section config file, rw section config list -region_file_str = "region_file" - -# result files -# source code auto gen -# veneer long jump assemable code -rom_file_str = "rom_file" -# redefine macros for undef function symbols -auto_redefine_macro_file_str = "auto_redefine_macro_file" -# undef symbols function & data report list -rom_ram_call_func_file_str = "rom_ram_call_func_file" -rom_ram_call_data_file_str = "rom_ram_call_data_file" -rom_ram_call_leacy_file_str = "rom_ram_call_leacy_file" -rom_ram_data_leacy_file_str = "data_leacy_file" -# rom-ram function & data fix section define link scripts -lds_data_file_str = "lds_data_file" -func_lds_file_str = "func_lds_file" - -none_path = "null" - -argv_list = { - undef_file_str: none_path, - undef_filter_str: none_path, - rel_file_str: none_path, - image_elf_str: none_path, - region_file_str: none_path, - rom_file_str: none_path, - auto_redefine_macro_file_str: none_path, - rom_ram_call_func_file_str: none_path, - rom_ram_call_data_file_str: none_path, - rom_ram_call_leacy_file_str: none_path, - lds_data_file_str: none_path, - func_lds_file_str: none_path, - rom_ram_data_leacy_file_str: none_path, - # cpu target(arm32, riscv32.) - "target": "riscv32" -} - -input_file_list = { - undef_file_str: "rom_bin.undef", - undef_filter_str: "undef_rom_filter.list", - rel_file_str: "rom_bin.rel", - image_elf_str: "image_symbol.list", - region_file_str: "region.list", - rom_file_str: "rom_callback.S", - auto_redefine_macro_file_str: "auto_include_rom.h", - rom_ram_call_func_file_str: "rom_ram_func.list", - rom_ram_call_data_file_str: "rom_ram_call_data.list", - rom_ram_call_leacy_file_str: "rom_ram_call_leacy.list", - lds_data_file_str: "data.lds", - func_lds_file_str: "function.lds", - rom_ram_data_leacy_file_str: "data_leacy.list" -} - - -def check_file_exist(path): - if not os.path.exists(path): - err_msg = "path: " + path + " not exist!!" - print_manual(err_msg) - sys.exit(1) - - -# 根据数据符号名查找地址判断符号是zi还是rw符号,根据配置文件定义生成链接脚本定义,在lds中自己调用 -def rom_parse_region_file_list(): - rom_data_list_dict = dict() - for var in rom_data_list: - rom_data_list_dict[var] = dict_all_symbols_glb.get(var) - check_file_exist(argv_list[region_file_str]) - - with open(argv_list[region_file_str], "r") as region_file, open( - argv_list[lds_data_file_str], "w+") as lds_data_file: - line = region_file.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if line.find('#', 0, 1) >= 0: - line = region_file.readline() - continue - if line.split(",").__len__() != 4: - print("invalid region item:%s, must be 4 cols" % line) - sys.exit(1) - region_len = line.split(",").__len__() - region_type = line.split(",")[0] - region_name = line.split(",")[1] - region_begin = line.split(",")[2] - region_end = line.split(",")[3] - if not dict_all_symbols_glb.get(region_begin): - # 找不到_SXXXX 或者_EXXXX 直接报错 - print("can't found %s in image symbols list, break" % region_begin) - sys.exit(1) - if not dict_all_symbols_glb.get(region_end): - # 找不到_SXXXX 或者_EXXXX 直接报错 - print("can't found %s in image symbols list, break" % region_end) - sys.exit(1) - # 处理数据符号 - region_begin_value = dict_all_symbols_glb[region_begin] - region_end_value = dict_all_symbols_glb[region_end] - # print("region %s:%s [0x%x:0x%x]" % (region_begin, region_end, region_begin_value, region_end_value)) - if region_end_value == region_begin_value: - # 区间相等,为空段 - # print("empty region, skip") - print("#define %s" % region_name, file=lds_data_file) - elif region_end_value < region_begin_value: - print("invalid region range %s:%s [0x%x:0x%x]" % ( - region_begin, region_end, region_begin_value, region_end_value)) - sys.exit(1) - else: - # 遍历所有的数据符号,加入对应的分区 - # 遍历所有的需要处理的变量符号(包括data & bss) - lds_str = "" - for var in rom_data_list: - if not dict_all_symbols_glb.get(var): - # fatal err - print("can't found %s in dict" % var) - if not rom_data_list_dict.get(var): - # 当前符号已经处理过 - print("%s been dealt with in dict" % var) - continue - var_address = dict_all_symbols_glb[var] - if (var_address >= region_begin_value) and (var_address < region_end_value): - # 符号地址落在该region范围内 - # print("%s in region %s" % (var, line)) - lds_str = "%sKEEP(*.o*(.%s.%s));" % (lds_str, region_type, var) - del rom_data_list_dict[var] - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=lds_data_file) - print("#define %s _S%s = .;%s; _E%s = .;" % (region_name, region_name, lds_str, region_name), file=lds_data_file) - print("#else", file=lds_data_file) - print("#define %s _S%s = .;%s; _E%s = .;" % (region_name, region_name, "", region_name), file=lds_data_file) - print("#endif", file=lds_data_file) - line = region_file.readline() - - # 保存没有被处理的变量符号,这些符号不在region list 范围内,可能是指定地址存放,不需要脚本处理 - with open(argv_list[rom_ram_data_leacy_file_str], "w+") as rom_ram_data_leacy_file: - for key in rom_data_list_dict: - print("0x%x %s" % (rom_data_list_dict[key], key), file=rom_ram_data_leacy_file) - return True - - -# 生成函数段定义链接脚本宏文件 -def rom_function_lds_gen(): - with open(argv_list[func_lds_file_str], "w+") as func_lds_file: - lds_str = "" - for var in rom_func_list: - # 中转函数按照8字节对齐,2条4字节指令,riscv短指令只有4字节,ARM统一8字节, 一律按照8字节对齐 - lds_str = "%s . = ALIGN(8); KEEP(*.o*(.%s.romcall.text));" % (lds_str, var) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=func_lds_file) - # 跳转函数,不区分模块 - print("#define VENEER_TEXT _SVENEER_TEXT = .;%s_EVENEER_TEXT = .;. = ALIGN(8);" % lds_str, file=func_lds_file) - print("#else", file=func_lds_file) - print("#define VENEER_TEXT", file=func_lds_file) - print("#endif", file=func_lds_file) - - -rom_rel_ro_list = ['Relocation section \'.rel.text', - 'Relocation section \'.rel.rodata', - 'Relocation section \'.rela.text', - 'Relocation section \'.rela.rodata'] - - -def rom_rel_check_ro_section(line): - for ro in rom_rel_ro_list: - if line.find(ro) >= 0: - return True - return False - - -# 解析rom.o中的代码段范围内undef符号列表 -def rom_rel_load(): - # global undef_rom_symbol_list - check_file_exist(argv_list[rel_file_str]) - with open(argv_list[rel_file_str], "r") as rel_file: - line = rel_file.readline() - while line: - # line = rel_file.readline() - if rom_rel_check_ro_section(line): - # print("%s" % line) - # skip Offset row - line = rel_file.readline() - line = rel_file.readline() - while line: - if line.find('0', 0, 1) < 0: - break - if line.split().__len__() < 5: - line = rel_file.readline() - continue - # print("%s" % line) - # print ("%s %s" % (line.split()[2],line.split()[4])) - rel_type = line.split()[2] - # rel 文件 第5列表示符号名称, 如果解析错误,说明readelf 版本可能不匹配 - rel_symbol_name = line.split()[4] - # print("%s %s" % (rel_type, rel_symbol_name)) - if undef_rom_symbol_list.count(rel_symbol_name) <= 0: - line = rel_file.readline() - continue - if undef_result_symbols_list.count(rel_symbol_name) <= 0: - undef_result_symbols_list.append(rel_symbol_name) - # alg_autorate_init_user_legacy_rate_set_capability_extend - # print("%s" % rel_symbol_name) - line = rel_file.readline() - else: - line = rel_file.readline() - - -# 根据elf信息给undef symbols分类,函数还是数据类型 -def undef_symbols_type_process(): - global undef_result_symbols_list - func_list = [] - data_list = [] - check_file_exist(argv_list[image_elf_str]) - with open(argv_list[image_elf_str], "r") as image_elf: - line = image_elf.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - - if (line.split().__len__() != 8) or len(line) <= 0 or (line.split()[4] != "GLOBAL"): - # if line.split().__len__() == 8: - # print("image1 elf: %s %s %s" % (line.split()[3], line.split()[4], line.split()[7])) - line = image_elf.readline() - continue - else: - symbol_name = line.split()[7] - symbol_address = int(line.split()[1], 16) - if dict_all_symbols_glb.get(symbol_name): - print("symbol name:%s repeat" % symbol_name) - else: - dict_all_symbols_glb[symbol_name] = symbol_address - # print("add dict %s => %s" % (symbol_name, symbol_address)) - # print("image2 elf: %s %s %s" % (line.split()[3], line.split()[4], line.split()[7])) - if line.split()[3] == "FUNC": - # print("FUNC: %s" % line.split()[7]) - func_list.append(line.split()[7]) - if line.split()[3] == "OBJECT": - # print("DATA: %s" % line.split()[7]) - data_list.append(line.split()[7]) - line = image_elf.readline() - - for symbol_i in undef_result_symbols_list: - # print("symbol_i: %s" % symbol_i) - if func_list.count(symbol_i) > 0: - # 类型是函数,去重 - # print("symbol_i: %s" % symbol_i) - if rom_func_list.count(symbol_i) <= 0: - rom_func_list.append(symbol_i) - elif data_list.count(symbol_i) > 0: - # 类型是数据,去重 - # print("symbol_i: %s" % symbol_i) - if rom_data_list.count(symbol_i) <= 0: - rom_data_list.append(symbol_i) - else: - # 未识别符号,可能被编译器优化或者是特殊定义符号 - print("unkown undef symbol type: %s, not function or data or removed when ld" % symbol_i) - rom_ram_call_leacy_list.append(symbol_i) - rom_func_list.sort() - rom_data_list.sort() - rom_ram_call_leacy_list.sort() - - -def classify_undef_symbols(): - with open(argv_list[rom_ram_call_func_file_str], "w+") as rom_ram_call_func_file: - with open(argv_list[rom_ram_call_data_file_str], "w+") as rom_ram_call_data_file: - with open(argv_list[rom_ram_call_leacy_file_str], "w+") as rom_ram_call_leacy_file: - - for func_i in rom_func_list: - # 重定向汇编中引用的外部函数符号需要处理 - print("%s" % func_i, file=rom_ram_call_func_file) - for data_i in rom_data_list: - # 重定向汇编中引用的外部数据符号需要处理 - print("%s" % data_i, file=rom_ram_call_data_file) - for undef_i in undef_rom_symbol_list: - # 重定向汇编中未使用的外部数据和函数符号认为不影响ROM码点,可以不处理 - if (rom_func_list.count(undef_i) <= 0) and (rom_data_list.count(undef_i) <= 0): - print("%s" % undef_i, file=rom_ram_call_leacy_file) - for sym in rom_ram_call_leacy_list: - print("%s" % sym, file=rom_ram_call_leacy_file) - - -def undef_symbol_filter_load(): - global undef_filter - check_file_exist(argv_list[undef_filter_str]) - with open(argv_list[undef_filter_str], "r") as undef_filter: - line = undef_filter.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if (len(line) > 0) and (line.find('#', 0, 1) < 0): - undef_list_filter.append(line) - line = undef_filter.readline() - - -def undef_symbol_load(): - check_file_exist(argv_list[undef_file_str]) - with open(argv_list[undef_file_str], "r") as undef_file: - white_list = ["OsIdleTask"] - line = undef_file.readline() - # global undef_rom_symbol_list - global undef_list_filter - global undef_result_symbols_list - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if line.split().__len__() < 2: - print("error format for %s file, str=%s" % (argv_list[undef_file_str], line)) - sys.exit(1) - if line.split()[0] != 'U': - continue; - line = line.split()[1] - if undef_list_filter.count(line) <= 0: - # undef_result_symbols_list.append(line) - undef_rom_symbol_list.append(line) - else: - print("filter undef symbol %s" % line) - line = undef_file.readline() - undef_rom_symbol_list.extend(white_list) - undef_rom_symbol_list.sort() - - -def rom_gen_arm32_assemfile(): - with open(argv_list[rom_file_str], "w+") as rom_file: - print("/*", file=rom_file) - print(" * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved.", file=rom_file) - print(" * Description: Rom Callback Functions by Assemble(arm32), Auto Generate by Python.", file=rom_file) - print(" * Author: Platform", file=rom_file) - # print(" * Create: %s" % time.strftime("%Y-%m-%d", time.localtime()), file=rom_file) - print(" */", file=rom_file) - print("", file=rom_file) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=rom_file) - # print(".code 32", file=rom_file) - print(".thumb", file=rom_file) - print(".syntax unified", file=rom_file) - # print("#include \"rom_callback.h\"", file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = 0 - for list_line in rom_func_list: - print(".section .%s.romcall.text, \"ax\"" % list_line, file=rom_file) - print(".globl %s%s" % (list_line, romcallback_suffix_str), file=rom_file) - print(".type %s%s, %%function" % (list_line, romcallback_suffix_str), file=rom_file) - print("%s%s:" % (list_line, romcallback_suffix_str), file=rom_file) - print(" LDR PC, =%s" % list_line, file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = veneer_rom_cnt + 1 - print(".end", file=rom_file) - # print("// %d veneer functions" % veneer_rom_cnt, file=rom_file) - print("#endif // _PRE_FEATURE_VENEER_ROM", file=rom_file) - - -def rom_gen_riscv32_assemfile(): - with open(argv_list[rom_file_str], "w+") as rom_file: - print("/*", file=rom_file) - print(" * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved.", file=rom_file) - print(" * Description: Rom Callback Functions by Assemble(riscv32), Auto Generate by Python.", file=rom_file) - print(" * Author: Platform", file=rom_file) - # print(" * Create: %s" % time.strftime("%Y-%m-%d", time.localtime()), file=rom_file) - print(" */", file=rom_file) - print("", file=rom_file) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=rom_file) - # print(".code 32", file=rom_file) - # print("#include \"rom_callback.h\"", file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = 0 - for list_line in rom_func_list: - # 这里对齐不顶用,在link script脚本里按照8字节对齐,因为riscv的tail指令在长跳和短跳时链接后的汇编长度会不一样,统一对齐到8字节 - # print(".align 8", file=rom_file) - print(".section .%s.romcall.text, \"ax\"" % list_line, file=rom_file) - print(".globl %s%s" % (list_line, romcallback_suffix_str), file=rom_file) - print(".type %s%s, %%function" % (list_line, romcallback_suffix_str), file=rom_file) - print("%s%s:" % (list_line, romcallback_suffix_str), file=rom_file) - print(" tail %s" % list_line, file=rom_file) - print("", file=rom_file) - veneer_rom_cnt = veneer_rom_cnt + 1 - # print(".end", file=rom_file) - # print("// %d veneer functions" % veneer_rom_cnt, file=rom_file) - print("#endif // _PRE_FEATURE_VENEER_ROM", file=rom_file) - - -def rom_gen_macros_redefine_file(): - with open(argv_list[auto_redefine_macro_file_str], "w+") as auto_redefine_macro_file: - # auto file header gen - print("/*", file=auto_redefine_macro_file) - print(" * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2021-2030. All rights reserved.", - file=auto_redefine_macro_file) - print(" * Description: Rom Callback Redefine Macros, Auto Generate by Python.", file=auto_redefine_macro_file) - print(" * Author: Platform", file=auto_redefine_macro_file) - # print(" * Create: %s" % time.strftime("%Y-%m-%d", time.localtime()), file=auto_redefine_macro_file) - print(" */", file=auto_redefine_macro_file) - print("", file=auto_redefine_macro_file) - print("#ifndef AUTO_INCLUDE_ROM_H", file=auto_redefine_macro_file) - print("#define AUTO_INCLUDE_ROM_H", file=auto_redefine_macro_file) - print("", file=auto_redefine_macro_file) - print("#ifdef _PRE_FEATURE_VENEER_ROM", file=auto_redefine_macro_file) - macros_cnt = 0 - - for list_line in rom_func_list: - # output redefine macros to rom sections - print("#define %s %s%s" % (list_line, list_line, romcallback_suffix_str), file=auto_redefine_macro_file) - macros_cnt = macros_cnt + 1 - # print("// %d macros redefine" % macros_cnt, file=auto_redefine_macro_file) - print("#endif // _PRE_FEATURE_VENEER_ROM", file=auto_redefine_macro_file) - print("#endif", file=auto_redefine_macro_file) - - -def rom_func_source_gen(): - rom_gen_macros_redefine_file() - target_str = argv_list["target"] - if target_str == "arm32": - rom_gen_arm32_assemfile() - elif target_str == "riscv32": - rom_gen_riscv32_assemfile() - else: - print("unsupport target: %s" % target_str) - sys.exit(1) - - -def print_manual(err_msg): - print("%s " % err_msg) - print("%s argument=xxx" % sys.argv[0]) - print("arguments: ") - for key in argv_list: - print("%s=..." % key) - - -def dump_all_arguments(): - print("input arguments information: ") - for key in argv_list: - print("argument: %s=%s" % (key, argv_list[key])) - - -def print_unkown_arg(msg): - err_msg = "unknown argument: " + msg - print_manual(err_msg) - sys.exit(1) - - -def print_input_arg(msg): - print("%s" % msg) - for arg in sys.argv[1:]: - print("%s" % arg) - - -def parse_args(target, output): - for key, value in argv_list.items(): - if key == "target": - argv_list["target"] = target - else: - file_path = os.path.join(output, input_file_list[key]) - # check_file_exist(file_path) - argv_list[key] = file_path - dump_all_arguments() - - -# input argvs: -# output argvs -def gen_rom_ram_callback(target, output): - print("gen rom ram cbundef") - parse_args(target, output) - undef_symbol_filter_load() - undef_symbol_load() - rom_rel_load() - undef_symbols_type_process() - classify_undef_symbols() - rom_func_source_gen() - rom_parse_region_file_list() - rom_function_lds_gen() diff --git a/build/script/rom_ram_callback/strip_undef_symbols.py b/build/script/rom_ram_callback/strip_undef_symbols.py deleted file mode 100755 index 684c9e8..0000000 --- a/build/script/rom_ram_callback/strip_undef_symbols.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python -# coding:utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2023. All rights reserved. - -import sys -import os -import re -import time - -undef_rom_symbol_list = [] -undef_result_symbols_list = [] -# 在其他rom中定义的符号 -undef_rom_defined_list = [] -rom_defined_list = [] - -none_path = "null" - -argv_list = { - "undef_raw_file": none_path, - "rom_symbol_file": none_path, - "undef_file": none_path -} - -input_file_list = { - "undef_raw_file": "rom_bin_raw.undef", - "rom_symbol_file": "rom_symbol.list", - "undef_file": "rom_bin.undef" -} - - -def check_file_exist(path): - if not os.path.exists(path): - err_msg = "path: " + path + " not exist!!" - print_manual(err_msg) - sys.exit(1) - - -def undef_symbol_load(): - global undef_rom_symbol_list - undef_rom_symbol_list = [] - check_file_exist(argv_list['undef_raw_file']) - with open(argv_list['undef_raw_file'], "r") as undef_file: - line = undef_file.readline() - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - if line.split().__len__() < 2: - print("error format for %s file, str=%s" % ('undef_raw_file', line)) - sys.exit(1) - undef_symbol_name = line.split()[1] - # print("undef %s duplicate" % undef_symbol_name) - if undef_rom_symbol_list.count(undef_symbol_name) <= 0: - # 所有undefine 符号集合, 但是有的undefine符号有可能是在其他rom文件中定义,所以后面还要筛选 - undef_rom_symbol_list.append(undef_symbol_name) - # else: - # print("undef %s duplicate" % undef_symbol_name) - line = undef_file.readline() - undef_rom_symbol_list.sort() - - -def rom_defined_symbol_load(): - global rom_defined_list - check_file_exist(argv_list['rom_symbol_file']) - with open(argv_list['rom_symbol_file'], "r") as image_elf: - rom_defined_list = [] - line = image_elf.readline() - count = 0 - while line: - line = line.replace('\r', '') - line = line.replace('\n', '') - - if (line.split().__len__() != 8) or len(line) <= 0 or (line.split()[4] != "GLOBAL"): - # if line.split().__len__() == 8: - # print("image1 elf: %s %s %s" % (line.split()[3], line.split()[4], line.split()[7])) - line = image_elf.readline() - continue - else: - symbol_name = line.split()[7] - if (line.split()[3] != "FUNC") and (line.split()[3] != "OBJECT"): - line = image_elf.readline() - continue - if rom_defined_list.count(symbol_name) <= 0: - # 添加所有定义过的符号 - rom_defined_list.append(symbol_name) - count = count + 1 - # print("D %s" % symbol_name) - line = image_elf.readline() - print("all objs defined %d data & functions" % count) - - -def gen_rom_undef_target_file(): - global undef_rom_defined_list - global undef_result_symbols_list - undef_cnt = 0 - def_cnt = 0 - with open(argv_list['undef_file'], "w+") as rom_undef: - undef_result_symbols_list = [] - undef_rom_defined_list = [] - for undef_s in undef_rom_symbol_list: - # 在rom代码中没有定义,是undef符号 - if rom_defined_list.count(undef_s) <= 0: - # print("undef %s duplicate" % undef_s) - undef_result_symbols_list.append(undef_s) - undef_cnt = undef_cnt + 1 - else: - undef_rom_defined_list.append(undef_s) - def_cnt = def_cnt + 1 - - undef_result_symbols_list.sort() - undef_rom_defined_list.sort() - for undef_s in undef_result_symbols_list: - print("undef %s duplicate" % undef_s) - print("U %s" % undef_s, file=rom_undef) - print("all objs had %d undef symbols, and %d defined symbols" % (undef_cnt, def_cnt)) - -def print_manual(err_msg): - print("%s " % err_msg) - print("%s argument=xxx" % sys.argv[0]) - print("arguments: ") - for key in argv_list: - print("%s=..." % key) - - -def dump_all_arguments(): - print("input arguments information: ") - for key in argv_list: - print("argument: %s=%s" % (key, argv_list[key])) - - -def print_unkown_arg(msg): - err_msg = "unknown argument: " + msg - print_manual(err_msg) - sys.exit(1) - - -def print_input_arg(msg): - print("%s" % msg) - for arg in sys.argv[1:]: - print("%s" % arg) - - -def parse_args(output): - # 解析多个参数 *.py file= - for key, value in argv_list.items(): - file_path = os.path.join(output, input_file_list[key]) - # check_file_exist(file_path) - argv_list[key] = file_path - dump_all_arguments() - - -# input argvs: -# output argvs -def strip_undefined_symbols(output): - parse_args(output) - undef_symbol_load() - rom_defined_symbol_load() - gen_rom_undef_target_file() \ No newline at end of file diff --git a/build/script/sdk_generator/__pycache__/sdk_generator.cpython-37.pyc b/build/script/sdk_generator/__pycache__/sdk_generator.cpython-37.pyc deleted file mode 100755 index 00f3772..0000000 Binary files a/build/script/sdk_generator/__pycache__/sdk_generator.cpython-37.pyc and /dev/null differ diff --git a/build/script/sdk_generator/__pycache__/sdk_generator.cpython-39.pyc b/build/script/sdk_generator/__pycache__/sdk_generator.cpython-39.pyc deleted file mode 100644 index c53a7b9..0000000 Binary files a/build/script/sdk_generator/__pycache__/sdk_generator.cpython-39.pyc and /dev/null differ diff --git a/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-37.pyc b/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-37.pyc deleted file mode 100755 index dc572a2..0000000 Binary files a/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-37.pyc and /dev/null differ diff --git a/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-39.pyc b/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-39.pyc deleted file mode 100644 index fdd421e..0000000 Binary files a/build/script/sdk_generator/__pycache__/target_config_genarator.cpython-39.pyc and /dev/null differ diff --git a/build/script/sdk_generator/project_generator.py b/build/script/sdk_generator/project_generator.py deleted file mode 100755 index 2fdf9b0..0000000 --- a/build/script/sdk_generator/project_generator.py +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# ========================================================================= -# @brief Project genarator, parse compiler info & generate IAR/Makefile... project file -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. -# ========================================================================= - -import copy -import os -import json -import re -import shutil -import sys - -script_dir = os.path.split(os.path.normpath(__file__))[0] -makefile_template = os.path.join(script_dir, "sdk_template", "makefile") - -def load_json(json_file): - with open(json_file, 'r') as f: - temp = f.read() - return json.loads(temp) - -class CompileCommandParser: - def __init__(self, cc_file): - temp = load_json(cc_file) - self.compile_info = {} - for item in temp: - self.compile_info[item['file']] = { - 'command': item['command'], - 'directory': item['directory'], - } - - def get_src_compile_info(self, src_name): - command = self.compile_info[src_name]['command'] - defines = re.findall(r"-D([^ ]*)", command) - includes = re.findall(r"-I([^ ]*)", command) - - ccflags = list(set(re.findall(r" (-[^ID][^ ]*)", command))) - ccflags.remove('-c') - ccflags.remove('-o') - pre_include = [] - if '-include' in ccflags: - ccflags.remove('-include') - pre_include = list(set(re.findall(r" -include ([^ ]*)", command))) - ccflags.extend(['-include ' + x for x in pre_include]) - return { - "DEFINES": list(set(defines)), - "INCLUDES": list(set(includes)), - "CCFLAGS": ccflags, - "PRE_INCLUDE": pre_include, - } - -class ComponentParser(CompileCommandParser): - def __init__(self, component_info_file, compile_command_file): - super(ComponentParser, self).__init__(compile_command_file) - with open(component_info_file, 'r') as fp: - data = fp.read() - data = data.replace('="', r'=\\\"') - data = data.replace('";', r'\\\";') - data = data.replace(r' \\\";', r' ";') - info = json.loads(data) - self.component_info = info.pop("COMPONENTS") - self.public_info = copy.deepcopy(info) - self.public_info["COMPONENT_LIST"] = list(self.component_info.keys()) - self.public_info["CHIP"] = chip - self.public_info["CORE"] = core - self.public_info["ARCH"] = arch - self.public_info["TARGET_NAME"] = application_name - self.public_info["PKG_TARGET_NAME"] = pkg_target_name - for item, value in self.public_info.items(): - if isinstance(value, str): - self.public_info[item] = [i for i in value.split(";") if i != ''] - for component, value in self.component_info.items(): - if not value["SOURCES"]: - continue - - for component_items in value: - if isinstance(value[component_items], str): - value[component_items] = [i for i in value[component_items].split(";") if i != ''] - src = value["SOURCES"] - -class MakefileGenerator(ComponentParser): - def __init__(self, component_info_file, compile_command_file, project_file_dir, project_folder): - super(MakefileGenerator, self).__init__(component_info_file, compile_command_file) - self.replace_map = {} - # self.replace_map.update(toolchain) - self.project_file_dir = project_file_dir - self.project_folder = project_folder - self.make_dir = os.path.join(project_file_dir, project_folder, 'makefile') - if not os .path.exists(self.make_dir): - os.makedirs(self.make_dir) - self.gen_toolchain_file() - for component_name in self.component_info: - self.gen_component_file(component_name) - self.gen_root_file() - self.gen_makefile_cmd() - - def gen_makefile_cmd(self): - with open(os.path.join(sdk_output_dir, f'make.cmd'), 'a+') as f: - f.writelines(self.make_dir + '\n') - - def gen_toolchain_file(self): - with open(os.path.join(makefile_template, 'toolchain.make'), 'r') as f: - lines = f.readlines() - toolchain = load_json(toolchain_file) - for i, line in enumerate(lines): - lines[i] = self.deal_replace(line, toolchain) - with open(os.path.join(self.make_dir, f'toolchains.make'), 'w') as f: - f.writelines(lines) - - def gen_component_file(self, component_name): - compile_info = self.component_info[component_name] - template = os.path.join(makefile_template, 'component_template.make') - out_path = 'components' - if "THIRD_PARTY" in compile_info: - print(compile_info["SOURCES"]) - if "THIRD_PARTY" in compile_info and compile_info["THIRD_PARTY"][0] == "true": - template = os.path.join(makefile_template, 'third_party_template.make') - index = compile_info['COMPONENT_CUSTOM_CCFLAGS'].index("-include") - if index >= 0: - compile_info['COMPONENT_CUSTOM_CCFLAGS'][index] = "-include$(LITEOS_PLATFORM_MENUCONFIG_H)" - compile_info['COMPONENT_CUSTOM_CCFLAGS'].pop(index+1) - compile_info["COMPONENT_NAME"] = component_name - with open(template, 'r') as f: - lines = f.readlines() - for i, line in enumerate(lines): - lines[i] = self.deal_replace(line, compile_info) - if not os.path.exists(os.path.join(self.make_dir, out_path)): - os.makedirs(os.path.join(self.make_dir, out_path)) - with open(os.path.join(self.make_dir, out_path, f'{component_name}.make'), 'w') as f: - f.writelines(lines) - - def gen_root_file(self): - with open(os.path.join(makefile_template, 'template.mk'), 'r') as f: - lines = f.readlines() - for i, line in enumerate(lines): - lines[i] = self.deal_replace(line, self.public_info) - # if not os.path.exists(os.path.join(self.make_dir, 'components')): - # os.makedirs(os.path.join(self.make_dir, 'components')) - with open(os.path.join(self.make_dir, 'Makefile'), 'w') as f: - f.writelines(lines) - - def join_by_clum_num(self, lst, word, clum_num): - res = [] - if not lst: - return res - c_word = lst[0] - for item in lst: - if item == "": - continue - if c_word == 0: - c_word = item - continue - if len(c_word) + len(word) + len(item) <= clum_num: - c_word = f"{c_word}{word}{item}" - continue - res.append(c_word) - c_word = item - return res - - def deal_replace(self, line, replace_map): - l = re.findall("REPLACE_(\w*)", line) - for item in l: - if isinstance(replace_map[item], list): - replace_str = " \\\n ".join(replace_map[item]) - if replace_str: - replace_str = " \\\n %s" % (replace_str.strip()) - replace_str = replace_str.replace(root_dir, "$(SDK_ROOT)") - elif isinstance(replace_map[item], str): - replace_str = replace_map[item].replace(root_dir, "$(SDK_ROOT)") - else: - print(replace_map[item]) - line = line.replace(f"REPLACE_{item}", replace_str) - return line - -if __name__ == "__main__": - project_type = sys.argv[1] - application_name = sys.argv[2] - cc_json = sys.argv[3] - project_file_dir = sys.argv[4] - root_dir = sys.argv[5] - sdk_output_dir = sys.argv[6] - chip, core, board, arch, os_kernel, pkg_target_name = sys.argv[7].split(",") - toolchain_file = sys.argv[8] - component_info_file = sys.argv[9] - project_folder = f"{chip}_{core}_{board}_{os_kernel}_{pkg_target_name}" - project_type_list = project_type.split(",") - if 'makefile' in project_type_list: - MakefileGenerator(component_info_file, cc_json, project_file_dir, project_folder) diff --git a/build/script/sdk_generator/sdk_generator.py b/build/script/sdk_generator/sdk_generator.py deleted file mode 100755 index 4553e36..0000000 --- a/build/script/sdk_generator/sdk_generator.py +++ /dev/null @@ -1,323 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import json -import os -import sys -import time -import re - -from utils.build_utils import root_path, script_path, target_config_path, output_root -from utils.build_utils import pkg_tools_path, jlink_tools_path, lzma_tools_path, sign_tools_path, derived_tools_path, radar_tools_path -from utils.build_utils import CopyModule, exec_shell, cmp_file, rm_pyc, rm_all, fn_get_subdirs -from enviroment import TargetEnvironment -from sdk_generator.target_config_genarator import genarate_reserve_config - -sdk_copy_common_files = [ - os.path.join(script_path), - os.path.join(root_path, 'build.py'), - os.path.join(target_config_path), - os.path.join(pkg_tools_path), - os.path.join(jlink_tools_path), - os.path.join(lzma_tools_path), - os.path.join(sign_tools_path), - os.path.join(derived_tools_path), - os.path.join(radar_tools_path), -] - -sdk_close_components = [ -] - -def compare_path_bin(path1, path2): - for file in os.listdir(path1): - if not file.endswith('.bin'): - continue - if file.endswith('sign.bin'): - continue - f1 = os.path.join(path1, file) - f2 = os.path.join(path2, file) - print("Comparing:") - print(f1) - print(f2) - if not cmp_file(f1, f2): - print("DIFF") - return False - print("SAME") - return True - - -class SdkGenerator: - def __init__(self, env: TargetEnvironment, sdk_root_path: str): - self.env = env - self.sdk_root_path = sdk_root_path - replace_suffix = ['.srcrelease'] - if self.env.get('replace_suffix', False): - replace_suffix = self.env.get('replace_suffix', False) - print(replace_suffix) - self.copy_module = CopyModule(replace_root=sdk_root_path, replace_suffix=replace_suffix, copy_header = False) - self.org_target_output_path = [] - self.rm_line_map = {} - self.sub_cmake = {} - self.all_cmake = {} - chip = self.env.get("chip", False) - if not isinstance(chip, list): - self.chip = [chip] - else: - self.chip = chip - self.sdk_copy_module_mask_add() - self.copy_module.append_mask('.srcrelease') - - def parse_depend_cmake_files(self, cmake_trace_file): - with open(cmake_trace_file, 'r') as fp: - lines = fp.readlines() - - sdk_cmake_dict = {} - depend_cmake_files = [] - - for line in lines: - dict_ = json.loads(line) - if 'file' not in dict_: - continue - f = dict_['file'] - if not f.startswith(root_path) or f.startswith(output_root): - continue - if 'cmd' in dict_ and dict_['cmd'] == 'add_subdirectory': - if f not in self.sub_cmake: - self.sub_cmake[f] = set() - file_path = os.path.dirname(f) - if "$" in dict_['args'][0]: - continue - depend_cmake = os.path.join(file_path, dict_['args'][0], "CMakeLists.txt") - self.sub_cmake[f].add((int(dict_['line']), depend_cmake)) - if f in sdk_cmake_dict: - continue - sdk_cmake_dict[f] = None - self.all_cmake[f] = None - tmp = f.replace(root_path, self.sdk_root_path) - if self.is_close_component(tmp) == False: - if tmp.endswith("CMakeLists.txt"): - if os.path.exists(os.path.dirname(tmp)): - depend_cmake_files.append(f) - else: - depend_cmake_files.append(f) - return depend_cmake_files - - def copy_menuconfig(self): - for chip in self.chip: - if os.path.exists(os.path.join(root_path, 'build', 'config', 'target_config', chip, 'menuconfig')): - self.copy_srcs([os.path.join(root_path, 'build', 'config', 'target_config', chip, 'menuconfig')]) - self.copy_srcs([os.path.join(root_path, 'config.in')]) - - def copy_kconfig(self, cmake_trace_file): - depend_cmake_files = self.parse_depend_cmake_files(cmake_trace_file) - kconfig_fils = [] - for f in depend_cmake_files: - tmp = f.replace("CMakeLists.txt", 'Kconfig') - if os.path.exists(tmp): - kconfig_fils.append(tmp) - self.copy_srcs(kconfig_fils) - - def copy_depends(self, cmake_trace_file): - depend_cmake_files = self.parse_depend_cmake_files(cmake_trace_file) - cmake_dest = self.copy_srcs(depend_cmake_files) - for path in sdk_copy_common_files: - if not os.path.exists(path): - sdk_copy_common_files.remove(path) - self.copy_srcs(sdk_copy_common_files) - if self.env.get('use_memuconfig') != False: - self.copy_menuconfig() - self.copy_kconfig(cmake_trace_file) - if self.env.get('auto_gen_config'): - self.genarate_sdk_target_config(self.env.get('pkg_target_name', False)) - - def genarate_sdk_target_config(self, targets): - reserve = {} - for target in targets: - env = TargetEnvironment(target) - chip = env.get('chip') - if chip not in reserve: - reserve[chip] = {'target': [], 'template': []} - reserve[chip]['target'].append(target) - reserve[chip]['template'].append(env.get_target_template()) - - print(reserve) - for chip in reserve: - path = os.path.join(self.sdk_root_path, 'build', 'config', 'target_config', chip) - config_path = os.path.join(path, 'config.py') - template_path = os.path.join(path, 'target_config.py') - genarate_reserve_config(reserve[chip]['target'], config_path) - genarate_reserve_config(reserve[chip]['template'], template_path) - - - def rm_lines_in_file(self, _file, lines): - with open(_file, 'r') as fp_read: - text = fp_read.readlines() - lines = sorted(list(set(lines)), reverse=True) - for idx in lines: - text.pop(idx - 1) - - with open(_file, 'w') as fp_write: - fp_write.write("".join(text)) - - def copy_srcs(self, file_list): - dest_src = [] - for file in file_list: - if not os.path.exists(file): - print("SDK GENERATE ERROR!!") - print("FILE: %s is not exists!!" % file) - raise - dest = self.copy_module.copy(file) - if dest is not None: - dest_src.append(dest) - return dest_src - - def register_org_target_path(self, path): - self.org_target_output_path.append(path) - - def rm_cmake_lines(self): - rm_lines = {} - for f, line_dep in self.sub_cmake.items(): - for line, dep_cmake in line_dep: - if dep_cmake in self.all_cmake: - continue - if f not in rm_lines: - rm_lines[f] = [] - rm_lines[f].append(line) - for f, lines in rm_lines.items(): - sdk_file = f.replace(root_path, self.sdk_root_path) - self.rm_lines_in_file(sdk_file, lines) - - def sdk_copy_module_mask_add(self): - chip_mask = [] - path_list = [target_config_path] - for path_mask in path_list: - for name in fn_get_subdirs(path_mask): - if name not in self.chip and name not in chip_mask: - chip_mask.append(name) - self.copy_module.append_mask(chip_mask) - - def is_closed_component(self, component_name): - closed_components = self.env.get('closed_components', cmake_type=False) - open_components = self.env.get('open_components', cmake_type=False) - if isinstance(closed_components, list) and component_name in closed_components: - return True - elif isinstance(open_components, list) and component_name not in open_components: - return True - return False - - def sdk_delete_tmp_files(self): - delete_files = [] - delete_files.append(os.path.join(output_root, 'sdk', 'output')) - delete_files.append(os.path.join(output_root, 'sdk', 'make.cmd')) - for dir_path, dir_names, file_names in os.walk(os.path.join(output_root, 'sdk', 'interim_binary', self.env.get('chip'), 'libs'), topdown=False): - for name in file_names: - if name.endswith('.a'): - if not self.is_closed_component(name[3:-2]): - delete_files.append(os.path.join(dir_path, name)) - for dir_path, dir_names, file_names in os.walk(os.path.join(output_root, 'sdk', 'build', 'config', 'target_config', self.env.get('chip')), topdown=False): - for name in file_names: - if name.endswith('.srcrelease'): - delete_files.append(os.path.join(dir_path, name)) - rm_all(delete_files) - rm_pyc(os.path.join(output_root, 'sdk', 'build')) - rm_pyc(os.path.join(output_root, 'sdk', 'tools', 'pkg')) - - def sdk_build(self, build_time, nhso, build_level): - org_pwd = os.getcwd() - os.chdir(self.sdk_root_path) - - self.close_sdk_mem_limit() - self.change_sdk_version() - - build_targets = self.env.get('pkg_target_name', cmake_type=False) - print(build_targets) - sdk_type_list = self.env.get('sdk_type').split(';') - for idx, target in enumerate(build_targets): - sdk_build_cmd = ['./build.py', target] - if build_time != '': - sdk_build_cmd.append("-build_time=%s" %build_time) - if nhso == True: - sdk_build_cmd.append("-nhso") - if build_level == 'release': - sdk_build_cmd.append("-release") - - ret_code = exec_shell(sdk_build_cmd) - if ret_code: - sys.exit(1) - org_output_path = self.org_target_output_path[idx] - sdk_output_path = org_output_path.replace(root_path, self.sdk_root_path) - if not compare_path_bin(sdk_output_path, org_output_path): - print("sdk build failed") - sys.exit(1) - os.chdir(org_pwd) - if "makefile" in sdk_type_list: - self.sdk_makefile_build(nhso, build_level) - self.sdk_delete_tmp_files() - - def close_sdk_mem_limit(self): - if "SDK_NOT_MEM_LIMIT" not in self.env.config.get("defines", []): - return - chip_config_path = os.path.join('build', 'config', 'target_config', self.env.get('chip'), 'target_config.py') - with open(chip_config_path, "r") as f: - config_content = f.read() - print("new defines: SDK_NOT_MEM_LIMI, do not limit the memory size of the target in sdk") - with open(chip_config_path, "w") as f: - config_content = re.sub(r"'defines'\s?:\s?\[", r"'defines': [" + "'SDK_NOT_MEM_LIMIT', ", config_content) - f.write(config_content) - return - - def change_sdk_version(self): - sdk_version_cmd_define = "" - for build_def in self.env.config.get("defines", []): - if "SDK_VERSION=" not in build_def: - continue - sdk_version_cmd_define = build_def - break - if not sdk_version_cmd_define: - return - chip_config_path = os.path.join('build', 'config', 'target_config', self.env.get('chip'), 'target_config.py') - with open(chip_config_path, "r") as f: - config_content = f.read() - print(config_content) - print(f"change defines: {sdk_version_cmd_define}, change the version of sdk") - with open(chip_config_path, "w") as f: - sdk_version_cmd_define = sdk_version_cmd_define.replace("\"", "\\\"") - config_content = re.sub("SDK_VERSION" + r'''=.*?",''', sdk_version_cmd_define + '''",''', config_content) - print(config_content) - f.write(config_content) - return - - def is_close_component(self, path): - for f in sdk_close_components: - tmp = f.replace(root_path, self.sdk_root_path) - if path.startswith(tmp): - return True - return False - - def sdk_makefile_build(self, nhso, build_level): - with open(os.path.join(self.sdk_root_path, 'make.cmd'), 'r') as fp: - lines = fp.readlines() - idx = 0 - for line in lines: - org_pwd = os.getcwd() - start_time = time.time() - line = line.replace('\n', '') - os.chdir(line) - sdk_build_cmd = ['make', '-j48'] - if nhso == True: - sdk_build_cmd.append("nhso=true") - if build_level == 'release': - sdk_build_cmd.append("build_level=release") - ret_code = exec_shell(sdk_build_cmd) - if ret_code: - sys.exit(1) - end_time = time.time() - print("build %s takes %f s" % (line, end_time - start_time)) - org_output_path = self.org_target_output_path[idx] - sdk_output_path_makefile = "%s-makefile" % org_output_path.replace(root_path, self.sdk_root_path) - if not compare_path_bin(sdk_output_path_makefile, org_output_path): - print("sdk build failed") - sys.exit(1) - os.chdir(org_pwd) - idx = idx + 1 diff --git a/build/script/sdk_generator/sdk_template/makefile/component_template.make b/build/script/sdk_generator/sdk_template/makefile/component_template.make deleted file mode 100755 index c329986..0000000 --- a/build/script/sdk_generator/sdk_template/makefile/component_template.make +++ /dev/null @@ -1,91 +0,0 @@ -SRC_REPLACE_COMPONENT_NAME=REPLACE_SOURCES - -C_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.c,$(SRC_REPLACE_COMPONENT_NAME)))) -CPP_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.cpp,$(SRC_REPLACE_COMPONENT_NAME)))) -CPP_OBJ_REPLACE_COMPONENT_NAME += $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.cc,$(SRC_REPLACE_COMPONENT_NAME)))) -S_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.S,$(SRC_REPLACE_COMPONENT_NAME)))) -s_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.s,$(SRC_REPLACE_COMPONENT_NAME)))) -ALL_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(SRC_REPLACE_COMPONENT_NAME))) - -INCLUDES_TEMP_REPLACE_COMPONENT_NAME = REPLACE_PRIVATE_INCLUDE -INCLUDES_REPLACE_COMPONENT_NAME = $(patsubst %,-I%,$(INCLUDES_TEMP_REPLACE_COMPONENT_NAME)) -INCLUDES_REPLACE_COMPONENT_NAME += $(PUBLIC_INCLUDES) - -CCFLAGS_REPLACE_COMPONENT_NAME = $(PUBLIC_CCFLAGS) -CCFLAGS_REPLACE_COMPONENT_NAME += REPLACE_PRIVATE_CCFLAGS - -DEFINES_REPLACE_COMPONENT_NAME = $(PUBLIC_DEFINES) -DEFINES_TEMP_REPLACE_COMPONENT_NAME = REPLACE_PRIVATE_DEFINES -DEFINES_REPLACE_COMPONENT_NAME += $(patsubst %,-D%,$(DEFINES_TEMP_REPLACE_COMPONENT_NAME)) - -LIBS_REPLACE_COMPONENT_NAME = REPLACE_LIBS -WHOLE_LINK_REPLACE_COMPONENT_NAME = REPLACE_WHOLE_LINK -ifeq ("$(WHOLE_LINK_REPLACE_COMPONENT_NAME)", "true") - WHOLE_LINK_LIBS += REPLACE_COMPONENT_NAME - WHOLE_EXTERN_LINK_LIBS += $(LIBS_REPLACE_COMPONENT_NAME) -else - NORMAL_LINK_LIBS += REPLACE_COMPONENT_NAME - NORMAL_EXTERN_LINK_LIBS += $(LIBS_REPLACE_COMPONENT_NAME) -endif - -COMPONENT_NAME_REPLACE_COMPONENT_NAME=REPLACE_COMPONENT_NAME - -LIB_DIR_TEMP_REPLACE_COMPONENT_NAME = REPLACE_LIB_DIR - -LIB_DIR_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)) - -LIB_DIR += $(LIB_DIR_REPLACE_COMPONENT_NAME) - -LIB_EXIST := $(shell if [ -e "$(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a" ]; then echo "exist"; else echo "noexist"; fi ) - -MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME = REPLACE_MODULE_NAME -AUTO_DEF_TEMP_REPLACE_COMPONENT_NAME = REPLACE_AUTO_DEF - -lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a:$(ALL_OBJ_REPLACE_COMPONENT_NAME) HSO_DB_$(COMPONENT_NAME_REPLACE_COMPONENT_NAME) - @mkdir -p $(LIB_DIR_REPLACE_COMPONENT_NAME) - @$(RM) $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a -ifeq ("$(LIB_EXIST)", "noexist") - @echo building $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a - @$(AR) -rc $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a $(ALL_OBJ_REPLACE_COMPONENT_NAME) -else - @echo copy $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a - @cp $(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a $(LIB_DIR_REPLACE_COMPONENT_NAME) -endif - -$(C_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @${CCACHE} $(CC) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) -DTHIS_FILE_ID=$(shell echo $(patsubst %.c, %_c, $(notdir $<)) | tr '[a-z]' '[A-Z]') -DTHIS_MOD_ID=$(shell echo LOG_$(MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME)MODULE | tr '[a-z]' '[A-Z]') $< -o $@; - -$(CPP_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @${CCACHE} $(CXX) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) -DTHIS_FILE_ID=$(shell echo $(patsubst %.cpp, %_cpp, $(notdir $<)) | tr '[a-z]' '[A-Z]') -DTHIS_MOD_ID=$(shell echo LOG_$(MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME)MODULE | tr '[a-z]' '[A-Z]') $< -o $@; - -$(s_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @$(AS) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) -DTHIS_FILE_ID=$(shell echo $(patsubst %.c, %_c, $(notdir $<)) | tr '[a-z]' '[A-Z]') -DTHIS_MOD_ID=$(shell echo LOG_$(MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME)MODULE | tr '[a-z]' '[A-Z]') $< -o $@; - -$(S_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @$(AS) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) -DTHIS_FILE_ID=$(shell echo $(patsubst %.c, %_c, $(notdir $<)) | tr '[a-z]' '[A-Z]') -DTHIS_MOD_ID=$(shell echo LOG_$(MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME)MODULE | tr '[a-z]' '[A-Z]') $< -o $@; - -HSO_DB_$(COMPONENT_NAME_REPLACE_COMPONENT_NAME): -ifneq ("$(BIN_NAME).bin", "ssb.bin") -ifneq ("$(words $(SRC_REPLACE_COMPONENT_NAME))", "0") -ifneq ($(nhso), true) -ifeq ("$(LIB_EXIST)", "noexist") - @echo building $(COMPONENT_NAME_REPLACE_COMPONENT_NAME) HSO DB - @echo -n $(LOG_DEF_LIST) | sed 's/ /,/g' > $(HSO_TMP)/$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).txt - @echo -n "####" >> $(HSO_TMP)/$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).txt - @echo -n $(SRC_REPLACE_COMPONENT_NAME) | sed 's/ /,/g' >> $(HSO_TMP)/$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).txt - @python3 $(HSO_MK_XML_PY) ${SDK_ROOT}/ ${CHIP} ${CORE} ${ARCH} ${AUTO_DEF_TEMP_REPLACE_COMPONENT_NAME} ${MODULE_NAME_TEMP_REPLACE_COMPONENT_NAME} FALSE $(HSO_TMP)/$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).txt -endif -endif -else - @echo "skip building $(COMPONENT_NAME_REPLACE_COMPONENT_NAME) HSO DB" -endif -endif -include ./toolchains.make diff --git a/build/script/sdk_generator/sdk_template/makefile/template.mk b/build/script/sdk_generator/sdk_template/makefile/template.mk deleted file mode 100755 index 834abe6..0000000 --- a/build/script/sdk_generator/sdk_template/makefile/template.mk +++ /dev/null @@ -1,93 +0,0 @@ -export SDK_ROOT:=$(abspath $(shell pwd)/../../../../..) - -export CHIP=REPLACE_CHIP -export CORE=REPLACE_CORE -export ARCH=REPLACE_ARCH -export ARCH_FAMILY=REPLACE_ARCH_FAMILY -export TARGET_NAME=REPLACE_TARGET_NAME -export KERNEL=REPLACE_KERNEL -export LOG_DEF_LIST=REPLACE_LOG_DEF_LIST -export PKG_TARGET_NAME=REPLACE_PKG_TARGET_NAME - -export OUTPUT_DIR:=$(SDK_ROOT)/output/$(CHIP)/$(CORE)/$(PKG_TARGET_NAME)-makefile -export HSO_TMP:=$(SDK_ROOT)/output/hso_temp - -export HSO_MK_XML_PY:= $(SDK_ROOT)/build/script/hdbxml/mk_hso_prim_xml.py -export HSO_XML_PRE_PROCESS_PY:= $(SDK_ROOT)/build/script/hdbxml/process_pregenerated_xml.py -export HSO_XML_MERGE_PY:= $(SDK_ROOT)/build/script/hdbxml/hso_prim_xml_merge.py -export HSO_XML_DB_CREATE_PY:= $(SDK_ROOT)/build/script/hdbxml/database_create.py -export BUILD_UTILS_PY:=$(SDK_ROOT)/build/script/utils/build_utils.py -export CCACHE := ccache -ifeq ("$(KERNEL)", "liteos") -export LOS_PUB_CCFLAGS=REPLACE_LOS_PUB_CCFLAGS -export LOS_ROOT=REPLACE_LOS_ROOT -export LITEOS_PLATFORM_MENUCONFIG_H=$(OUTPUT_DIR)/menuconfig/menuconfig.h -endif -export COMPONENT_LIST=REPLACE_COMPONENT_LIST -export BIN_NAME=REPLACE_BIN_NAME -LINKFLAGS=REPLACE_LINKFLAGS -LINK_SCRIPT=REPLACE_LINK_SCRIPT - -PUBLIC_INCLUDES_TEMP=REPLACE_PUBLIC_INCLUDES -export PUBLIC_INCLUDES = $(patsubst %,-I%,$(PUBLIC_INCLUDES_TEMP)) -export PUBLIC_CCFLAGS=REPLACE_PUBLIC_CCFLAGS -PUBLIC_DEFINES_TEMP=REPLACE_PUBLIC_DEFINES -export PUBLIC_DEFINES = $(patsubst %,-D%,$(PUBLIC_DEFINES_TEMP)) - -export LIB_DIR = $(OUTPUT_DIR)/libs -export WHOLE_LINK_LIBS = -export NORMAL_LINK_LIBS = -export WHOLE_EXTERN_LINK_LIBS = -export NORMAL_EXTERN_LINK_LIBS = - --include ./toolchains.make - -ELF_FILE=$(OUTPUT_DIR)/$(BIN_NAME).elf -MAP_FILE=$(OUTPUT_DIR)/$(BIN_NAME).map -all: pre_build $(ELF_FILE) post_build - -COMPONENT_LIST_LIB = $(patsubst %,lib%.a,$(COMPONENT_LIST)) - -pre_build: - @rm -fr ${OUTPUT_DIR} - @mkdir -p $(OUTPUT_DIR)/libs - @mkdir -p $(HSO_TMP) -ifeq ("$(KERNEL)", "liteos") - @mkdir -p $(dir $(LITEOS_PLATFORM_MENUCONFIG_H)) - @$(LOS_ROOT)/Huawei_LiteOS/build/make/make_menuconfig_headfile.sh $(LOS_ROOT)/Huawei_LiteOS/tools/build/config/$(CHIP).config $(LITEOS_PLATFORM_MENUCONFIG_H) -endif - @python3 $(HSO_MK_XML_PY) mkdir ${SDK_ROOT}/ ${CHIP} ${CORE} - @$(CC) -P -xc -E -o $(OUTPUT_DIR)/linker.lds $(PUBLIC_INCLUDES) $(PUBLIC_CCFLAGS) $(PUBLIC_DEFINES) $(LINK_SCRIPT) - @echo built $(OUTPUT_DIR)/linker.lds - @echo pre_build - -post_build:$(ELF_FILE) -ifneq ($(build_level), release) - $(OBJDUMP) -x -S -l $(ELF_FILE) > $(OUTPUT_DIR)/$(BIN_NAME).lst - $(OBJDUMP) -d -m $(ARCH_FAMILY) $(ELF_FILE) > $(OUTPUT_DIR)/$(BIN_NAME).asm - $(NM) -S -n --format=sysv $(ELF_FILE) > $(OUTPUT_DIR)/$(BIN_NAME).nm - $(OBJDUMP) -Wi $(ELF_FILE) > $(OUTPUT_DIR)/$(BIN_NAME).info -endif - $(OBJCOPY) --gap-fill 0xFF -O binary -R .logstr -R .ARM -R .ARM $(ELF_FILE) $(OUTPUT_DIR)/$(BIN_NAME).bin -ifeq ("$(BIN_NAME).bin", "ssb.bin") - @python3 $(BUILD_UTILS_PY) add_len_and_sha256_info_to_ssb $(OUTPUT_DIR)/$(BIN_NAME).bin $(CHIP) -else -ifneq ($(nhso), true) - @echo "Merge HSO_XML & Create HSO_DB" - @python3 ${HSO_XML_PRE_PROCESS_PY} ${SDK_ROOT}/ ${CHIP} ${CORE} - @python3 ${HSO_XML_MERGE_PY} ${SDK_ROOT}/ ${CHIP} ${CORE} - @python3 ${HSO_XML_MERGE_PY} ${SDK_ROOT}/ ${CHIP} "dsp_core" - @python3 ${HSO_XML_MERGE_PY} ${SDK_ROOT}/ ${CHIP} "bt_core" - @python3 ${HSO_XML_DB_CREATE_PY} ${SDK_ROOT}/ ${CHIP} -endif -endif - @rm $(HSO_TMP) -fr - @echo post_build - -STD_LIB_DIR = REPLACE_STD_LIB_DIR -STD_LIBS = REPLACE_STD_LIBS - --include $(patsubst %,./components/%.make,$(COMPONENT_LIST)) -$(ELF_FILE):pre_build $(COMPONENT_LIST_LIB) - @echo buiilding $(ELF_FILE) - @$(CC) $(LINKFLAGS) -Wl,-T$(OUTPUT_DIR)/linker.lds $(patsubst %,-L%,$(LIB_DIR)) -Wl,--whole-archive $(patsubst %,-l%,$(WHOLE_LINK_LIBS)) $(WHOLE_EXTERN_LINK_LIBS) -Wl,--no-whole-archive $(NORMAL_EXTERN_LINK_LIBS) $(patsubst %,-l%,$(NORMAL_LINK_LIBS)) $(patsubst %,-L%,$(STD_LIB_DIR)) -Wl,--start-group $(patsubst %,-l%,$(STD_LIBS)) -Wl,--end-group -Wl,-Map=$(MAP_FILE) -o $(ELF_FILE) \ No newline at end of file diff --git a/build/script/sdk_generator/sdk_template/makefile/third_party_template.make b/build/script/sdk_generator/sdk_template/makefile/third_party_template.make deleted file mode 100755 index ce409b6..0000000 --- a/build/script/sdk_generator/sdk_template/makefile/third_party_template.make +++ /dev/null @@ -1,73 +0,0 @@ -SRC_REPLACE_COMPONENT_NAME=REPLACE_SOURCES - -C_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.c,$(SRC_REPLACE_COMPONENT_NAME)))) -CPP_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.cpp,$(SRC_REPLACE_COMPONENT_NAME)))) -CPP_OBJ_REPLACE_COMPONENT_NAME += $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.cc,$(SRC_REPLACE_COMPONENT_NAME)))) -S_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.S,$(SRC_REPLACE_COMPONENT_NAME)))) -s_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(filter %.s,$(SRC_REPLACE_COMPONENT_NAME)))) -ALL_OBJ_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(patsubst %,%.obj,$(SRC_REPLACE_COMPONENT_NAME))) - -INCLUDES_TEMP_REPLACE_COMPONENT_NAME = REPLACE_COMPONENT_CUSTOM_INCLUDE -INCLUDES_REPLACE_COMPONENT_NAME = $(patsubst %,-I%,$(INCLUDES_TEMP_REPLACE_COMPONENT_NAME)) - -CCFLAGS_REPLACE_COMPONENT_NAME = $(LOS_PUB_CCFLAGS) -CCFLAGS_REPLACE_COMPONENT_NAME += REPLACE_COMPONENT_CUSTOM_CCFLAGS -DEFINES_TEMP_REPLACE_COMPONENT_NAME = REPLACE_COMPONENT_CUSTOM_DEFINES -DEFINES_REPLACE_COMPONENT_NAME += $(patsubst %,-D%,$(DEFINES_TEMP_REPLACE_COMPONENT_NAME)) - -LIBS_REPLACE_COMPONENT_NAME = REPLACE_LIBS -WHOLE_LINK_REPLACE_COMPONENT_NAME = REPLACE_WHOLE_LINK -ifeq ("$(WHOLE_LINK_REPLACE_COMPONENT_NAME)", "true") - WHOLE_LINK_LIBS += REPLACE_COMPONENT_NAME - WHOLE_EXTERN_LINK_LIBS += $(LIBS_REPLACE_COMPONENT_NAME) -else - NORMAL_LINK_LIBS += REPLACE_COMPONENT_NAME - NORMAL_EXTERN_LINK_LIBS += $(LIBS_REPLACE_COMPONENT_NAME) -endif - -COMPONENT_NAME_REPLACE_COMPONENT_NAME=REPLACE_COMPONENT_NAME - -LIB_DIR_TEMP_REPLACE_COMPONENT_NAME = REPLACE_LIB_DIR - -LIB_DIR_REPLACE_COMPONENT_NAME = $(subst $(SDK_ROOT),$(OUTPUT_DIR),$(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)) - -LIB_DIR += $(LIB_DIR_REPLACE_COMPONENT_NAME) - -LIB_EXIST := $(shell if [ -e "$(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a" ]; then echo "exist"; else echo "noexist"; fi ) - - -lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a:$(ALL_OBJ_REPLACE_COMPONENT_NAME) HSO_DB_$(COMPONENT_NAME_REPLACE_COMPONENT_NAME) - @mkdir -p $(LIB_DIR_REPLACE_COMPONENT_NAME) - @$(RM) $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a -ifeq ("$(LIB_EXIST)", "noexist") - @echo building $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a - @$(AR) -rc $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a $(ALL_OBJ_REPLACE_COMPONENT_NAME) -else - @echo copy $(LIB_DIR_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a - @cp $(LIB_DIR_TEMP_REPLACE_COMPONENT_NAME)/lib$(COMPONENT_NAME_REPLACE_COMPONENT_NAME).a $(LIB_DIR_REPLACE_COMPONENT_NAME) -endif - -$(C_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @${CCACHE} $(CC) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) $< -o $@; - -$(CPP_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @${CCACHE} $(CXX) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) $< -o $@; - -$(s_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @$(AS) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) $< -o $@; - -$(S_OBJ_REPLACE_COMPONENT_NAME): $(OUTPUT_DIR)/%.obj : $(SDK_ROOT)/% - @echo Building $< - @mkdir -p $(dir $@) - @$(AS) -c $(INCLUDES_REPLACE_COMPONENT_NAME) $(DEFINES_REPLACE_COMPONENT_NAME) $(CCFLAGS_REPLACE_COMPONENT_NAME) $< -o $@; - -HSO_DB_$(COMPONENT_NAME_REPLACE_COMPONENT_NAME): - @echo "skip building $(COMPONENT_NAME_REPLACE_COMPONENT_NAME) HSO DB" - -include ./toolchains.make diff --git a/build/script/sdk_generator/sdk_template/makefile/toolchain.make b/build/script/sdk_generator/sdk_template/makefile/toolchain.make deleted file mode 100755 index 90546f0..0000000 --- a/build/script/sdk_generator/sdk_template/makefile/toolchain.make +++ /dev/null @@ -1,11 +0,0 @@ -CC := REPLACE_CC -AS := REPLACE_AS -CXX := REPLACE_CXX -AR := REPLACE_AR -NM := REPLACE_NM -LD := REPLACE_LD -STRIP := REPLACE_STRIP -OBJCOPY := REPLACE_OBJCOPY -OBJDUMP := REPLACE_OBJDUMP -READELF := REPLACE_READELF -RANLIB := REPLACE_RANLIB diff --git a/build/script/sdk_generator/sdk_template/template.mk b/build/script/sdk_generator/sdk_template/template.mk deleted file mode 100755 index 4a3e0a8..0000000 --- a/build/script/sdk_generator/sdk_template/template.mk +++ /dev/null @@ -1,13 +0,0 @@ -CC=REPLACE_CC -AS=REPLACE_AS -CXX=REPLACE_CXX -AR=REPLACE_AR -NM=REPLACE_NM -LINK=REPLACE_LINK -STRIP=REPLACE_STRIP -OBJCOPY=REPLACE_OBJCOPY -OBJDUMP=REPLACE_OBJDUMP -READELF=REPLACE_READELF -RANLIB=REPLACE_RANLIB - -REPLACE \ No newline at end of file diff --git a/build/script/sdk_generator/target_config_genarator.py b/build/script/sdk_generator/target_config_genarator.py deleted file mode 100755 index 93efbb0..0000000 --- a/build/script/sdk_generator/target_config_genarator.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -import re - -def genarate_reserve_config(reserve_config, file_path): - with open(file_path, 'r') as fp: - lines = fp.read() - reserve_lines = "" - for config in reserve_config: - r = re.search("['\"]%s['\"](\s*):[\d\D\r\n]*?\}(\s*)," % config, lines) - reserve_lines += " %s\n" % r.group() - # 替换([\w\W]*?\n)里匹配的内容为reserve_lines - lines = re.sub("(target|target_template) = \{\n([\w\W]*?\n)\}", - lambda x: x.group().replace(x.group(2), reserve_lines), lines) - lines = re.sub("target_copy = \{\n([\w\W]*?\n)\}", - lambda x: x.group().replace(x.group(1), "\n"), lines) - lines = re.sub("target_group = \{\n([\w\W]*?\n)\}", - lambda x: x.group().replace(x.group(1), "\n"), lines) - with open(file_path, 'w') as fp: - fp.write(lines) diff --git a/build/script/sdk_generator/xml_parser.py b/build/script/sdk_generator/xml_parser.py deleted file mode 100755 index 978fb37..0000000 --- a/build/script/sdk_generator/xml_parser.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python3 -# coding=utf-8 -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. - -import os -from xml.etree import cElementTree as ElementTree - -class XmlParser: - def __init__(self): - self.d2xml_level = 0 - self.indent = ' ' - - def _dict_to_xml(self, data, root='object'): - if isinstance(data, dict): - xml_ret = ' ' * self.d2xml_level + f'<{root}>\n' - self.d2xml_level += 1 - for key, value in data.items(): - xml_ret += self._dict_to_xml(value, key) - self.d2xml_level -= 1 - xml_ret += ' ' * self.d2xml_level + f'\n' - return xml_ret - - if isinstance(data, (list, tuple, set)): - xml_ret = '' - for item in data: - xml_ret += self._dict_to_xml(item, root) - return xml_ret - if data is None: - data = '' - xml_ret = ' ' * self.d2xml_level + f'<{root}>' - xml_ret += str(data) - xml_ret += f'\n' - return xml_ret - - def dict_to_xml(self, data, root='object'): - self.d2xml_level = 0 - xml_str = '\n' - xml_str += self._dict_to_xml(data, root) - return xml_str - - def et2dict(self, root): - xml_dict = {} - if root.items(): - xml_dict.update(dict(root.items())) - for element in root: - if element: - key = element.tag - val = self.et2dict(element) - else: - key = element.tag - val = element.text - - if key not in xml_dict: - xml_dict[key] = val - continue - - if not isinstance(xml_dict[key], list): - xml_dict[key] = [xml_dict[key]] - temp = xml_dict[key] - temp.append(val) - xml_dict[key] = temp - return xml_dict - - def xml2dict(self, xml_file): - tree = ElementTree.parse(xml_file) - root = tree.getroot() - return self.et2dict(root) - -if __name__ == "__main__": - script_dir = os.path.split(os.path.realpath(__file__))[0] - file = os.path.join(script_dir, 'sdk_template', 'template.ewp') - test = XmlParser() - dict_ = test.xml2dict(file) - xml = test.dict_to_xml(dict_, root='project') - print(xml) diff --git a/build/script/usr_config.py b/build/script/usr_config.py deleted file mode 100755 index ef90460..0000000 --- a/build/script/usr_config.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -*- -# Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved. - -import os, sys, shutil -import argparse -from kconfiglib import Kconfig -from menuconfig import menuconfig - -root_path = os.path.join(os.path.dirname(os.path.abspath(__file__)) + os.path.sep + ".", "..", "..") - -def mconf_set_env(style, conf, config_header, autoheader_header, output_path = None): - """ - Set Kconfig Env - """ - os.environ["MENUCONFIG_STYLE"] = style - os.environ["KCONFIG_CONFIG"] = conf - os.environ["KCONFIG_CONFIG_HEADER"] = config_header - os.environ["KCONFIG_AUTOHEADER"] = os.path.join("." if output_path == None else output_path, "mconfig.h") - os.environ["KCONFIG_AUTOHEADER_HEADER"] = autoheader_header - os.environ["CONFIG_"] = "CONFIG_" - -def mconfig(command, chip, core, target, output, assignments = None, root=""): - if not root: - root = root_path - - kconfig = os.path.join(root, "config.in") - print(kconfig) - print(os.getcwd()) - - display_style = "default selection=fg:white,bg:blue" - target = target.replace('-', "_") - target_conf = os.path.join(root, "build", "config", "target_config", chip, "menuconfig", core, "%s.config" % target) - config_header = '''# Generated by Kconfig Tool. -# Note: !!!This file can not be modify manually!!! -''' - autoheader_header = '''/* Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved. */ -''' - mconf_set_env(display_style, target_conf, config_header, autoheader_header, output) - kconf = Kconfig(filename=kconfig) - - if command == 'savemenuconfig': - kconf.load_config() - print(kconf.write_autoconf()) # save menu config - elif command == 'defconfig': - kconf.load_allconfig("alldef.config") - print(kconf.write_config()) # default config - elif command == 'allyesconfig': - kconf.warn = False - for sym in kconf.unique_defined_syms: - sym.set_value(1 if sym.choice else 2) - for choice in kconf.unique_choices: - choice.set_value(2) - kconf.warn = True - kconf.load_allconfig("allyes.config") - print(kconf.write_config()) # all yes config - elif command == 'allnoconfig': - kconf.warn = False - for sym in kconf.unique_defined_syms: - sym.set_value(2 if sym.is_allnoconfig_y else 0) - kconf.warn = True - kconf.load_allconfig("allno.config") - print(kconf.write_config()) # all no config - elif command == 'setconfig': - kconf.load_config() - for arg in args.assignments: - if "=" not in arg: - sys.exit("error: no '=' in assignment: '{}'".format(arg)) - name, value = arg.split("=", 1) - - sym = kconf.syms[name] - - if not sym.set_value(value): - sys.exit("error: '{}' is an invalid value for the {} symbol {}" - .format(value, kconfiglib.TYPE_TO_STR[sym.orig_type], - name)) - - print(kconf.write_config()) - elif command == 'reloadconfig': - kconf.load_config() - print(kconf.write_config()) - else: - menuconfig(kconf) # menu config - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description=__doc__) - - parser.add_argument( - "--command", - default="menuconfig", - choices=["menuconfig", "savemenuconfig", "defconfig", "allyesconfig", "allnoconfig", "setconfig", "openproject"], - help="command to be used") - - parser.add_argument( - "--chip", - default="bs25", - help="chips: bs25/bs21/ws63/ws53 ...") - - parser.add_argument( - "--core", - default="acore", - help="cores: acore/bcore/ccore ...") - - parser.add_argument( - "--target", - default="standard-bs25-app-evb", - help="targets: standard-bs25-app-evb ...") - - parser.add_argument( - "--output", - help="The path of the mconfig.h file will be stored.") - - parser.add_argument( - "assignments", - metavar="ASSIGNMENT", - nargs="*", - help="A 'NAME=value' assignment") - - args = parser.parse_args() - - if args.command == "openproject": - if os.path.exists("board.json"): - if os.path.exists(root_path + "/board.json"): - root_path + "/board.json" - pass - shutil.copyfile("board.json", root_path + "/board.json") - - current_path = os.getcwd() - current_sample = "SAMPLE_SUPPORT_" + os.path.basename(current_path).upper() - os.chdir(root_path) - args.command = "setconfig" - args.assignments.clear() - args.assignments.append("SAMPLE_ENABLE=n") - mconfig(args.command, args.chip, args.core, args.target, args.output, args.assignments, root_path) - args.assignments.clear() - args.assignments.append("SAMPLE_ENABLE=y") - if "peripheral" in current_path: - args.assignments.append("ENABLE_PERIPHERAL_SAMPLE=y") - elif "products" in current_path: - args.assignments.append("ENABLE_PRODUCTS_SAMPLE=y") - else: - print("Not a valid sample directory") - exit(1) - args.assignments.append(current_sample + "=y") - - - - mconfig(args.command, args.chip, args.core, args.target, args.output, args.assignments, root_path) \ No newline at end of file diff --git a/drivers/chips/ws63/porting/pwm/pwm_porting.c b/drivers/chips/ws63/porting/pwm/pwm_porting.c index 1b3e88e..b9329b1 100755 --- a/drivers/chips/ws63/porting/pwm/pwm_porting.c +++ b/drivers/chips/ws63/porting/pwm/pwm_porting.c @@ -7,175 +7,177 @@ * 2022-09-16, Create file. \n */ - #include "chip_core_irq.h" - #include "soc_osal.h" - #include "common_def.h" - #include "hal_pwm_v151.h" - #include "platform_core.h" - #include "chip_io.h" - #include "soc_porting.h" - #include "pwm_porting.h" - - #define BUS_CLOCK_TIME_40M 40000000UL - #define BIT_WIDTH_LIMIT 0xFFFF - #define CLDO_CRG_CLK_SEL 0x44001134 - #define PWM_CKSEL_BIT 7 - - #define CLDO_SUB_CRG_CKEN_CTL0 0x44001100 - #define CLDO_CRG_DIV_CTL3 0x44001114 - #define CLDO_CRG_DIV_CTL4 0x44001118 - #define CLDO_CRG_DIV_CTL5 0x4400111C - - #define PWM_BUS_CKEN 2 - #define PWM_CHANNEL_CKEN_LEN 9 - - #define PWM0_LOAD_DIV_EN 20 - #define PWM0_DIV1_CFG 16 - #define PWM0_DIV1_CFG_LEN 4 - #define PWM1_LOAD_DIV_EN 30 - #define PWM1_DIV1_CFG 26 - #define PWM1_DIV1_CFG_LEN 4 - #define PWM2_LOAD_DIV_EN 8 - #define PWM2_DIV1_CFG 4 - #define PWM2_DIV1_CFG_LEN 4 - #define PWM3_LOAD_DIV_EN 18 - #define PWM3_DIV1_CFG 14 - #define PWM3_DIV1_CFG_LEN 4 - #define PWM4_LOAD_DIV_EN 28 - #define PWM4_DIV1_CFG 24 - #define PWM4_DIV1_CFG_LEN 4 - #define PWM5_LOAD_DIV_EN 8 - #define PWM5_DIV1_CFG 4 - #define PWM5_DIV1_CFG_LEN 4 - #define PWM6_LOAD_DIV_EN 18 - #define PWM6_DIV1_CFG 14 - #define PWM6_DIV1_CFG_LEN 4 - #define PWM7_LOAD_DIV_EN 28 - #define PWM7_DIV1_CFG 24 - #define PWM7_DIV1_CFG_LEN 4 - - #define PWM_DIV_6 6 - #define PWM_DIV_10 10 - - uintptr_t g_pwm_base_addr = (uintptr_t)PWM_0_BASE; - - uintptr_t pwm_porting_base_addr_get(void) - { - return g_pwm_base_addr; - } - - static int pwm_handler(int a, const void *tmp) - { - unused(a); - unused(tmp); - hal_pwm_v151_irq_handler(); - return 0; - } - void pwm_port_register_hal_funcs(void) - { - hal_pwm_register_funcs(hal_pwm_v151_funcs_get()); - } - - void pwm_port_unregister_hal_funcs(void) - { - hal_pwm_unregister_funcs(); - } - - void pwm_port_clock_enable(bool on) - { - if (on == true) { - uint32_t div_cfg = PWM_DIV_6; - #ifdef CONFIG_HIGH_FREQUENCY - uapi_reg_setbit(CLDO_CRG_CLK_SEL, PWM_CKSEL_BIT); - #elif defined(CONFIG_LOW_FREQUENCY) - uapi_reg_clrbit(CLDO_CRG_CLK_SEL, PWM_CKSEL_BIT); - if (get_tcxo_freq() == CLK24M_TCXO) { - div_cfg = PWM_DIV_6; - } else { - div_cfg = PWM_DIV_10; - } - #endif - reg32_setbits(CLDO_SUB_CRG_CKEN_CTL0, PWM_BUS_CKEN, PWM_CHANNEL_CKEN_LEN, 0x1FF); - - reg32_clrbit(CLDO_CRG_DIV_CTL3, PWM0_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL3, PWM0_DIV1_CFG, PWM0_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL3, PWM0_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL3, PWM1_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL3, PWM1_DIV1_CFG, PWM1_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL3, PWM1_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM2_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL4, PWM2_DIV1_CFG, PWM2_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL4, PWM2_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM3_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL4, PWM3_DIV1_CFG, PWM3_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL4, PWM3_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM4_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL4, PWM4_DIV1_CFG, PWM4_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL4, PWM4_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM5_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL5, PWM5_DIV1_CFG, PWM5_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL5, PWM5_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM6_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL5, PWM6_DIV1_CFG, PWM6_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL5, PWM6_LOAD_DIV_EN); - - reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM7_LOAD_DIV_EN); - reg32_setbits(CLDO_CRG_DIV_CTL5, PWM7_DIV1_CFG, PWM7_DIV1_CFG_LEN, div_cfg); - reg32_setbit(CLDO_CRG_DIV_CTL5, PWM7_LOAD_DIV_EN); - } else { - reg32_clrbits(CLDO_SUB_CRG_CKEN_CTL0, PWM_BUS_CKEN, PWM_CHANNEL_CKEN_LEN); - } - } - - void pwm_port_register_irq(pwm_channel_t channel) - { - unused(channel); - osal_irq_request((uintptr_t)PWM_ABNOR_IRQN, (osal_irq_handler)pwm_handler, NULL, NULL, NULL); - - osal_irq_enable((uintptr_t)PWM_ABNOR_IRQN); - } - - void pwm_port_unregister_irq(pwm_channel_t channel) - { - unused(channel); - #ifndef BUILD_NOOSAL - osal_irq_disable((uintptr_t)PWM_ABNOR_IRQN); - osal_irq_disable((uintptr_t)PWM_CFG_IRQN); - osal_irq_free((uintptr_t)PWM_ABNOR_IRQN, NULL); - osal_irq_free((uintptr_t)PWM_CFG_IRQN, NULL); - #endif - } - - void pwm_irq_lock(uint8_t channel) - { - unused(channel); - osal_irq_lock(); - } - - void pwm_irq_unlock(uint8_t channel) - { - unused(channel); - osal_irq_unlock(); - } - - uint32_t pwm_port_get_clock_value(pwm_channel_t channel) - { - if (channel >= PWM_MAX_NUMBER) { - return 0; - } - return BUS_CLOCK_TIME_40M; - } - - errcode_t pwm_port_param_check(const pwm_config_t *cfg) - { - if ((cfg->low_time + cfg->high_time > BIT_WIDTH_LIMIT) || (cfg->offset_time > cfg->low_time)) { - return ERRCODE_PWM_INVALID_PARAMETER; - } - return ERRCODE_SUCC; - } \ No newline at end of file +#include "chip_core_irq.h" +#include "soc_osal.h" +#include "common_def.h" +#include "hal_pwm_v151.h" +#include "platform_core.h" +#include "chip_io.h" +#include "soc_porting.h" +#include "pwm_porting.h" + +#define BUS_CLOCK_TIME_40M 40000000UL +#define BIT_WIDTH_LIMIT 0xFFFF +#define CLDO_CRG_CLK_SEL 0x44001134 +#define PWM_CKSEL_BIT 7 + +#define CLDO_SUB_CRG_CKEN_CTL0 0x44001100 +#define CLDO_CRG_DIV_CTL3 0x44001114 +#define CLDO_CRG_DIV_CTL4 0x44001118 +#define CLDO_CRG_DIV_CTL5 0x4400111C + +#define PWM_BUS_CKEN 2 +#define PWM_CHANNEL_CKEN_LEN 9 + +#define PWM0_LOAD_DIV_EN 20 +#define PWM0_DIV1_CFG 16 +#define PWM0_DIV1_CFG_LEN 4 +#define PWM1_LOAD_DIV_EN 30 +#define PWM1_DIV1_CFG 26 +#define PWM1_DIV1_CFG_LEN 4 +#define PWM2_LOAD_DIV_EN 8 +#define PWM2_DIV1_CFG 4 +#define PWM2_DIV1_CFG_LEN 4 +#define PWM3_LOAD_DIV_EN 18 +#define PWM3_DIV1_CFG 14 +#define PWM3_DIV1_CFG_LEN 4 +#define PWM4_LOAD_DIV_EN 28 +#define PWM4_DIV1_CFG 24 +#define PWM4_DIV1_CFG_LEN 4 +#define PWM5_LOAD_DIV_EN 8 +#define PWM5_DIV1_CFG 4 +#define PWM5_DIV1_CFG_LEN 4 +#define PWM6_LOAD_DIV_EN 18 +#define PWM6_DIV1_CFG 14 +#define PWM6_DIV1_CFG_LEN 4 +#define PWM7_LOAD_DIV_EN 28 +#define PWM7_DIV1_CFG 24 +#define PWM7_DIV1_CFG_LEN 4 + +#define PWM_DIV_6 6 +#define PWM_DIV_10 10 + +uintptr_t g_pwm_base_addr = (uintptr_t)PWM_0_BASE; + +uintptr_t pwm_porting_base_addr_get(void) +{ + return g_pwm_base_addr; +} + +static int pwm_handler(int a, const void *tmp) +{ + unused(a); + unused(tmp); + hal_pwm_v151_irq_handler(); + return 0; +} + + +void pwm_port_register_hal_funcs(void) +{ + hal_pwm_register_funcs(hal_pwm_v151_funcs_get()); +} + +void pwm_port_unregister_hal_funcs(void) +{ + hal_pwm_unregister_funcs(); +} + +void pwm_port_clock_enable(bool on) +{ + if (on == true) { + uint32_t div_cfg = PWM_DIV_6; +#ifdef CONFIG_HIGH_FREQUENCY + uapi_reg_setbit(CLDO_CRG_CLK_SEL, PWM_CKSEL_BIT); +#elif defined(CONFIG_LOW_FREQUENCY) + uapi_reg_clrbit(CLDO_CRG_CLK_SEL, PWM_CKSEL_BIT); + if (get_tcxo_freq() == CLK24M_TCXO) { + div_cfg = PWM_DIV_6; + } else { + div_cfg = PWM_DIV_10; + } +#endif + reg32_setbits(CLDO_SUB_CRG_CKEN_CTL0, PWM_BUS_CKEN, PWM_CHANNEL_CKEN_LEN, 0x1FF); + + reg32_clrbit(CLDO_CRG_DIV_CTL3, PWM0_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL3, PWM0_DIV1_CFG, PWM0_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL3, PWM0_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL3, PWM1_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL3, PWM1_DIV1_CFG, PWM1_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL3, PWM1_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM2_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL4, PWM2_DIV1_CFG, PWM2_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL4, PWM2_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM3_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL4, PWM3_DIV1_CFG, PWM3_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL4, PWM3_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL4, PWM4_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL4, PWM4_DIV1_CFG, PWM4_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL4, PWM4_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM5_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL5, PWM5_DIV1_CFG, PWM5_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL5, PWM5_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM6_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL5, PWM6_DIV1_CFG, PWM6_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL5, PWM6_LOAD_DIV_EN); + + reg32_clrbit(CLDO_CRG_DIV_CTL5, PWM7_LOAD_DIV_EN); + reg32_setbits(CLDO_CRG_DIV_CTL5, PWM7_DIV1_CFG, PWM7_DIV1_CFG_LEN, div_cfg); + reg32_setbit(CLDO_CRG_DIV_CTL5, PWM7_LOAD_DIV_EN); + } else { + reg32_clrbits(CLDO_SUB_CRG_CKEN_CTL0, PWM_BUS_CKEN, PWM_CHANNEL_CKEN_LEN); + } +} + +void pwm_port_register_irq(pwm_channel_t channel) +{ + unused(channel); + osal_irq_request((uintptr_t)PWM_ABNOR_IRQN, (osal_irq_handler)pwm_handler, NULL, NULL, NULL); + + osal_irq_enable((uintptr_t)PWM_ABNOR_IRQN); +} + +void pwm_port_unregister_irq(pwm_channel_t channel) +{ + unused(channel); +#ifndef BUILD_NOOSAL + osal_irq_disable((uintptr_t)PWM_ABNOR_IRQN); + osal_irq_disable((uintptr_t)PWM_CFG_IRQN); + osal_irq_free((uintptr_t)PWM_ABNOR_IRQN, NULL); + osal_irq_free((uintptr_t)PWM_CFG_IRQN, NULL); +#endif +} + +void pwm_irq_lock(uint8_t channel) +{ + unused(channel); + osal_irq_lock(); +} + +void pwm_irq_unlock(uint8_t channel) +{ + unused(channel); + osal_irq_unlock(); +} + +uint32_t pwm_port_get_clock_value(pwm_channel_t channel) +{ + if (channel >= PWM_MAX_NUMBER) { + return 0; + } + return BUS_CLOCK_TIME_40M; +} + +errcode_t pwm_port_param_check(const pwm_config_t *cfg) +{ + if ((cfg->low_time + cfg->high_time > BIT_WIDTH_LIMIT) || (cfg->offset_time > cfg->low_time)) { + return ERRCODE_PWM_INVALID_PARAMETER; + } + return ERRCODE_SUCC; +} \ No newline at end of file diff --git a/indie_build.py b/indie_build.py index 6769610..1e065f6 100755 --- a/indie_build.py +++ b/indie_build.py @@ -149,9 +149,6 @@ def all_build(): print("make full pkg err:", errcode) exit(-1) shutil.rmtree(temp_dir) - print("gen package.zip") - file_dir = os.path.dirname(os.path.abspath(__file__)) - os.system("cd " + file_dir + " && python3 package.py") def sdk_build(): builder = CMakeBuilder(["-c", "ws63-liteos-hilink"]) diff --git a/prebuild.sh b/prebuild.sh index df74098..2d82fdb 100755 --- a/prebuild.sh +++ b/prebuild.sh @@ -1,4 +1,3 @@ -#!/bin/bash -python3 ./tools/pretool/ble_name_tool.py -python3 ./tools/pretool/product_tool.py -python3 ./tools/pretool/code_robot.py +python3 tools/pretool/ble_name_tool.py +python3 tools/pretool/product_tool.py +python3 tools/pretool/code_robot.py \ No newline at end of file
' + v + '
' + str(value[v]) + '