初始提交

This commit is contained in:
2025-05-13 22:00:58 +08:00
commit e4c030b0c0
564 changed files with 78858 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#===============================================================================
# @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)

View File

@ -0,0 +1,68 @@
#===============================================================================
# @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()

View File

@ -0,0 +1,87 @@
/**
* 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 <stdio.h>
#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);
}
}

View File

@ -0,0 +1,25 @@
/**
* 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

View File

@ -0,0 +1,417 @@
#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;
}

View File

@ -0,0 +1,23 @@
/**
* 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

View File

@ -0,0 +1,123 @@
/**
* 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

View File

@ -0,0 +1,93 @@
/**
* 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;
}

View File

@ -0,0 +1,163 @@
/**
* 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);
}

View File

@ -0,0 +1,23 @@
/**
* 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;
}

View File

@ -0,0 +1,45 @@
/**
* 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;
}

View File

@ -0,0 +1,17 @@
/**
* 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);
}

View File

@ -0,0 +1,24 @@
/**
* 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 <stdio.h>
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;
}

View File

@ -0,0 +1,17 @@
/**
* 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;
}

View File

@ -0,0 +1,56 @@
/**
* 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);
}

View File

@ -0,0 +1,15 @@
/**
* 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);
}

View File

@ -0,0 +1,16 @@
/**
* 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;
}

View File

@ -0,0 +1,131 @@
#===============================================================================
# @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()

View File

@ -0,0 +1,130 @@
/**
* 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

View File

@ -0,0 +1,520 @@
/**
* 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);
}

View File

@ -0,0 +1,123 @@
/**
* 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);
}

View File

@ -0,0 +1,121 @@
/**
* 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);
}

View File

@ -0,0 +1,327 @@
/**
* 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 <stdbool.h>
#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;
}

View File

@ -0,0 +1,59 @@
/**
* 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;
}

View File

@ -0,0 +1,68 @@
/**
* 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;
}

View File

@ -0,0 +1,43 @@
/**
* 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;
}

View File

@ -0,0 +1,27 @@
/**
* 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;
}

View File

@ -0,0 +1,65 @@
/**
* 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;
}

View File

@ -0,0 +1,78 @@
/**
* 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 <stdbool.h>
#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;
}

View File

@ -0,0 +1,31 @@
/**
* 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;
}

View File

@ -0,0 +1,72 @@
/**
* 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;
}

View File

@ -0,0 +1,26 @@
/**
* 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;
}

View File

@ -0,0 +1,29 @@
/**
* 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;
}

View File

@ -0,0 +1,25 @@
/**
* 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;
}

View File

@ -0,0 +1,51 @@
/**
* 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);
}

View File

@ -0,0 +1,75 @@
/**
* 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;
}

View File

@ -0,0 +1,52 @@
/**
* 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;
}

View File

@ -0,0 +1,140 @@
/**
* 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;
}

View File

@ -0,0 +1,22 @@
/**
* 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;
}

View File

@ -0,0 +1,43 @@
/**
* 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 <stddef.h>
#include <stdarg.h>
#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;
}

View File

@ -0,0 +1,52 @@
/**
* 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;
}

View File

@ -0,0 +1,23 @@
/**
* 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;
}

View File

@ -0,0 +1,97 @@
/**
* 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);
}

View File

@ -0,0 +1,23 @@
/**
* 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;
}

View File

@ -0,0 +1,62 @@
/**
* 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;
}

View File

@ -0,0 +1,228 @@
/**
* 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;
}

View File

@ -0,0 +1,27 @@
/**
* 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;
}

View File

@ -0,0 +1,73 @@
/**
* 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;
}

View File

@ -0,0 +1,77 @@
/**
* 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;
}

View File

@ -0,0 +1,127 @@
/**
* 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,
};

View File

@ -0,0 +1,32 @@
/**
* 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

View File

@ -0,0 +1,89 @@
#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;
}

View File

@ -0,0 +1,23 @@
/**
* 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