Explorar o código

增加724的编译框架,由于GCC太大,现在压缩上传,需要解压后编译

alienwalker %!s(int64=5) %!d(string=hai) anos
pai
achega
7307922912
Modificáronse 100 ficheiros con 23352 adicións e 0 borrados
  1. 3 0
      .gitignore
  2. 549 0
      bsp/air724/sdk/CMakeLists.txt
  3. 56 0
      bsp/air724/sdk/api/CMakeLists.txt
  4. 49 0
      bsp/air724/sdk/api/include/iot_adc.h
  5. 202 0
      bsp/air724/sdk/api/include/iot_audio.h
  6. 70 0
      bsp/air724/sdk/api/include/iot_camera.h
  7. 38 0
      bsp/air724/sdk/api/include/iot_debug.h
  8. 76 0
      bsp/air724/sdk/api/include/iot_flash.h
  9. 178 0
      bsp/air724/sdk/api/include/iot_fs.h
  10. 67 0
      bsp/air724/sdk/api/include/iot_gpio.h
  11. 71 0
      bsp/air724/sdk/api/include/iot_i2c.h
  12. 29 0
      bsp/air724/sdk/api/include/iot_keypad.h
  13. 79 0
      bsp/air724/sdk/api/include/iot_lcd.h
  14. 101 0
      bsp/air724/sdk/api/include/iot_network.h
  15. 436 0
      bsp/air724/sdk/api/include/iot_os.h
  16. 100 0
      bsp/air724/sdk/api/include/iot_pmd.h
  17. 677 0
      bsp/air724/sdk/api/include/iot_socket.h
  18. 80 0
      bsp/air724/sdk/api/include/iot_spi.h
  19. 67 0
      bsp/air724/sdk/api/include/iot_sys.h
  20. 56 0
      bsp/air724/sdk/api/include/iot_tts.h
  21. 52 0
      bsp/air724/sdk/api/include/iot_types.h
  22. 67 0
      bsp/air724/sdk/api/include/iot_uart.h
  23. 98 0
      bsp/air724/sdk/api/include/iot_vat.h
  24. 51 0
      bsp/air724/sdk/api/include/iot_zbar.h
  25. 32 0
      bsp/air724/sdk/api/src/iot_adc.c
  26. 250 0
      bsp/air724/sdk/api/src/iot_audio.c
  27. 100 0
      bsp/air724/sdk/api/src/iot_camera.c
  28. 53 0
      bsp/air724/sdk/api/src/iot_debug.c
  29. 75 0
      bsp/air724/sdk/api/src/iot_flash.c
  30. 231 0
      bsp/air724/sdk/api/src/iot_fs.c
  31. 55 0
      bsp/air724/sdk/api/src/iot_gpio.c
  32. 67 0
      bsp/air724/sdk/api/src/iot_i2c.c
  33. 16 0
      bsp/air724/sdk/api/src/iot_keypad.c
  34. 73 0
      bsp/air724/sdk/api/src/iot_lcd.c
  35. 337 0
      bsp/air724/sdk/api/src/iot_network.c
  36. 489 0
      bsp/air724/sdk/api/src/iot_os.c
  37. 122 0
      bsp/air724/sdk/api/src/iot_pmd.c
  38. 550 0
      bsp/air724/sdk/api/src/iot_socket.c
  39. 78 0
      bsp/air724/sdk/api/src/iot_spi.c
  40. 76 0
      bsp/air724/sdk/api/src/iot_sys.c
  41. 51 0
      bsp/air724/sdk/api/src/iot_tts.c
  42. 74 0
      bsp/air724/sdk/api/src/iot_uart.c
  43. 628 0
      bsp/air724/sdk/api/src/iot_vat.c
  44. 54 0
      bsp/air724/sdk/api/src/iot_zbar.c
  45. 6 0
      bsp/air724/sdk/app/luatos/CMakeLists.txt
  46. 0 0
      bsp/air724/sdk/app/luatos/luatos_main.c
  47. 524 0
      bsp/air724/sdk/cmake/extension.cmake
  48. 85 0
      bsp/air724/sdk/cmake/toolchain-gcc.cmake
  49. 62 0
      bsp/air724/sdk/components/include/app_config.h
  50. 281 0
      bsp/air724/sdk/components/include/atr_config.h
  51. 53 0
      bsp/air724/sdk/components/include/audio_config.h
  52. 141 0
      bsp/air724/sdk/components/include/boot_config.h
  53. 44 0
      bsp/air724/sdk/components/include/cfw_config.h
  54. 43 0
      bsp/air724/sdk/components/include/diag_config.h
  55. 92 0
      bsp/air724/sdk/components/include/drv_config.h
  56. 18 0
      bsp/air724/sdk/components/include/fatfs_config.h
  57. 20 0
      bsp/air724/sdk/components/include/fota_config.h
  58. 62 0
      bsp/air724/sdk/components/include/fs_config.h
  59. 36 0
      bsp/air724/sdk/components/include/fupdate_config.h
  60. 229 0
      bsp/air724/sdk/components/include/hal_iomux_pincfg.h
  61. 229 0
      bsp/air724/sdk/components/include/hal_iomux_pindef.h
  62. 36 0
      bsp/air724/sdk/components/include/hal_keypad_def.h
  63. 19 0
      bsp/air724/sdk/components/include/http_config.h
  64. 171 0
      bsp/air724/sdk/components/include/kernel_config.h
  65. 21 0
      bsp/air724/sdk/components/include/mal_config.h
  66. 18 0
      bsp/air724/sdk/components/include/ml_config.h
  67. 20 0
      bsp/air724/sdk/components/include/modem_config.h
  68. 19 0
      bsp/air724/sdk/components/include/mupnp_config.h
  69. 28 0
      bsp/air724/sdk/components/include/net_config.h
  70. 150 0
      bsp/air724/sdk/components/include/netdb.h
  71. 22 0
      bsp/air724/sdk/components/include/nvm_config.h
  72. 11 0
      bsp/air724/sdk/components/include/openat_config.h
  73. 2625 0
      bsp/air724/sdk/components/include/osi_api.h
  74. 224 0
      bsp/air724/sdk/components/include/osi_clock.h
  75. 223 0
      bsp/air724/sdk/components/include/osi_compiler.h
  76. 183 0
      bsp/air724/sdk/components/include/osi_log.h
  77. 1053 0
      bsp/air724/sdk/components/include/osi_log_imp.h
  78. 312 0
      bsp/air724/sdk/components/include/osi_mem.h
  79. 399 0
      bsp/air724/sdk/components/include/osi_vsmap.h
  80. 22 0
      bsp/air724/sdk/components/include/rpc_config.h
  81. 672 0
      bsp/air724/sdk/components/include/sockets.h
  82. 63 0
      bsp/air724/sdk/components/include/srv_config.h
  83. 42 0
      bsp/air724/sdk/components/include/tts_config.h
  84. 695 0
      bsp/air724/sdk/components/include/vfs.h
  85. BIN=BIN
      bsp/air724/sdk/components/lib/lua.img
  86. 155 0
      bsp/air724/sdk/components/net_inc/aes.h
  87. 693 0
      bsp/air724/sdk/components/net_inc/check_config.h
  88. 2529 0
      bsp/air724/sdk/components/net_inc/compat-1.3.h
  89. 3177 0
      bsp/air724/sdk/components/net_inc/config.h
  90. 307 0
      bsp/air724/sdk/components/net_inc/md5.h
  91. 325 0
      bsp/air724/sdk/components/net_inc/sha1.h
  92. 140 0
      bsp/air724/sdk/components/newlib/include/_ansi.h
  93. 12 0
      bsp/air724/sdk/components/newlib/include/_newlib_version.h
  94. 40 0
      bsp/air724/sdk/components/newlib/include/_syslist.h
  95. 21 0
      bsp/air724/sdk/components/newlib/include/alloca.h
  96. 69 0
      bsp/air724/sdk/components/newlib/include/ar.h
  97. 33 0
      bsp/air724/sdk/components/newlib/include/argz.h
  98. 52 0
      bsp/air724/sdk/components/newlib/include/assert.h
  99. 153 0
      bsp/air724/sdk/components/newlib/include/complex.h
  100. 30 0
      bsp/air724/sdk/components/newlib/include/cpio.h

+ 3 - 0
.gitignore

@@ -76,3 +76,6 @@ __pycache__
 *.tlv
 *.fs
 bsp/air302/air302_sdk/**
+/bsp/air724/sdk/out
+/bsp/air724/sdk/hex
+/bsp/air724/sdk/prebuilts/win32

+ 549 - 0
bsp/air724/sdk/CMakeLists.txt

@@ -0,0 +1,549 @@
+# Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+# All rights reserved.
+#
+# This software is supplied "AS IS" without any warranties.
+# RDA assumes no responsibility or liability for the use of the software,
+# conveys no license or title under any patent, copyright, or mask work
+# right to the product. RDA reserves the right to make changes in the
+# software without notification.  RDA also make no representation or
+# warranty that such application will be suitable for the specified use
+# without further testing or modification.
+
+cmake_minimum_required(VERSION 3.13)
+
+set(SOURCE_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(BINARY_TOP_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(CMAKE_C_COMPILER_FORCED   1)
+set(CMAKE_CXX_COMPILER_FORCED 1)
+
+add_definitions(-D_WINSOCKAPI_)
+
+#DEFINED BUILD_TARGET
+if(DEFINED ENV{BUILD_TARGET})
+	set(BUILD_TARGET $ENV{BUILD_TARGET})
+	message("BUILD_TARGET: ${BUILD_TARGET}")
+else()
+	message(FATAL_ERROR "BUILD_TARGET: UNDEFINED")
+endif()
+
+#DEFINED CSDK_PRO
+if(DEFINED ENV{CSDK_PRO})
+	set(CSDK_PRO $ENV{CSDK_PRO})
+	add_definitions(-DCSDK_PRO="${CSDK_PRO}")
+	message("CSDK_PRO: ${CSDK_PRO}")
+else()
+	message(FATAL_ERROR "CSDK_PRO: UNDEFINED")
+endif()
+
+#DEFINED CSDK_VER
+if(DEFINED ENV{CSDK_VER})
+	set(CSDK_VER $ENV{CSDK_VER})
+	add_definitions(-DCSDK_VER="${CSDK_VER}")
+	message("CSDK_VER: ${CSDK_VER} ")
+else()
+	message(FATAL_ERROR "CSDK_VER: UNDEFINED")
+endif()
+
+
+
+#select FOTA_FLAG app or core or all
+if(DEFINED ENV{FOTA_FLAG})
+	set(FOTA_FLAG $ENV{FOTA_FLAG})
+	set(FOTA_TYPE $ENV{FOTA_TYPE})
+	
+	if (NOT (${FOTA_FLAG} STREQUAL  "fota"))
+		message(FATAL_ERROR "FOTA_FLAG: ${FOTA_FLAG} != fota")
+	endif()
+	
+	if (NOT ((${FOTA_TYPE} STREQUAL  "app") OR (${FOTA_TYPE} STREQUAL  "core") OR (${FOTA_TYPE} STREQUAL "all")))
+		message(FATAL_ERROR "FOTA_TYPE: ${FOTA_TYPE} != app or core or all")
+	endif()
+	
+	message("${FOTA_FLAG}=${FOTA_TYPE}")
+endif()
+
+#select core_type  0=iot_SDK_720U 1:iot_SDK_720U_TTS
+if(DEFINED ENV{AM_MODEL})
+	set(AM_MODEL $ENV{AM_MODEL})
+	if ((${AM_MODEL} STREQUAL  "iot_SDK_720U"))
+		message("core/iot_SDK_720U")
+		set(core_type 0)
+		include(${CMAKE_SOURCE_DIR}/core/${AM_MODEL}/memd/version.cmake)
+		set(core_name CSDK_RDA8910)
+		set(core_vername CSDK_${CORE_VER}_RDA8910)
+		set(core_bin_dir ${CMAKE_SOURCE_DIR}/core/iot_SDK_720U)
+		set(core_stub_o ${core_bin_dir}/lib/core_stub.o)
+		include(${core_bin_dir}/memd/core_config.cmake)
+		include(${core_bin_dir}/memd/partinfo.cmake)
+		include_directories(${core_bin_dir}/memd)
+		
+        
+        if(CONFIG_BUILD_LUA)
+            set(csdk_target Air720U_CSDK_app_${CSDK_PRO})
+        else()
+            set(csdk_target Air720U_CSDK_demo_${CSDK_PRO})
+        endif(CONFIG_BUILD_LUA)
+
+		set(APP_IMG_NAME "8915DM_cat1_CSDK")
+	elseif((${AM_MODEL} STREQUAL  "iot_SDK_720U_TTS"))
+		message("core/iot_SDK_720U_TTS")
+		set(core_type 1)
+		add_definitions(-DTTS_ENABLE)
+		include(${CMAKE_SOURCE_DIR}/core/${AM_MODEL}/memd/version.cmake)
+		set(core_name CSDK_RDA8910_TTS)
+		set(core_vername CSDK_${CORE_VER}_RDA8910_TTS)
+		set(core_bin_dir ${CMAKE_SOURCE_DIR}/core/iot_SDK_720U_TTS)
+		set(core_stub_o ${core_bin_dir}/lib/core_stub.o)
+		include(${core_bin_dir}/memd/core_config.cmake)
+		include(${core_bin_dir}/memd/partinfo.cmake)
+		include_directories(${core_bin_dir}/memd)
+        set(csdk_target Air720U_CSDK_TTS_demo_${CSDK_PRO})
+		set(APP_IMG_NAME "8915DM_cat1_CSDK_TTS")
+
+	else()
+		message(FATAL_ERROR "AM_MODEL: ${AM_MODEL} != iot_SDK_720U_TTS or iot_SDK_720U")
+	endif()
+endif()
+
+set(out_hex_dir ${CMAKE_CURRENT_BINARY_DIR}/hex)
+set(out_lib_dir ${CMAKE_CURRENT_BINARY_DIR}/lib)
+set(out_rel_dir ${CMAKE_CURRENT_BINARY_DIR}/rel)
+set(out_inc_dir ${CMAKE_CURRENT_BINARY_DIR}/include)
+set(tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/tools)
+
+set(flash_ldscript ${SOURCE_TOP_DIR}/ldscripts/app_flashimg.ld)
+set(file_ldscript ${SOURCE_TOP_DIR}/ldscripts/app_fileimg.ld)
+set(cmd_mkappimg dtools mkappimg)
+set(pacgen_py ${tools_dir}/pacgen.py)
+set(gdbComGen_py ${tools_dir}/gdbComGen.py)
+#/*+\DEL\chenzhimin\2020.07.8\ */
+# set(pacgen_core_py ${tools_dir}/combine_core.py)
+#/*-\DEL\chenzhimin\2020.07.8\ */
+
+
+include(cmake/toolchain-gcc.cmake)
+
+#/*+\NEW\chenzhimin\2020.07.8\ */
+
+include(cmake/extension.cmake)
+include(config.cmake)
+
+if( NOT CONFIG_BOOT_FLASH_ADDRESS )
+math(EXPR CONFIG_BOOT_FLASH_ADDRESS "${CONFIG_NOR_PHY_ADDRESS}+${CONFIG_BOOT_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+math(EXPR CONFIG_APP_FLASH_ADDRESS "${CONFIG_NOR_PHY_ADDRESS}+${CONFIG_APP_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+math(EXPR CONFIG_FS_MODEM_FLASH_ADDRESS "${CONFIG_NOR_PHY_ADDRESS}+${CONFIG_FS_MODEM_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+
+
+math(EXPR CONFIG_FS_SYS_FLASH_ADDRESS "${CONFIG_NOR_PHY_ADDRESS}+${CONFIG_FS_SYS_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+endif()
+set(CONFIG_NVBIN_FIXED_SIZE 0x20000)
+#/*-\NEW\chenzhimin\2020.07.8\ */
+
+
+set(BUILD_SHARED_LIBS OFF)
+
+project(core C CXX ASM)
+
+
+#/*+\NEW\chenzhimin\2020.07.8\ add elua*/
+if(CONFIG_BUILD_LUA)
+    include_directories(components/kernel_inc)
+    add_definitions(-DAM_LUA_SUPPORT)
+    math(EXPR CONFIG_LUA_FLASH_ADDRESS "${CONFIG_NOR_PHY_ADDRESS}+${CONFIG_LUA_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+    math(EXPR CONFIG_APPIMG_FLASH_SIZE "${CONFIG_LUA_FLASH_OFFSET}-${CONFIG_APPIMG_FLASH_OFFSET}" OUTPUT_FORMAT HEXADECIMAL)
+    add_subdirectory_if_exist(app/elua)
+endif(CONFIG_BUILD_LUA)
+#/*-\NEW\chenzhimin\2020.07.8\ add elua*/
+
+include_directories(components/include components/openat_inc)
+
+include_directories(components/newlib/include)
+
+function(cpp_only target file)
+    add_library(${target} OBJECT ${file})
+    set_source_files_properties(${file} PROPERTIES LANGUAGE C)
+    target_compile_options(${target} PRIVATE -E -P -x c)
+endfunction()
+
+function(add_appimg target ldscript)
+    set(gen_ldscript ${target}_ldscript)
+    set(target_map_file ${out_hex_dir}/${target}.map)
+    set(target_img_file ${out_hex_dir}/${target}.img)
+    cpp_only(${gen_ldscript} ${ldscript})
+    add_executable(${target} ${ARGN} ${core_stub_o})
+    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out_hex_dir})
+    target_link_libraries(${target} PRIVATE -T $<TARGET_OBJECTS:${gen_ldscript}>)
+    target_link_libraries(${target} PRIVATE -Wl,-Map=${target_map_file} -nostdlib -Wl,--gc-sections)
+
+    add_custom_command(TARGET ${target} POST_BUILD
+        COMMAND ${cmd_mkappimg} $<TARGET_FILE:${target}> ${target_img_file}
+        BYPRODUCTS ${target_img_file} ${target_map_file}
+    )
+endfunction()
+
+#/*+\DEL\chenzhimin\2020.07.8\*/
+# configure_file(${SOURCE_TOP_DIR}/components/lib/fdl1.img ${out_hex_dir}/fdl1.img COPYONLY)
+# configure_file(${SOURCE_TOP_DIR}/components/lib/fdl2.img ${out_hex_dir}/fdl2.img COPYONLY)
+#/*-\DEL\chenzhimin\2020.07.8\*/
+
+#/*+\ADD\chenzhimin\2020.07.8\*/
+configure_file(${SOURCE_TOP_DIR}/components/lib/lua.img ${out_hex_dir}/lua.img COPYONLY)
+#/*-\ADD\chenzhimin\2020.07.8\*/
+
+#/*+\ADD\chenzhimin\2020.07.8\ add dtools*/
+set(dtoolspath ${SOURCE_TOP_DIR}/tools/win32/dtools.exe)
+execute_process(
+    COMMAND ${dtoolspath} pacdump ${core_bin_dir}/${core_name}.pac ${out_hex_dir}/oldpac
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+)
+#/*-\ADD\chenzhimin\2020.07.8\ add dtools*/
+
+#/*+\DEL\chenzhimin\2020.07.8\*/
+# macro(pac_init_fdl cmd pac_config)
+#     set(${cmd}
+#         cfg-init --pname UIX8910_MODEM --palias "APPIMG"
+#             --pversion "8910 MODULE" --version "BP_R1.0.0"
+#             --flashtype 1 ${pac_config}
+#         cfg-host-fdl -a ${CONFIG_FDL1_IMAGE_START} -s ${CONFIG_FDL1_IMAGE_SIZE}
+#             -p ${out_hex_dir}/fdl1.img ${pac_config}
+#         cfg-fdl2 -a ${CONFIG_FDL2_IMAGE_START} -s ${CONFIG_FDL2_IMAGE_SIZE}
+#             -p ${out_hex_dir}/fdl2.img ${pac_config}
+#     )
+# endmacro()
+#/*-\DEL\chenzhimin\2020.07.8\*/
+
+#/*+\ADD\chenzhimin\2020.07.8\*/
+macro(pac_init_fdl cmd pac_config)
+    set(${cmd}
+        cfg-init --pname UIX8910_MODEM --palias "APPIMG"
+            --pversion "8910 MODULE" --version "BP_R1.0.0"
+            --flashtype 1 ${pac_config}
+        cfg-host-fdl -a ${CONFIG_FDL1_IMAGE_START} -s ${CONFIG_FDL1_IMAGE_SIZE}
+            -p ${out_hex_dir}/oldpac/fdl1.sign.img ${pac_config}
+        cfg-fdl2 -a ${CONFIG_FDL2_IMAGE_START} -s ${CONFIG_FDL2_IMAGE_SIZE}
+            -p ${out_hex_dir}/oldpac/fdl2.sign.img ${pac_config}
+    )
+endmacro()
+#/*-\ADD\chenzhimin\2020.07.8\*/
+
+if(CONFIG_APPIMG_LOAD_FLASH)
+    set(target appimg_flash_delete)
+    set(pac_config ${out_hex_dir}/${target}.json)
+    set(pac_file ${out_hex_dir}/${target}.pac)
+    pac_init_fdl(init_fdl ${pac_config})
+    execute_process(
+        COMMAND python3 ${pacgen_py} ${init_fdl}
+            cfg-erase-flash -i ERASE_APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS}
+                -s ${CONFIG_APPIMG_FLASH_SIZE} ${pac_config}
+            dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+        OUTPUT_VARIABLE pac_dep
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+
+    add_custom_command(OUTPUT ${pac_file}
+        COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+        DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+    add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
+endif()
+
+if(CONFIG_APPIMG_LOAD_FILE)
+    set(target appimg_file_delete)
+    set(pac_config ${out_hex_dir}/${target}.json)
+    set(pac_file ${out_hex_dir}/${target}.pac)
+    pac_init_fdl(init_fdl ${pac_config})
+    execute_process(
+        COMMAND python3 ${pacgen_py} ${init_fdl}
+            cfg-del-appimg -i DEL_APPIMG ${pac_config}
+            dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+        OUTPUT_VARIABLE pac_dep
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+
+    add_custom_command(OUTPUT ${pac_file}
+        COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+        DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+    add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
+endif()
+
+add_subdirectory_if_exist(components/ril)
+add_subdirectory_if_exist(api)
+add_subdirectory_if_exist(../../../lua, lua)
+add_subdirectory_if_exist(../../../luat, luat)
+#/*+\ADD\chenzhimin\2020.07.9\*/
+if( CONFIG_BUILD_APP_SSL OR 
+CONFIG_BUILD_APP_FTP OR
+CONFIG_BUILD_APP_HTTP OR
+CONFIG_BUILD_APP_LITTLEVGL OR
+CONFIG_BUILD_APP_MQTT OR
+CONFIG_BUILD_APP_OLED_SSD1306 OR
+CONFIG_BUILD_APP_OneWire)
+    add_subdirectory_if_exist(app)
+endif()
+#/*-\ADD\chenzhimin\2020.07.9\*/
+
+set(target ${csdk_target})
+set(hex_bin_dir ${CMAKE_SOURCE_DIR}/hex/${target})
+set(hex_map_dir ${CMAKE_SOURCE_DIR}/hex/${target}_map)
+
+set(core_map_dir ${core_bin_dir}_map)
+set(hex_app_file ${hex_bin_dir}/${target}_APP.pac)
+if(CONFIG_APPIMG_LOAD_FILE)
+set(pac_delete_file ${out_hex_dir}/appimg_file_delete.pac) 
+set(hex_delete_file ${hex_bin_dir}/appimg_file_delete.pac)
+elseif(CONFIG_APPIMG_LOAD_FLASH)
+set(pac_delete_file ${out_hex_dir}/appimg_flash_delete.pac) 
+set(hex_delete_file ${hex_bin_dir}/appimg_flash_delete.pac)
+endif()
+set(hex_app_with_core_file ${hex_bin_dir}/${target}.pac)
+set(hex_map_file ${hex_map_dir}/${core_name}.map)
+set(hex_elf_file ${hex_map_dir}/${core_name}.elf)
+
+if(CONFIG_APPIMG_LOAD_FLASH)
+    
+    if(CONFIG_BUILD_LUA)
+        add_subdirectory_if_exist(app/elua/user)
+    else()
+        add_subdirectory_if_exist(demo/${BUILD_TARGET})
+    endif(CONFIG_BUILD_LUA)    
+    add_subdirectory_if_exist(app/${BUILD_TARGET})
+    target_link_libraries(${target} PRIVATE api)
+	target_link_libraries(${target} PRIVATE ../../../lua)
+	target_link_libraries(${target} PRIVATE ../../../luat)
+    #/*+\ADD\chenzhimin\2020.07.9\*/
+    if( CONFIG_BUILD_APP_SSL OR 
+    CONFIG_BUILD_APP_FTP OR
+    CONFIG_BUILD_APP_HTTP OR
+    CONFIG_BUILD_APP_LITTLEVGL OR
+    CONFIG_BUILD_APP_MQTT OR
+    CONFIG_BUILD_APP_OLED_SSD1306 OR
+    CONFIG_BUILD_APP_OneWire)
+        target_link_libraries(${target} PRIVATE app)
+    endif()
+    #/*-\ADD\chenzhimin\2020.07.9\*/
+
+    target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
+    #/*+\DEL\chenzhimin\2020.07.8\*/
+    # set(pac_config ${out_hex_dir}/${target}.json)
+    #/*-\DEL\chenzhimin\2020.07.8\*/ 
+
+    #/*+\ADD\chenzhimin\2020.07.8\*/
+    set(pac_config ${out_hex_dir}/${target}_APP.json)
+    set(pac_all_config ${out_hex_dir}/${target}.json)
+    #/*-\ADD\chenzhimin\2020.07.8\*/
+
+    set(pac_file ${out_hex_dir}/${target}_APP.pac)
+	set(pac_file_with_core ${out_hex_dir}/${target}.pac)
+    pac_init_fdl(init_fdl ${pac_config})
+    #/*+\ADD\chenzhimin\2020.07.8\*/
+    pac_init_fdl(init_all_fdl ${pac_all_config})
+    if(CONFIG_BUILD_LUA)
+        set(pac_app_8910
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_config}
+                cfg-image -i LUA -a ${CONFIG_LUA_FLASH_ADDRESS} -s ${CONFIG_LUA_FLASH_SIZE}
+                    -p ${out_hex_dir}/lua.img ${pac_config}
+        )
+        set(pac_all_8910
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_all_config}
+                cfg-image -i LUA -a ${CONFIG_LUA_FLASH_ADDRESS} -s ${CONFIG_LUA_FLASH_SIZE}
+                    -p ${out_hex_dir}/lua.img ${pac_all_config}
+        )
+    else()
+         set(pac_app_8910
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_config}
+        )   
+        set(pac_all_8910
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_all_config}
+        )   
+    endif(CONFIG_BUILD_LUA)
+    execute_process(
+        COMMAND python3 ${pacgen_py}
+            ${init_fdl}
+            ${pac_app_8910}
+            dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+        OUTPUT_VARIABLE pac_dep
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )       
+    #/*-\ADD\chenzhimin\2020.07.8\*/
+
+    #/*+\DEL\chenzhimin\2020.07.8\*/
+    # execute_process(
+    #     COMMAND python3 ${pacgen_py} ${init_fdl}
+    #         cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+    #             -p ${out_hex_dir}/${target}.img ${pac_config}
+    #         dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+    #     OUTPUT_VARIABLE pac_dep
+    #     OUTPUT_STRIP_TRAILING_WHITESPACE
+    #     WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    # )
+    #/*-\DEL\chenzhimin\2020.07.8\*/
+
+    add_custom_command(OUTPUT ${pac_file}
+        COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+        DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+	message(!!!!!!!!!!!!!!!!!!!!!!${pac_file_with_core})
+    
+    #/*+\DEL\chenzhimin\2020.07.8\*/
+	# ##+ zhuwangbin 2020-6-30 add sffs.img
+	# if (EXISTS ${out_hex_dir}/sffs.img)
+	# 	add_custom_command(OUTPUT ${pac_file_with_core}
+	# 		COMMAND python3 ${pacgen_core_py} ${out_hex_dir}/${target}.img ${pac_file_with_core} ${TTS_ENABLE} ${out_hex_dir}/sffs.img
+	# 		DEPENDS ${pacgen_core_py} ${pac_dep}
+	# 		WORKING_DIRECTORY ${SOURCE_TOP_DIR})
+	# else()
+	# 	add_custom_command(OUTPUT ${pac_file_with_core}
+	# 		COMMAND python3 ${pacgen_core_py} ${out_hex_dir}/${target}.img ${pac_file_with_core} ${TTS_ENABLE} NULL
+	# 		DEPENDS ${pacgen_core_py} ${pac_dep}
+	# 		WORKING_DIRECTORY ${SOURCE_TOP_DIR})
+	# endif()
+	# ##- zhuwangbin 2020-6-30 add sffs.img
+    #/*-\DEL\chenzhimin\2020.07.8\*/
+  
+    #/*+\ADD\chenzhimin\2020.07.8\*/
+    pac_nvitem_8910(nvitem_all_8910 ${pac_all_config})
+    set(pac_other_8910
+            cfg-phase-check ${pac_all_config}
+            cfg-image -i BOOTLOADER -a ${CONFIG_BOOT_FLASH_ADDRESS} -s ${CONFIG_BOOT_FLASH_SIZE}
+                -p ${out_hex_dir}/oldpac/boot.sign.img ${pac_all_config}
+            cfg-image -i AP -a ${CONFIG_APP_FLASH_ADDRESS} -s ${CONFIG_APP_FLASH_SIZE}
+                -p ${out_hex_dir}/oldpac/${APP_IMG_NAME}.sign.img ${pac_all_config}
+            cfg-image -i PS -a ${CONFIG_FS_MODEM_FLASH_ADDRESS} -s ${CONFIG_FS_MODEM_FLASH_SIZE}
+                -p ${out_hex_dir}/oldpac/cat1_64X128_UIS8915DM_BB_RF_SingleSim.img ${pac_all_config}
+            ${pac_all_8910}
+            cfg-image -i SFFS -a ${CONFIG_FS_SYS_FLASH_ADDRESS} -s ${CONFIG_FS_SYS_FLASH_SIZE}
+                -p ${out_hex_dir}/oldpac/sffs.img ${pac_all_config}
+            cfg-erase-flash -i FLASH -a 0xFE000001 -s 0 ${pac_all_config}
+            cfg-nv -s ${CONFIG_NVBIN_FIXED_SIZE} 
+                -p ${out_hex_dir}/oldpac/cat1_64X128_UIS8915DM_BB_RF_SingleSim_nvitem.bin ${pac_all_config}
+        )
+    execute_process(
+        COMMAND python3 ${pacgen_py}
+            ${init_all_fdl}
+            ${nvitem_all_8910}
+            ${pac_other_8910}
+            dep-gen --base ${SOURCE_TOP_DIR} ${pac_all_config}
+        OUTPUT_VARIABLE pac_dep
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+    add_custom_command(OUTPUT ${pac_file_with_core}
+        COMMAND python3 ${pacgen_py} pac-gen ${pac_all_config} ${pac_file_with_core}
+        DEPENDS ${pacgen_py} ${pac_all_config} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+    #/*-\ADD\chenzhimin\2020.07.8\*/
+
+	add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file} ${pac_file_with_core})
+endif()
+
+if(CONFIG_APPIMG_LOAD_FILE)
+    
+    if(CONFIG_BUILD_LUA)
+        add_subdirectory_if_exist(app/elua/user)
+    else()
+        add_subdirectory_if_exist(demo/${BUILD_TARGET})
+    endif(CONFIG_BUILD_LUA)    
+
+    target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
+    set(pac_config ${out_hex_dir}/${target}.json)
+    set(pac_file ${out_hex_dir}/${target}_APP.pac)
+	set(pac_file_with_core ${out_hex_dir}/${target}.pac)
+	
+    pac_init_fdl(init_fdl ${pac_config})
+    execute_process(
+        COMMAND python3 ${pacgen_py} ${init_fdl}
+            cfg-pack-file -i APPIMG -p ${out_hex_dir}/${target}.img
+                -n ${CONFIG_APPIMG_LOAD_FILE_NAME} ${pac_config}
+            dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+        OUTPUT_VARIABLE pac_dep
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+
+    add_custom_command(OUTPUT ${pac_file}
+        COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+        DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+
+	add_custom_command(OUTPUT ${pac_file_with_core}
+		COMMAND python3 ${pacgen_core_py} ${out_hex_dir}/${target}.img ${pac_file_with_core} TTS_ENABLE
+		DEPENDS ${pacgen_core_py} ${pac_dep}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+	)
+    add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file} ${pac_file_with_core})
+endif()
+
+add_custom_command(OUTPUT ${hex_app_file} ${hex_app_with_core_file} ${hex_delete_file} ${hex_map_file} ${hex_elf_file}
+	COMMAND ${CMAKE_COMMAND} -E make_directory ${hex_bin_dir}
+	COMMAND ${CMAKE_COMMAND} -E copy ${pac_file} ${hex_app_file}
+	COMMAND ${CMAKE_COMMAND} -E copy ${pac_file_with_core} ${hex_app_with_core_file}
+	COMMAND ${CMAKE_COMMAND} -E make_directory ${hex_map_dir}
+	COMMAND ${CMAKE_COMMAND} -E copy ${core_map_dir}/${core_name}.map ${hex_map_file}
+    COMMAND ${CMAKE_COMMAND} -E copy ${core_map_dir}/${core_name}.elf ${hex_elf_file}
+    COMMAND ${CMAKE_COMMAND} -E copy ${out_hex_dir}/${target}.elf ${hex_map_dir}/app.elf
+    COMMAND ${CMAKE_COMMAND} -E copy ${out_hex_dir}/${target}.map ${hex_map_dir}/app.map
+    COMMAND python3 ${gdbComGen_py} ${CMAKE_SOURCE_DIR} /hex/${target}_map/app.elf
+	DEPENDS ${pac_file} ${pac_file_with_core} 
+	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+	
+#/*+\NEW\zhuwangbin\2020.07.1\add dofta.bin */
+if(DEFINED ENV{FOTA_TYPE})
+		set(hex_fota_file ${CSDK_PRO}_${CSDK_VER}_${core_vername}.dfota.bin)
+		
+		if (${FOTA_TYPE} STREQUAL  "all")
+			add_custom_command(OUTPUT ${hex_fota_file}
+				COMMAND ${CMAKE_COMMAND} -E copy ${out_hex_dir}/${target}.img ${target}.img
+				COMMAND ${CMAKE_COMMAND} -E copy ${core_bin_dir}/${core_name}.pac  ${core_name}.pac
+				COMMAND ${CMAKE_COMMAND} -E rename ${target}.img app.bin
+				COMMAND ${CMAKE_COMMAND} -E rename ${core_name}.pac ${core_name}.bin
+				COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${hex_bin_dir}.zip" "--format=zip" "${core_name}.bin" "app.bin"
+				COMMAND ${CMAKE_COMMAND} -E rename ${hex_bin_dir}.zip ${hex_fota_file}
+				COMMAND ${CMAKE_COMMAND} -E remove [-f] ${core_name}.bin app.bin
+				DEPENDS ${out_hex_dir}/${target}.img ${hex_app_file} ${hex_app_with_core_file}
+				WORKING_DIRECTORY ${hex_bin_dir})
+				add_custom_target(${target}_release ALL DEPENDS ${hex_app_file} ${hex_app_with_core_file} ${hex_map_file} ${hex_elf_file} ${hex_fota_file})
+		endif()
+		
+		if (${FOTA_TYPE} STREQUAL  "core")
+			add_custom_command(OUTPUT ${hex_fota_file}
+			COMMAND ${CMAKE_COMMAND} -E copy ${core_bin_dir}/${core_name}.pac  ${core_name}.pac
+			COMMAND ${CMAKE_COMMAND} -E rename ${core_name}.pac ${core_name}.bin
+			COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${hex_bin_dir}.zip" "--format=zip" "${core_name}.bin" 
+			COMMAND ${CMAKE_COMMAND} -E rename ${hex_bin_dir}.zip ${hex_fota_file}
+			COMMAND ${CMAKE_COMMAND} -E remove [-f] ${core_name}.bin
+			DEPENDS ${out_hex_dir}/${target}.img ${hex_app_file} ${hex_app_with_core_file}
+			WORKING_DIRECTORY ${hex_bin_dir})
+			add_custom_target(${target}_release ALL DEPENDS ${hex_app_file} ${hex_app_with_core_file} ${hex_map_file} ${hex_elf_file} ${hex_fota_file})
+
+		endif()
+		
+		if (${FOTA_TYPE} STREQUAL  "app")
+			add_custom_command(OUTPUT ${hex_fota_file}
+			COMMAND ${CMAKE_COMMAND} -E copy ${out_hex_dir}/${target}.img ${target}.img
+			COMMAND ${CMAKE_COMMAND} -E rename ${target}.img app.bin
+			COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${hex_bin_dir}.zip" "--format=zip" "app.bin" 
+			COMMAND ${CMAKE_COMMAND} -E rename ${hex_bin_dir}.zip ${hex_fota_file}
+			COMMAND ${CMAKE_COMMAND} -E remove [-f] app.bin
+			DEPENDS ${out_hex_dir}/${target}.img ${hex_app_file} ${hex_app_with_core_file}
+			WORKING_DIRECTORY ${hex_bin_dir})
+			add_custom_target(${target}_release ALL DEPENDS ${hex_app_file} ${hex_app_with_core_file} ${hex_map_file} ${hex_elf_file} ${hex_fota_file})
+		endif()
+else()
+	add_custom_target(${target}_release ALL DEPENDS ${hex_app_file} ${hex_app_with_core_file} ${hex_map_file} ${hex_elf_file})
+endif()
+#/*-\NEW\zhuwangbin\2020.07.1\add dofta.bin */
+

+ 56 - 0
bsp/air724/sdk/api/CMakeLists.txt

@@ -0,0 +1,56 @@
+# Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+# All rights reserved.
+#
+# This software is supplied "AS IS" without any warranties.
+# RDA assumes no responsibility or liability for the use of the software,
+# conveys no license or title under any patent, copyright, or mask work
+# right to the product. RDA reserves the right to make changes in the
+# software without notification.  RDA also make no representation or
+# warranty that such application will be suitable for the specified use
+# without further testing or modification.
+
+
+
+#configure_file(include/fota_config.h.in ${BINARY_TOP_DIR}/include/fota_config.h)
+
+
+set(target api)
+add_library(${target} STATIC)
+set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_hex_dir})
+target_link_libraries(${target} PRIVATE ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
+#target_link_libraries(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../components/lib/libopenat.a)
+
+
+#设置包�头文�
+target_include_directories(${target} PUBLIC include)
+target_include_directories(${target} PRIVATE ../components/include)
+target_include_directories(${target} PRIVATE ../components/newlib/include)
+target_include_directories(${target} PRIVATE ../components/openat_inc)
+target_include_directories(${target} PRIVATE ../components/ril/inc)
+
+target_link_libraries(${target} PRIVATE ril)
+
+target_sources(${target} PRIVATE
+    src/iot_os.c
+	src/iot_debug.c
+	src/iot_gpio.c
+	src/iot_fs.c
+	src/iot_uart.c
+	src/iot_flash.c
+	src/iot_adc.c
+	src/iot_i2c.c
+	src/iot_pmd.c
+	src/iot_keypad.c
+	src/iot_network.c
+	src/iot_spi.c
+	src/iot_sys.c
+	src/iot_vat.c
+	src/iot_socket.c
+	src/iot_lcd.c
+	src/iot_zbar.c
+	src/iot_camera.c
+	src/iot_tts.c
+	src/iot_audio.c
+)
+
+

+ 49 - 0
bsp/air724/sdk/api/include/iot_adc.h

@@ -0,0 +1,49 @@
+#ifndef __IOT_ADC_H__
+#define __IOT_ADC_H__
+
+#include "iot_os.h"
+
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_adc adc接口
+ * @{
+ */
+
+/**ADC初始化 
+*@param		channel:		adc通道
+*@param     mode:       adc模式
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_adc_init(
+                        E_AMOPENAT_ADC_CHANNEL channel  /* ADC编号 */,
+    					E_AMOPENAT_ADC_CFG_MODE mode
+                );
+
+
+/**读取ADC数据
+*@note ADC值,可以为空, 电压值,可以为空
+*@param		channel:		adc通道
+*@param		adcValue:	ADC值,可以为空
+*@param		voltage:	电压值,可以为空
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_adc_read(
+                        E_AMOPENAT_ADC_CHANNEL channel,    
+                        UINT32* adcValue,                
+                        UINT32* voltage                    
+                );
+
+/** @}*/
+/** @}*/
+
+
+
+
+
+#endif
+

+ 202 - 0
bsp/air724/sdk/api/include/iot_audio.h

@@ -0,0 +1,202 @@
+#ifndef __IOT_AUDIO_H__
+#define __IOT_AUDIO_H__
+
+#include "iot_os.h"
+#include "am_openat.h"
+
+
+
+/**
+ * @defgroup iot_sdk_audio 音频接口
+ * @{
+ */
+/**@example audio/demo_audio.c
+* audio接口示例
+*/
+
+/**打开语音
+*@note  在通话开始时调用
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_open_tch(                                        
+                        VOID
+                );
+
+/**关闭语音
+*@note  通话结束时调用
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_close_tch(                                      
+                        VOID
+                 );
+
+/**播放TONE音
+*@param  toneType:      TONE音类型
+*@param  duration:      播放时长
+*@param  volume:        播放音量
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_tone(                                        
+                        E_AMOPENAT_TONE_TYPE toneType,     
+                        UINT16 duration,                   
+                        E_AMOPENAT_SPEAKER_GAIN volume     
+                 );
+
+/**停止播放TONE音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_tone(                                        
+                        VOID
+                 );
+
+
+/**播放DTMF音
+*@param  dtmfType:      DTMF类型
+*@param  duration:      播放时长
+*@param  volume:        播放音量
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_dtmf(                                        
+                        E_AMOPENAT_DTMF_TYPE dtmfType,     
+                        UINT16 duration,                   
+                        E_AMOPENAT_SPEAKER_GAIN volume     
+                 );
+
+/**停止播放DTMF音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_dtmf(                            
+                        VOID
+                 );
+
+/**播放音频
+*@param  playParam:     播放参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_music(T_AMOPENAT_PLAY_PARAM*  playParam);
+
+/**停止音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_music(                                        
+                        VOID
+                  );
+
+/**暂停音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_pause_music(                                     
+                        VOID
+                   );
+
+/**恢复音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_resume_music(                                       
+                        VOID
+                    );
+
+/**设置扬声器静音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_mute_speaker(                                     
+                        VOID
+                    );
+
+/**解除扬声器静音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_unmute_speaker(                                   
+                        VOID
+                      );
+
+/**设置扬声器的音量值
+*@param     vol:   设置扬声器音量值
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_speaker_vol(                                   
+                        UINT32 vol 
+                        );
+
+/**获取扬声器的音量
+*@return	UINT32: 	 返回扬声器的音量值
+**/
+UINT32 iot_audio_get_speaker_vol(                
+                        VOID
+                                           );
+
+/**设通话的音量值
+*@param     vol:   设置通话音量值
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_sph_vol(                                   
+                        UINT32 vol 
+                        );
+
+/**获取通话的音量值
+*@return	UINT32: 	 返回通话的音量值
+**/
+UINT32 iot_audio_get_sph_vol(                
+                        VOID
+                        );
+
+/**设置音频通道
+*@param     channel:    通道
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_channel(                                       
+                        E_AMOPENAT_AUDIO_CHANNEL channel    
+                   );
+
+/**获取当前通道
+*@return	E_AMOPENAT_AUDIO_CHANNEL: 	  返回通道值
+**/
+E_AMOPENAT_AUDIO_CHANNEL iot_audio_get_current_channel(            
+                        VOID
+                                               );
+
+/**开始录音
+*@param     param:   录音参数
+*@param     cb:     获取录音数据回调
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_rec_start(
+                    			E_AMOPENAT_RECORD_PARAM* param,
+								AUD_RECORD_CALLBACK_T cb);
+
+/**停止录音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_rec_stop();
+
+/**流播放
+*@param  playformat:    数据流类型
+*@param  cb:    		数据流回调函数
+*@param  data:    		数据流
+*@param  len:  		  	数据流长度
+*@return	>0: 	    播放长度
+*           -1:      	播放失败
+**/
+int iot_audio_streamplay(E_AMOPENAT_AUD_FORMAT playformat,AUD_PLAY_CALLBACK_T cb,char* data,int len);
+
+/** @}*/
+
+
+#endif

+ 70 - 0
bsp/air724/sdk/api/include/iot_camera.h

@@ -0,0 +1,70 @@
+#ifndef __IOT_CAMERA_H__
+#define __IOT_CAMERA_H__
+
+#include "iot_os.h"
+
+/**
+ * @defgroup iot_sdk_device 外设接口
+ * @{
+ */
+	/**@example zbar/demo_zbar_camera.c
+	* camera接口示例
+	*/ 
+
+/**
+ * @defgroup iot_sdk_camera 摄像头接口
+ * @{
+ */
+
+/**摄像头初始化
+*@param		cameraParam:		初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_init(T_AMOPENAT_CAMERA_PARAM *cameraParam);
+
+/**打开摄像头
+*@param		videoMode:		是否视频模式
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_poweron(BOOL videoMode);  
+/**关闭摄像头
+*@return  TRUE:       成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_poweroff(void); 
+/**开始预览
+*@param  previewParam:       预览参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_preview_open(T_AMOPENAT_CAM_PREVIEW_PARAM *previewParam);
+/**退出预览
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_preview_close(void);
+/**拍照
+*@param  fileName:      保存图片的文件名
+*@param  captureParam:       预览参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_capture(char *fileName, T_AMOPENAT_CAM_CAPTURE_PARAM *captureParam);
+
+/**设置camera寄存器
+*@param  initRegTable_p: cam寄存器表
+*@param  len:   cam寄存器长度
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_WriteReg(PAMOPENAT_CAMERA_REG initRegTable_p, int len);
+
+/** @}*/
+/** @}*/
+
+
+#endif
+
+

+ 38 - 0
bsp/air724/sdk/api/include/iot_debug.h

@@ -0,0 +1,38 @@
+#ifndef __IOT_DEBUG_H__
+#define __IOT_DEBUG_H__
+
+#include "iot_os.h"
+#include "stdarg.h"
+
+/**
+ * @defgroup iot_sdk_debug 调试接口
+ * @{
+ */
+
+/**调试信息打印
+**/
+VOID iot_debug_print(     CHAR *fmt, ...);
+
+/**assert断言
+*@param		condition:	断言条件
+*@param		func:	    断言函数
+*@param		line:	    断言位置
+*@return	TURE: 	    成功
+*           FALSE:      失败
+**/
+VOID iot_debug_assert(                                            
+                        BOOL condition,                  
+                        CHAR *func,                      
+                        UINT32 line                     
+              );
+
+/**设置软件异常时,设备模式
+*@param		mode:	OPENAT_FAULT_RESET 重启模式
+                    OPENAT_FAULT_HANG  调试模式
+**/
+
+VOID iot_debug_set_fault_mode(E_OPENAT_FAULT_MODE mode);
+
+/** @}*/
+
+#endif

+ 76 - 0
bsp/air724/sdk/api/include/iot_flash.h

@@ -0,0 +1,76 @@
+#ifndef __IOT_FLASH_H__
+#define __IOT_FLASH_H__
+
+#include "iot_os.h"
+
+
+/**
+ * @defgroup iot_sdk_flash flash接口
+ * @{
+ */
+/**@example flash/demo_flash.c
+* flash接口示例
+*/ 
+
+/**获取flash可用的地址空间,返回的地址用来传入iot_flash_erase、iot_flash_write、iot_flash_read等接口。
+*@param		addrout:	返回可用flash地址
+*@param		lenout:	返回可用flash长度,单位为字节
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+*@note      该接口返回的地址是64KB对齐 返回的地址空间根据当前程序大小来确定。
+
+**/
+VOID iot_flash_getaddr(    
+                    UINT32* addrout,
+                    UINT32* lenout
+               );
+
+/**flash擦 
+*@param		startAddr:		擦写地址 64K对齐
+*@param		endAddr:		擦写结束地址
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_erase(              
+                    UINT32 startAddr,
+                    UINT32 endAddr
+               );
+
+/**flash写 
+*@param		startAddr:		写地址 
+*@param		size:		    写数据大小
+*@param		writenSize:		写数据类型大小
+*@param		buf:		    写数据指针
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_write(             
+                    UINT32 startAddr,
+                    UINT32 size,
+                    UINT32* writenSize,
+                    CONST UINT8* buf
+               );
+
+/**flash读
+*@param		startAddr:		读地址 
+*@param		size:		    读数据大小
+*@param		readSize:		读数据类型大小
+*@param		buf:		    读数据指针
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_read(              
+                    UINT32 startAddr,
+                    UINT32 size,
+                    UINT32* readSize,
+                    UINT8* buf
+               );
+
+
+
+/** @}*/
+
+
+
+
+
+
+
+#endif
+

+ 178 - 0
bsp/air724/sdk/api/include/iot_fs.h

@@ -0,0 +1,178 @@
+#ifndef __IOT_FS_H__
+#define __IOT_FS_H__
+
+#include "iot_os.h"
+
+
+/**
+ * @defgroup iot_sdk_fs 文件系统接口
+ * @{
+ */
+	/**@example fs/demo_fs.c
+	* fs接口示例
+	*/ 
+
+/**打开文件
+*@param		pszFileNameUniLe:		文件全路径名称
+*@param		iFlag:		打开标志详细请参见E_AMOPENAT_FILE_OPEN_FLAG
+*@return	INT32: 	    返回文件句柄
+**/
+INT32 iot_fs_open_file(                           
+                        char* pszFileNameUniLe,
+                        UINT32 iFlag         
+                  );
+
+/**关闭文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@return	INT32: 	    返回值小于0失败, 其余成功
+**/
+INT32 iot_fs_close_file(                     
+                        INT32 iFd           
+                   );
+
+/**读取文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		pBuf:		数据保存指针
+*@param		iLen:		buf长度
+*@return	INT32: 	    返回读取长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_read_file(                            
+                        INT32 iFd,            
+                        UINT8 *pBuf,            
+                        UINT32 iLen            
+                  );
+
+/**写入文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		pBuf:		需要写入的数据指针
+*@param		iLen:		数据长度
+*@return	INT32: 	    返回写入长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_write_file(                           
+                        INT32 iFd,            
+                        UINT8 *pBuf,          
+                        UINT32 iLen             
+                   );
+
+/**立即写入flash
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@return	INT32: 	    返回立即写入长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_flush_file(                           
+                        INT32 iFd              
+                   );    
+
+/**文件定位
+*@note  参数iOffset的含义取决于iOrigin的值.
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		iOffset:	偏移量
+*@param		iOrigin:	参数详细请参见E_AMOPENAT_FILE_SEEK_FLAG
+*@return	INT32: 	    返回文件的偏移量
+**/
+INT32 iot_fs_seek_file(                           
+                        INT32 iFd,            
+                        INT32 iOffset,         
+                        UINT8 iOrigin          
+                  );
+
+/**创建文件
+*@param		pszFileNameUniLe:	文件全路径名称
+*@return	INT32: 	            返回文件句柄, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_create_file(                          
+                        char* pszFileNameUniLe   
+                    );
+
+/**删除文件
+*@param		pszFileNameUniLe:	文件全路径名称
+*@return	INT32: 	            返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_delete_file(                          
+                        char* pszFileNameUniLe
+                    );
+
+/**切换当前工作目录
+*@param		pszDirNameUniLe:	目录路径
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_change_dir(                            
+                        char* pszDirNameUniLe  
+                   );
+
+/**创建目录
+*@param		pszDirNameUniLe:	目录路径
+*@param		iMode:	            目录属性,详细请参见E_AMOPENAT_FILE_ATTR_TAG
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_make_dir(                              
+                        char* pszDirNameUniLe, 
+                        UINT32 iMode          
+                 );
+
+/**删除目录
+*@param		pszDirNameUniLe:	目录路径,该目录必须为空,接口才能返回成功
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_remove_dir(                          
+                        char* pszDirNameUniLe  
+                   );
+
+/**获取当前路径
+*@param		pCurDirUniLe:	目录路径
+*@param		uUnicodeSize:	    存储目录信息空间大小
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_get_current_dir(                    
+                        char* pCurDirUniLe,   
+                        UINT32 uUnicodeSize   
+                        );
+
+/**获取文件系统信息
+*@param		devName:	查找文件句柄
+*@param		fileInfo:	文件系统信息
+*@return	INT32 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_get_fs_info(                         
+                        E_AMOPENAT_FILE_DEVICE_NAME       devName,         
+                        T_AMOPENAT_FILE_INFO               *fileInfo                 
+                   );
+
+/**获取文件大小接口
+*@param	   pszFileNameUniLe:   文件全路径名称
+*@return   UINT32:			   返回文件的大小
+**/
+UINT32 iot_fs_file_size(
+                    char* pszFileNameUniLe
+                );
+
+/**打开查找,并且获取文件夹下文件名
+*@param		dirName:	路径
+*@param     findResult: 对应路径下的第一个文件
+*@return	fileInfo: 	查找返回的句柄,返回值小于0表示失败,其余成功
+**/                   
+INT32 iot_fs_find_first(
+     char* dirName,
+     PAMOPENAT_FS_FIND_DATA findResult
+);
+
+/**获取文件夹下文件名
+*@param		iFd:  iot_fs_find_first接口返回值
+*@param     findResult: 对应路径下的文件
+*@return	fileInfo: 	返回小于0表示没有剩余文件,其他值表示还有文件
+**/                   
+INT32 iot_fs_find_next(
+     INT32 iFd, 
+     PAMOPENAT_FS_FIND_DATA findResult
+);
+
+/**关闭查找
+*@param		iFd:  iot_fs_find_first接口返回值
+*@return	fileInfo: 	返回值小于0表示失败,其余成功
+**/           
+INT32 iot_fs_find_close(
+     INT32 iFd
+);
+
+/** @}*/
+
+#endif

+ 67 - 0
bsp/air724/sdk/api/include/iot_gpio.h

@@ -0,0 +1,67 @@
+#ifndef __IOT_GPIO_H__
+#define __IOT_GPIO_H__
+
+#include "iot_os.h"
+
+/**
+ * @defgroup iot_sdk_device 外设接口
+ * @{
+ */
+	/**@example gpio/demo_gpio.c
+	* gpio接口示例
+	*/ 
+
+/**
+ * @defgroup iot_sdk_gpio GPIO接口
+ * @{
+ */
+
+/**配置gpio 
+*@param		port:		GPIO编号
+*@param		cfg:		配置信息
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_gpio_open(                          
+                        E_AMOPENAT_GPIO_PORT port,  
+                        T_AMOPENAT_GPIO_CFG *cfg  
+                   );
+
+/**设置gpio 
+*@param		port:		GPIO编号
+*@param		value:		0 or 1
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_gpio_set(                               
+                        E_AMOPENAT_GPIO_PORT port,  
+                        UINT8 value                 
+                );
+
+/**读取gpio 
+*@param		port:		GPIO编号
+*@param		value:		0 or 1
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/			
+BOOL iot_gpio_read(                            
+                        E_AMOPENAT_GPIO_PORT port, 
+                        UINT8* value             
+                  );
+
+/**关闭gpio 
+*@param		port:		GPIO编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/	
+BOOL iot_gpio_close(                            
+                        E_AMOPENAT_GPIO_PORT port
+                  );
+
+/** @}*/
+/** @}*/
+
+
+#endif
+
+

+ 71 - 0
bsp/air724/sdk/api/include/iot_i2c.h

@@ -0,0 +1,71 @@
+#ifndef __IOT_I2C_H__
+#define __IOT_I2C_H__
+
+#include "iot_os.h"
+
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_i2c i2c接口
+ * @{
+ */
+
+/**开打i2c
+*@param		port:		I2C 编号
+*@param		param:		初始化参数
+*@return	TRUE:       成功
+*	        FALSE:      失败
+**/
+BOOL iot_i2c_open(
+                        E_AMOPENAT_I2C_PORT  port,         
+                        T_AMOPENAT_I2C_PARAM *param        
+                  );
+
+/**关闭i2c
+*@param		port:		I2C 编号
+*@return	TRUE:       成功
+*	        FALSE:      失败
+**/
+BOOL iot_i2c_close(
+                        E_AMOPENAT_I2C_PORT  port          
+                  );
+
+/**写入i2c数据
+*@param		port:		    I2C 编号
+*@param		salveAddr:		从设备地址
+*@param		pRegAddr:		寄存器地址
+*@param		buf:		    写入数据地址
+*@param		bufLen:		    写入数据长度
+*@return	UINT32:         实际写入长度
+**/
+UINT32 iot_i2c_write(                                    
+                        E_AMOPENAT_I2C_PORT port,        
+                        UINT8 salveAddr,
+                        CONST UINT8 *pRegAddr,          
+                        CONST UINT8* buf,               
+                        UINT32 bufLen                    
+                   );
+
+/**读取i2c数据
+*@param		port:		    I2C 编号
+*@param		slaveAddr:		从设备地址
+*@param		pRegAddr:		寄存器地址
+*@param		buf:		    存储数据地址
+*@param		bufLen:		    存储空间长度
+*@return	UINT32:         实际读取长度
+**/
+UINT32 iot_i2c_read(                                        
+                        E_AMOPENAT_I2C_PORT port,        
+                        UINT8 slaveAddr, 
+                        CONST UINT8 *pRegAddr,             
+                        UINT8* buf,                      
+                        UINT32 bufLen                      
+                  );
+
+/** @}*/
+/** @}*/
+
+#endif
+

+ 29 - 0
bsp/air724/sdk/api/include/iot_keypad.h

@@ -0,0 +1,29 @@
+#ifndef __IOT_KEYPAD_H__
+#define __IOT_KEYPAD_H__
+
+#include "iot_os.h"
+
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_keypad 按键接口
+ * @{
+ */
+
+
+/**键盘初始化 
+*@param		pConfig: 键盘配置参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_keypad_init(                         
+                        T_AMOPENAT_KEYPAD_CONFIG *pConfig
+                  );
+
+/** @}*/
+/** @}*/
+
+#endif
+

+ 79 - 0
bsp/air724/sdk/api/include/iot_lcd.h

@@ -0,0 +1,79 @@
+#ifndef __IOT_LCD_H__
+#define __IOT_LCD_H__
+
+#include "iot_os.h"
+
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_lcd lcd接口
+ * @{
+ */
+ 
+/**@example zbar/demo_zbar_lcd.c
+* LCD&键盘接口示例
+*/ 
+
+/**写入 lcd命令
+*@param		cmd: 命令
+**/
+VOID iot_lcd_write_cmd(                          
+                        UINT8 cmd 
+                   );
+
+/**lcd 写入lcd数据 
+*@param	 	data: 数据
+**/
+VOID iot_lcd_write_data(                               
+                        UINT8 data                
+                );
+
+
+/**lcd初始化
+*@param		param: lcd初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/	
+BOOL iot_lcd_color_init(T_AMOPENAT_COLOR_LCD_PARAM *param );
+
+/**  刷新lcd
+*@param		rect: 需要刷新的区域
+*@param		pDisplayBuffer: 刷新的缓冲区
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+VOID iot_lcd_update_color_screen(
+				T_AMOPENAT_LCD_RECT_T* rect,        /* 需要刷新的区域 */
+				UINT16 *pDisplayBuffer    );
+
+/** 解码jpg格式图片
+*@param		filename: 文件路径包括文件名
+*@param		imageinfo: 文件格式
+*@return	INT32: 解码状态码
+**/
+INT32 iot_decode_jpeg(
+                    CONST char * filename,
+                    T_AMOPENAT_IMAGE_INFO *imageinfo
+                    );
+
+/** 释放jpg格式解码数据
+*@param		buffer: 缓存显示buffer
+*@return	INT32: 释放状态码
+**/
+INT32 iot_free_jpeg_decodedata(
+                    INT16* buffer
+                    );
+/** @}*/
+/** @}*/
+#endif
+
+
+
+
+
+
+
+
+

+ 101 - 0
bsp/air724/sdk/api/include/iot_network.h

@@ -0,0 +1,101 @@
+#ifndef __IOT_NETWORK_H__
+#define __IOT_NETWORK_H__
+
+#include "am_openat.h"
+
+// #define OPENAT_NETWORK_ISP_LENGTH (64)
+// #define OPENAT_NETWORK_IMSI_LENGHT (64)
+#define OPENAT_NETWORK_APN_LENGTH (64)
+#define OPENAT_NETWORK_PASSWORD_LENGTH	(64)
+#define OPENAT_NETWORK_USER_NAME_LENGTH (64)
+
+
+typedef enum
+{
+    /*!< 网络断开 表示GPRS网络不可用,无法进行数据连接,有可能可以打电话*/
+	OPENAT_NETWORK_DISCONNECT            		= 0x00,
+    /*!< 网络已连接 表示GPRS网络可用,可以进行链路激活*/
+	OPENAT_NETWORK_READY,
+	/*!< 链路正在激活 */
+	OPENAT_NETWORK_LINKING,
+    /*!< 链路已经激活 PDP已经激活,可以通过socket接口建立数据连接*/
+	OPENAT_NETWORK_LINKED,
+	/*!< 链路正在去激活 */
+	OPENAT_NETWORK_GOING_DOWN,
+}E_OPENAT_NETWORK_STATE;
+
+typedef VOID(*F_OPENAT_NETWORK_IND_CB)(E_OPENAT_NETWORK_STATE state);
+
+
+
+typedef enum
+{
+    /*!< sim卡状态未知*/
+	OPENAT_NETWORK_UNKNOWN=0,
+    /*!< sim卡状态有效*/
+	OPENAT_NETWORK_TRUE,
+    /*!< SIM未插入或PIN码未解锁*/
+	OPENAT_NETWORK_FALSE=255,
+}E_OPENAT_SIM_STATE;
+
+typedef struct
+{
+	/*!< 网络状态 */
+	E_OPENAT_NETWORK_STATE state;
+	/*!< 网络信号:0-31 (值越大,信号越好) */
+	UINT8 csq;
+	/*!< SIM卡状态 */
+	E_OPENAT_SIM_STATE  simpresent;
+}T_OPENAT_NETWORK_STATUS;
+
+typedef struct
+{
+	char apn[OPENAT_NETWORK_APN_LENGTH];
+	char username[OPENAT_NETWORK_USER_NAME_LENGTH];
+	char password[OPENAT_NETWORK_PASSWORD_LENGTH];
+}T_OPENAT_NETWORK_CONNECT;
+
+
+
+
+/**
+ * @defgroup iot_sdk_network 网络接口
+ * @{
+ */
+/**获取网络状态
+*@param     status:   返回网络状态
+*@return    TRUE:    成功
+            FLASE:   失败            
+**/                                
+BOOL iot_network_get_status (
+                            T_OPENAT_NETWORK_STATUS* status
+                            );
+/**设置网络状态回调函数
+*@param     indCb:   回调函数
+*@return    TRUE:    成功
+            FLASE:   失败
+**/                            
+BOOL iot_network_set_cb(F_OPENAT_NETWORK_IND_CB indCb);
+/**建立网络连接,实际为pdp激活流程
+*@param     connectParam:  网络连接参数,需要设置APN,username,passwrd信息
+*@return    TRUE:    成功
+            FLASE:   失败
+@note      该函数为异步函数,返回后不代表网络连接就成功了,indCb会通知上层应用网络连接是否成功,连接成功后会进入OPENAT_NETWORK_LINKED状态
+           创建socket连接之前必须要建立网络连接
+           建立连接之前的状态需要为OPENAT_NETWORK_READY状态,否则会连接失败
+**/                          
+BOOL iot_network_connect(T_OPENAT_NETWORK_CONNECT* connectParam);
+/**断开网络连接,实际为pdp去激活
+*@param     flymode:   暂时不支持,设置为FLASE
+*@return    TRUE:    成功
+            FLASE:   失败
+@note      该函数为异步函数,返回后不代表网络连接立即就断开了,indCb会通知上层应用
+           连接断开后网络状态会回到OPENAT_NETWORK_READY状态
+           此前创建socket连接也会失效,需要close掉
+**/                                        
+BOOL iot_network_disconnect(BOOL flymode);
+
+/** @}*/
+
+#endif
+

+ 436 - 0
bsp/air724/sdk/api/include/iot_os.h

@@ -0,0 +1,436 @@
+#ifndef  __IOT_OS_H__
+#define  __IOT_OS_H__
+
+
+
+#include "am_openat.h"
+#include "am_openat_fs.h"
+#include "am_openat_system.h"
+#include "am_openat_drv.h"
+
+
+/**
+ * @defgroup iot_sdk_os 操作系统接口
+ * @{
+ */
+
+/**
+ * @defgroup 线程接口函数类型 线程接口函数
+ * @{
+ */
+/**@example os/demo_os.c
+* os接口示例
+*/ 
+/**创建线程
+*@note  nPriority值的返回在0-20, 值越大优先级越低
+*@param	pTaskEntry:		线程主函数
+*@param	pParameter:		作为参数传递给线程主函数
+*@param	nStackSize: 	线程栈大小
+*@param	nPriority: 		线程优先级,该参数越大,线程优先级越低
+*@param nCreationFlags: 线程启动标记, 请参考E_AMOPENAT_OS_CREATION_FLAG
+*@param pTaskName: 		线程名称
+*@return	HANDLE: 	创建成功返回线程句柄
+**/
+HANDLE iot_os_create_task(                         
+                            PTASK_MAIN pTaskEntry,  
+                            PVOID pParameter,         
+                            UINT16 nStackSize,      
+                            UINT8 nPriority,       
+                            UINT16 nCreationFlags,     
+                            PCHAR pTaskName       
+						);
+
+
+/**删除线程
+*@param		hTask:		线程句柄
+*@return	TURE:		删除线程成功
+*			FALSE: 		删除线程失败
+**/	
+BOOL iot_os_delete_task(                           
+                        HANDLE hTask        
+                   );	
+
+/**挂起线程
+*@param		hTask:		线程句柄
+*@return	TURE: 		挂起线程成功
+*			FALSE  : 	挂起线程失败
+**/
+BOOL iot_os_suspend_task(                        
+                            HANDLE hTask           
+                        );
+
+/**恢复线程
+*@param		hTask:		线程句柄
+*@return	TURE: 		恢复线程成功
+*			FALSE  : 	恢复线程失败
+**/
+BOOL iot_os_resume_task(                         
+                        HANDLE hTask         
+                   );
+
+/**获取当前线程
+*@return	HANDLE:		返回当前线程句柄
+*
+**/				   
+HANDLE iot_os_current_task(                
+                            VOID
+                          );	
+
+/**获取当前线程创建信息
+*@param		hTask:		线程句柄
+*@param		pTaskInfo:		线程信息存储接口
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_get_task_info(                        
+                            HANDLE hTask,           
+                            T_AMOPENAT_TASK_INFO *pTaskInfo 
+                         );			  
+/** @}*/ 
+
+/**
+ * @defgroup 消息接口函数类型 消息接口函数
+ * @{
+ */
+
+/**获取线程消息
+*@note 会阻塞
+*@param		hTask:		线程句柄
+*@param		ppMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_wait_message(                         
+						HANDLE hTask,          
+						PVOID* ppMessage      
+					);
+					
+/**发送线程消息
+*@note 添加到消息队列尾部
+*@param		hTask:		线程句柄
+*@param		pMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/					
+BOOL iot_os_send_message(                         
+						HANDLE hTask,          
+						PVOID pMessage         
+					);
+
+/**检测消息队列中是否有消息
+*@param		hTask:		线程句柄
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/								  
+BOOL iot_os_available_message(                   
+						HANDLE hTask       
+						 );
+
+/**发送高优先级线程消息
+*@note      添加到消息队列头部
+*@param		hTask:		线程句柄
+*@param		pMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_send_high_priority_message(          
+                        HANDLE hTask,          
+                        PVOID pMessage         
+                                  );
+
+/**检测消息队列中是否有消息
+*@param		hTask:		线程句柄
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_available_message(                     
+                        HANDLE hTask           
+                         );
+
+/** @}*/ 
+
+/**
+ * @defgroup 时间定时器接口函数类型 时间定时器接口函数
+ * @{
+ */
+
+/**@example timer/demo_timer.c
+* timer接口示例
+*/ 
+
+
+/**创建定时器
+*@param		pFunc:			定时器到时处理函数
+*@param		pParameter:		作为参数传递给定时器到时处理函数
+*@return	HANDLE: 		返回定时器句柄
+*			
+**/	
+HANDLE iot_os_create_timer(                         
+						PTIMER_EXPFUNC pFunc,  
+						PVOID pParameter       
+					  );
+					  
+/**启动定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@param		nMillisecondes:		定时器时间
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/								  
+BOOL iot_os_start_timer(                            /* 启动定时器接口 */
+						HANDLE hTimer,          /* 定时器句柄,create_timer接口返回值 */
+						UINT32 nMillisecondes   /*  */
+				   );
+				   
+/**停止定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/						   
+BOOL iot_os_stop_timer(                             
+						HANDLE hTimer   
+				  );
+				  
+/**删除定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/					  
+BOOL iot_os_delete_timer(                           
+						HANDLE hTimer           
+					);
+					
+/**检查定时器是否已经启动
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/					
+BOOL iot_os_available_timer(            
+						HANDLE hTimer          
+					   );
+					   
+					   
+/**获取系统时间
+*@param		pDatetime:		存储时间指针
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/	
+BOOL iot_os_get_system_datetime(                  
+						T_AMOPENAT_SYSTEM_DATETIME* pDatetime
+					   );
+					   
+/**设置系统时间
+*@param		pDatetime:		存储时间指针
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/						   
+BOOL iot_os_set_system_datetime(                    
+						T_AMOPENAT_SYSTEM_DATETIME* pDatetime
+					   );
+/** @}*/  
+
+/**
+ * @defgroup 闹钟接口函数类型 闹钟接口函数
+ * @{
+ */
+/**@example demo_alarm/src/demo_alarm.c
+* alarm接口示例
+*/
+
+/**闹钟初始化接口
+*@param		pConfig:		闹钟配置参数
+*@return	TURE: 			成功
+*			FALSE: 		    失败
+**/
+BOOL iot_os_init_alarm(                                      
+                        T_AMOPENAT_ALARM_CONFIG *pConfig  
+                   ); 
+
+/**闹钟设置/删除接口
+*@param		pAlarmSet:		闹钟设置参数
+*@return	TURE: 			成功
+*			FALSE: 		    失败
+**/
+BOOL iot_os_set_alarm(                                        
+                        T_AMOPENAT_ALARM_PARAM *pAlarmSet    
+                   );
+/** @}*/ 
+
+/**
+ * @defgroup 临界资源接口函数类型 临界资源接口函数
+ * @{
+ */
+ 
+/**进入临界资源区接口,关闭所有中断
+*@return	HANDLE:    返回临界资源区句柄,
+**/
+HANDLE iot_os_enter_critical_section(               
+                        VOID
+                                );
+
+/**退出临界资源区接口,开启中断
+*@param		hSection:		临界资源区句柄
+**/
+VOID iot_os_exit_critical_section(             
+                        HANDLE hSection        
+                             );
+ 
+/**创建信号量接口
+*@param		nInitCount:		信号量数量
+*@return	HANDLE: 	    返回信号量句柄
+**/
+HANDLE iot_os_create_semaphore(                     
+                        UINT32 nInitCount       
+                          );
+
+/**删除信号量接口
+*@param		hSem:		信号量句柄
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_delete_semaphore(                       
+                        HANDLE hSem            
+                        );
+
+/**等待信号量接口
+*@param		hSem:		信号量句柄
+*@param		nTimeOut:   等待信号量超时时间,if nTimeOut < 5ms, means forever
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_wait_semaphore(                        
+                        HANDLE hSem,           
+                        UINT32 nTimeOut         
+                      );
+
+/**释放信号量接口
+*@param		hSem:		信号量句柄
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_release_semaphore(
+                        HANDLE hSem            
+                         );
+
+/**获取消耗量值
+*@param		hSem:		 信号量句柄
+*@return	nInitCount:  信号量的个数
+**/
+UINT32 iot_os_get_semaphore_value           
+                        (
+                        HANDLE hSem             
+                        );
+/** @}*/ 
+
+
+/**
+ * @defgroup 内存接口函数类型 内存接口函数
+ * @{
+ */
+
+/**内存申请接口malloc
+*@param		nSize:		 申请的内存大小
+*@return	PVOID:       内存指针
+**/
+PVOID iot_os_malloc(                              
+                        UINT32 nSize           
+               );
+
+/**内存申请接口realloc
+*@param		pMemory:	     内存指针,malloc接口返回值
+*@param		nSize:	     申请的内存大小
+*@return	PVOID:       内存指针
+**/
+PVOID iot_os_realloc(                               
+                        PVOID pMemory,          
+                        UINT32 nSize       
+                );
+
+/**内存释放接口
+*@param		pMemory:	     内存指针,malloc接口返回值
+**/
+VOID iot_os_free(                                  
+                        PVOID pMemory     
+            );
+
+/**获取堆空间大小
+*@param		total:	     总共大小
+*@param   used:        已经使用
+**/
+VOID iot_os_mem_used(                                  
+                        UINT32* total,
+                        UINT32* used   
+            );  
+
+/** @}*/ 
+
+/**
+ * @defgroup 其他接口函数类型 其他接口函数
+ * @{
+ */
+
+/**系统睡眠接口
+*@param		nMillisecondes:	     睡眠时间
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_sleep(                              
+                        UINT32 nMillisecondes   
+             );
+
+/**获取系统tick接口
+*@return	tick_num:   返回系统时间tick值
+**/
+UINT32 iot_os_get_system_tick(                    
+                        VOID
+                         );
+
+/**获取随机数接口
+*@return	rand_num:   返回随机数
+**/
+UINT32 iot_os_rand(                              
+                        VOID
+              );
+
+/**设置随机数种子接口
+*@param		seed:	     随机数种子
+**/
+VOID iot_os_srand(                                  
+                        UINT32 seed            
+             );
+
+/**关机接口
+**/
+VOID iot_os_shut_down(                            
+                        VOID
+                 );
+
+/**重启接口
+**/
+VOID iot_os_restart(                              
+                        VOID
+               );
+
+/**设置trace打印口
+*@param		port:		0: uart1
+                        1: uart2
+                        2: uart3
+                        3: usb modem
+                        4: usb AP & UART Host口抓log(默认)
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/
+BOOL iot_os_set_trace_port(UINT8 port);
+
+
+/**获取wifiscan参数接口
+*@param		wifi_info:	wifiscan参数     
+**/
+VOID iot_wifi_scan(OPENAT_wifiScanRequest* wifi_info);
+
+/** @}*/ 
+
+/** @}*/  //模块结尾
+
+
+#endif
+

+ 100 - 0
bsp/air724/sdk/api/include/iot_pmd.h

@@ -0,0 +1,100 @@
+#ifndef __IOT_PMD_H__
+#define __IOT_PMD_H__
+
+#include "iot_os.h"
+
+/**
+ * @defgroup iot_sdk_pmd 电源管理接口
+ * @{
+ */
+
+/**充电初始化
+*@param		chrMode:		充电方式
+*@param		cfg:		    配置信息
+*@param		pPmMessage:		消息回调函数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_pmd_init(     
+                    E_AMOPENAT_PM_CHR_MODE chrMode,     
+                    T_AMOPENAT_PMD_CFG*    cfg,       
+                    PPM_MESSAGE            pPmMessage  
+            );
+
+
+/**获取电池状态
+*@param		batStatus:		电池状态
+**/
+VOID iot_pmd_get_batteryStatus(
+                    T_AMOPENAT_BAT_STATUS* batStatus    
+                     );
+
+/**获取充电器状态
+*@param		chrStatus:		充电器状态
+**/
+VOID iot_pmd_get_chargerStatus(
+                    T_AMOPENAT_CHARGER_STATUS* chrStatus
+                     );
+
+/**查询充电器HW状态接口
+*@return	E_AMOPENAT_CHR_HW_STATUS: 充电器HW状态接口
+**/
+E_AMOPENAT_CHR_HW_STATUS iot_pmd_get_chargerHwStatus(
+                    VOID
+                    );
+
+/**查询充电器HW状态接口
+*@param		battStatus:		    电池状态
+*@param		battVolt:		    电压值
+*@param		battLevel:		    电压等级
+*@param		chargerStatus:		充电器状态
+*@param		chargeState:		充电状态
+*@return	int:  返回0成功其余失败
+**/
+int iot_pmd_get_chg_param(BOOL *battStatus, u16 *battVolt, u8 *battLevel, BOOL *chargerStatus, u8 *chargeState);
+
+
+/**正常开机
+*@param		simStartUpMode:		开启SIM卡方式
+*@param		nwStartupMode:		开启协议栈方式
+*@return	TRUE: 	            成功
+*           FALSE:              失败
+**/
+BOOL iot_pmd_poweron_system(                                     
+                    E_AMOPENAT_STARTUP_MODE simStartUpMode,
+                    E_AMOPENAT_STARTUP_MODE nwStartupMode
+                  );
+
+/**正常关机
+*@note 正常关机 包括关闭协议栈和供电
+**/
+VOID iot_pmd_poweroff_system(VOID);
+
+/**打开LDO
+*@param		ldo:		    ldo通道
+*@param		level:		    0-7 0:关闭 1~7电压等级
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_pmd_poweron_ldo(                                       
+                    E_AMOPENAT_PM_LDO    ldo,
+                    UINT8                level          
+               );
+
+/**进入睡眠
+**/
+VOID iot_pmd_enter_deepsleep(VOID);
+
+/**退出睡眠
+**/
+VOID iot_pmd_exit_deepsleep(VOID);                               
+
+/**获取开机原因值
+*@return	E_AMOPENAT_POWERON_REASON: 	   返回开机原因值
+**/
+E_AMOPENAT_POWERON_REASON iot_pmd_get_poweronCasue(VOID);
+
+/** @}*/
+
+#endif
+

+ 677 - 0
bsp/air724/sdk/api/include/iot_socket.h

@@ -0,0 +1,677 @@
+#ifndef __IOT_SOCKET_H__
+#define __IOT_SOCKET_H__
+
+#include "am_openat.h"
+#include <sys/_timeval.h>
+
+#define OPENAT_INADDR_NONE (0xFFFFFFFF)
+
+#define INVALID_SOCKET  (0xFFFFFFFFL)
+#define SOCKET_ERROR    (0xFFFFFFFFL)
+
+/* Flags we can use with send and recv. */
+#define MSG_PEEK       0x01    /* Peeks at an incoming message */
+#define MSG_WAITALL    0x02    /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
+#define MSG_OOB        0x04    /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
+#define MSG_DONTWAIT   0x08    /* Nonblocking i/o for this operation only */
+#define MSG_MORE       0x10    /* Sender will send more */
+#define MSG_NOSIGNAL   0x20    /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */
+
+
+struct openat_sockaddr
+{
+  uint8   sa_len;			/* total length */
+  uint8   sa_family;		/* address family */
+  uint8   sa_data[14];
+};
+
+struct openat_ip_addr {
+  uint32 addr;
+};
+
+struct openat_in_address{
+  uint32 s_addr;
+};
+
+/* members are in network byte order */
+struct openat_sockaddr_in {
+  uint8 sin_len;
+  uint8 sin_family;
+  uint16 sin_port;
+  struct openat_in_address sin_addr;
+#define SIN_ZERO_LEN 8
+  char sin_zero[SIN_ZERO_LEN];
+};
+
+typedef struct openat_ip_addr openat_ip_addr_t;
+
+struct openat_hostent {
+    char  *h_name;      /* Official name of the host. */
+    char **h_aliases;   /* A pointer to an array of pointers to alternative host names,
+                           terminated by a null pointer. */
+    int    h_addrtype;  /* Address type. */
+    int    h_length;    /* The length, in bytes, of the address. */
+    char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
+                           network byte order) for the host, terminated by a null pointer. */
+#define h_addr h_addr_list[0] /* for backward compatibility */
+};
+
+typedef uint32 openat_socklen_t;
+
+struct openat_addrinfo {
+    int               ai_flags;      /* Input flags. */
+    int               ai_family;     /* Address family of socket. */
+    int               ai_socktype;   /* Socket type. */
+    int               ai_protocol;   /* Protocol of socket. */
+    openat_socklen_t         ai_addrlen;    /* Length of socket address. */
+    struct openat_sockaddr  *ai_addr;       /* Socket address of socket. */
+    char             *ai_canonname;  /* Canonical name of service location. */
+    struct openat_addrinfo  *ai_next;       /* Pointer to next in list. */
+};
+
+#ifndef FD_SET
+#undef  FD_SETSIZE
+#define MEMP_NUM_NETCONN 			8
+#define LWIP_SOCKET_OFFSET              1
+/* Make FD_SETSIZE match NUM_SOCKETS in socket.c */
+#define FD_SETSIZE    MEMP_NUM_NETCONN
+#define FDSETSAFESET(n, code) do { \
+  if (((n) - LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n) - LWIP_SOCKET_OFFSET) >= 0)) { \
+  code; }} while(0)
+#define FDSETSAFEGET(n, code) (((n) - LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n) - LWIP_SOCKET_OFFSET) >= 0) ?\
+  (code) : 0)
+#define FD_SET(n, p)  FDSETSAFESET(n, (p)->fds_bits[((n)-LWIP_SOCKET_OFFSET)/8] |=  (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_CLR(n, p)  FDSETSAFESET(n, (p)->fds_bits[((n)-LWIP_SOCKET_OFFSET)/8] &= ~(1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_ISSET(n,p) FDSETSAFEGET(n, (p)->fds_bits[((n)-LWIP_SOCKET_OFFSET)/8] &   (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_ZERO(p)    memset((void*)(p), 0, sizeof(*(p)))
+
+typedef struct fd_set
+{
+  unsigned char fds_bits [(FD_SETSIZE+7)/8];
+} fd_set;
+
+#elif LWIP_SOCKET_OFFSET
+#error LWIP_SOCKET_OFFSET does not work with external FD_SET!
+#elif FD_SETSIZE < MEMP_NUM_NETCONN
+#error "external FD_SETSIZE too small for number of sockets"
+#endif /* FD_SET */
+#if 0
+struct timeval 
+{ 
+	long long tv_sec; 
+	int tv_usec;
+};
+#endif
+
+/** This is the aligned version of ip6_addr_t,
+	used as local variable, on the stack, etc. */
+struct ip6_addr {
+  uint32 addr[4];
+  uint8 zone;
+};
+
+/** IPv6 address */
+typedef struct ip6_addr ip6_addr_t;
+
+/** This is the aligned version of ip4_addr_t,
+   used as local variable, on the stack, etc. */
+struct ip4_addr {
+  uint32 addr;
+};
+
+/** ip4_addr_t uses a struct for convenience only, so that the same defines can
+ * operate both on ip4_addr_t as well as on ip4_addr_p_t. */
+typedef struct ip4_addr ip4_addr_t;
+
+#define sockaddr_in 			openat_sockaddr_in 
+#define hostent 				openat_hostent
+#define sockaddr 				openat_sockaddr
+#define in_addr 				openat_in_address
+#define socklen_t				openat_socklen_t
+#define addrinfo				openat_addrinfo
+#define OPENAT_FD_SET(n, p)  	FD_SET(n, p)
+#define OPENAT_FD_CLR(n, p)  	FD_CLR(n, p)
+#define OPENAT_FD_ISSET(n,p) 	FD_ISSET(n,p)
+#define OPENAT_FD_ZERO(p)		FD_ZERO(p)
+#define openat_fd_set			fd_set
+#define openat_timeval 			timeval
+#define OPENAT_AF_UNSPEC       0
+#define OPENAT_AF_INET         2
+#define OPENAT_AI_PASSIVE      0x01
+#define OPENAT_AI_CANONNAME    0x02
+#define OPENAT_AI_NUMERICHOST  0x04
+#define OPENAT_AI_NUMERICSERV  0x08
+#define OPENAT_AI_V4MAPPED     0x10
+#define OPENAT_AI_ALL          0x20
+#define OPENAT_AI_ADDRCONFIG   0x40
+
+#define	PF_INET		OPENAT_AF_INET
+
+
+#define OPENAT_AF_INET6        10
+#define AF_INET         2
+#define AF_INET6        10
+
+
+/* Socket protocol types (TCP/UDP/RAW) */
+#define OPENAT_SOCK_STREAM     1
+#define OPENAT_SOCK_DGRAM      2
+#define OPENAT_SOCK_RAW        3
+
+#define SO_REUSEADDR   0x0004 
+#define SO_KEEPALIVE   0x0008 
+#define SO_BROADCAST   0x0020
+
+#define  SOL_SOCKET  0xfff
+
+#define SO_DEBUG        0x0001 /* Unimplemented: turn on debugging info recording */
+#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */
+#define SO_DONTROUTE    0x0010 /* Unimplemented: just use interface addresses */
+#define SO_USELOOPBACK  0x0040 /* Unimplemented: bypass hardware when possible */
+#define SO_LINGER       0x0080 /* linger on close if data present */
+#define SO_DONTLINGER   ((int)(~SO_LINGER))
+#define SO_OOBINLINE    0x0100 /* Unimplemented: leave received OOB data in line */
+#define SO_REUSEPORT    0x0200 /* Unimplemented: allow local address & port reuse */
+#define SO_SNDBUF       0x1001 /* Unimplemented: send buffer size */
+#define SO_RCVBUF       0x1002 /* receive buffer size */
+#define SO_SNDLOWAT     0x1003 /* Unimplemented: send low-water mark */
+#define SO_RCVLOWAT     0x1004 /* Unimplemented: receive low-water mark */
+#define SO_SNDTIMEO     0x1005 /* send timeout */
+#define SO_RCVTIMEO     0x1006 /* receive timeout */
+#define SO_ERROR        0x1007 /* get error status and clear */
+#define SO_TYPE         0x1008 /* get socket type */
+#define SO_CONTIMEO     0x1009 /* Unimplemented: connect timeout */
+#define SO_NO_CHECK     0x100a /* don't create UDP checksum */
+#define SO_BINDTODEVICE 0x100b /* bind to device */
+
+/*
+ * Options for level IPPROTO_TCP
+ */
+#define OPENAT_TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
+#define OPENAT_TCP_KEEPALIVE  0x02    /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
+#define OPENAT_TCP_KEEPIDLE   0x03    /* set pcb->keep_idle  - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
+#define OPENAT_TCP_KEEPINTVL  0x04    /* set pcb->keep_intvl - Use seconds for get/setsockopt */
+#define OPENAT_TCP_KEEPCNT    0x05    /* set pcb->keep_cnt   - Use number of probes sent for get/setsockopt */
+#define OPENAT_TCP_TIMEROUT   0x06    /* set pcb->keep_cnt   - Use number of probes sent for get/setsockopt */
+#define OPENAT_TCP_MSS_VALUE  0x07    /* set pcb->mss   - Use number of probes only for get/setsockopt */
+#define OPENAT_TCP_RTO_VALUE  0x08    /* set pcb->rto   - Use number of probes only for get/setsockopt */
+#define OPENAT_TCP_TXB_UNACK  0x09    /* set (pcb->snd_lbb - pcb->lastack) - how much byte remaind in buffer for unacked */
+#define OPENAT_TCP_TXB_REST   0x0A    /* set (pcb->snd_buf) - how much byte remaind in tx buffer can writen by app */
+#define OPENAT_TCP_TXB_ACKED  0x0B    /* set (pcb->acked_sum) - the number of accumulation of acked */
+
+#define  OPENAT_ERROK         0  /* err ok set, no err happen */
+#define  OPENAT_EPERM         1  /* Operation not permitted */
+#define  OPENAT_ENOENT        2  /* No such file or directory */
+#define  OPENAT_ESRCH         3  /* No such process */
+#define  OPENAT_EINTR         4  /* Interrupted system call */
+#define  OPENAT_EIO           5  /* I/O error */
+#define  OPENAT_ENXIO         6  /* No such device or address */
+#define  OPENAT_E2BIG         7  /* Arg list too long */
+#define  OPENAT_ENOEXEC       8  /* Exec format error */
+#define  OPENAT_EBADF         9  /* Bad file number */
+#define  OPENAT_ECHILD       10  /* No child processes */
+#define  OPENAT_EAGAIN       11  /* Try again */
+#define  OPENAT_ENOMEM       12  /* Out of memory */
+#define  OPENAT_EACCES       13  /* Permission denied */
+#define  OPENAT_EFAULT       14  /* Bad address */
+#define  OPENAT_ENOTBLK      15  /* Block device required */
+#define  OPENAT_EBUSY        16  /* Device or resource busy */
+#define  OPENAT_EEXIST       17  /* File exists */
+#define  OPENAT_EXDEV        18  /* Cross-device link */
+#define  OPENAT_ENODEV       19  /* No such device */
+#define  OPENAT_ENOTDIR      20  /* Not a directory */
+#define  OPENAT_EISDIR       21  /* Is a directory */
+#define  OPENAT_EINVAL       22  /* Invalid argument */
+#define  OPENAT_ENFILE       23  /* File table overflow */
+#define  OPENAT_EMFILE       24  /* Too many open files */
+#define  OPENAT_ENOTTY       25  /* Not a typewriter */
+#define  OPENAT_ETXTBSY      26  /* Text file busy */
+#define  OPENAT_EFBIG        27  /* File too large */
+#define  OPENAT_ENOSPC       28  /* No space left on device */
+#define  OPENAT_ESPIPE       29  /* Illegal seek */
+#define  OPENAT_EROFS        30  /* Read-only file system */
+#define  OPENAT_EMLINK       31  /* Too many links */
+#define  OPENAT_EPIPE        32  /* Broken pipe */
+#define  OPENAT_LWIPEDOM     33  /* Math argument out of domain of func */
+#define  OPENAT_LWIPERANGE   34  /* Math result not representable */
+#define  OPENAT_EDEADLK      35  /* Resource deadlock would occur */
+#define  OPENAT_ENAMETOOLONG 36  /* File name too long */
+#define  OPENAT_ENOLCK       37  /* No record locks available */
+#define  OPENAT_ENOSYS       38  /* Function not implemented */
+#define  OPENAT_ENOTEMPTY    39  /* Directory not empty */
+#define  OPENAT_ELOOP        40  /* Too many symbolic links encountered */
+#define  OPENAT_EWOULDBLOCK  OPENAT_EAGAIN  /* Operation would block */
+#define  OPENAT_ENOMSG       42  /* No message of desired type */
+#define  OPENAT_EIDRM        43  /* Identifier removed */
+#define  OPENAT_ECHRNG       44  /* Channel number out of range */
+#define  OPENAT_EL2NSYNC     45  /* Level 2 not synchronized */
+#define  OPENAT_EL3HLT       46  /* Level 3 halted */
+#define  OPENAT_EL3RST       47  /* Level 3 reset */
+#define  OPENAT_ELNRNG       48  /* Link number out of range */
+#define  OPENAT_EUNATCH      49  /* Protocol driver not attached */
+#define  OPENAT_ENOCSI       50  /* No CSI structure available */
+#define  OPENAT_EL2HLT       51  /* Level 2 halted */
+#define  OPENAT_EBADE        52  /* Invalid exchange */
+#define  OPENAT_EBADR        53  /* Invalid request descriptor */
+#define  OPENAT_EXFULL       54  /* Exchange full */
+#define  OPENAT_ENOANO       55  /* No anode */
+#define  OPENAT_EBADRQC      56  /* Invalid request code */
+#define  OPENAT_EBADSLT      57  /* Invalid slot */
+
+#define  OPENAT_EDEADLOCK    OPENAT_EDEADLK
+
+#define  OPENAT_EBFONT       59  /* Bad font file format */
+#define  OPENAT_ENOSTR       60  /* Device not a stream */
+#define  OPENAT_ENODATA      61  /* No data available */
+#define  OPENAT_ETIME        62  /* Timer expired */
+#define  OPENAT_ENOSR        63  /* Out of streams resources */
+#define  OPENAT_ENONET       64  /* Machine is not on the network */
+#define  OPENAT_ENOPKG       65  /* Package not installed */
+#define  OPENAT_EREMOTE      66  /* Object is remote */
+#define  OPENAT_ENOLINK      67  /* Link has been severed */
+#define  OPENAT_EADV         68  /* Advertise error */
+#define  OPENAT_ESRMNT       69  /* Srmount error */
+#define  OPENAT_ECOMM        70  /* Communication error on send */
+#define  OPENAT_EPROTO       71  /* Protocol error */
+#define  OPENAT_EMULTIHOP    72  /* Multihop attempted */
+#define  OPENAT_EDOTDOT      73  /* RFS specific error */
+#define  OPENAT_EBADMSG      74  /* Not a data message */
+#define  OPENAT_EOVERFLOW    75  /* Value too large for defined data type */
+#define  OPENAT_ENOTUNIQ     76  /* Name not unique on network */
+#define  OPENAT_EBADFD       77  /* File descriptor in bad state */
+#define  OPENAT_EREMCHG      78  /* Remote address changed */
+#define  OPENAT_ELIBACC      79  /* Can not access a needed shared library */
+#define  OPENAT_ELIBBAD      80  /* Accessing a corrupted shared library */
+#define  OPENAT_ELIBSCN      81  /* .lib section in a.out corrupted */
+#define  OPENAT_ELIBMAX      82  /* Attempting to link in too many shared libraries */
+#define  OPENAT_ELIBEXEC     83  /* Cannot exec a shared library directly */
+#define  OPENAT_LWIPEILSEQ   84  /* Illegal byte sequence */
+#define  OPENAT_ERESTART     85  /* Interrupted system call should be restarted */
+#define  OPENAT_ESTRPIPE     86  /* Streams pipe error */
+#define  OPENAT_EUSERS       87  /* Too many users */
+#define  OPENAT_ENOTSOCK     88  /* Socket operation on non-socket */
+#define  OPENAT_EDESTADDRREQ 89  /* Destination address required */
+#define  OPENAT_EMSGSIZE     90  /* Message too long */
+#define  OPENAT_EPROTOTYPE   91  /* Protocol wrong type for socket */
+#define  OPENAT_ENOPROTOOPT  92  /* Protocol not available */
+#define  OPENAT_EPROTONOSUPPORT 93  /* Protocol not supported */
+#define  OPENAT_ESOCKTNOSUPPORT 94  /* Socket type not supported */
+#define  OPENAT_EOPNOTSUPP      95  /* Operation not supported on transport endpoint */
+#define  OPENAT_EPFNOSUPPORT    96  /* Protocol family not supported */
+#define  OPENAT_EAFNOSUPPORT    97  /* Address family not supported by protocol */
+#define  OPENAT_EADDRINUSE      98  /* Address already in use */
+#define  OPENAT_EADDRNOTAVAIL   99  /* Cannot assign requested address */
+#define  OPENAT_ENETDOWN       100  /* Network is down */
+#define  OPENAT_ENETUNREACH    101  /* Network is unreachable */
+#define  OPENAT_ENETRESET      102  /* Network dropped connection because of reset */
+#define  OPENAT_ECONNABORTED   103  /* Software caused connection abort */
+#define  OPENAT_ECONNRESET     104  /* Connection reset by peer */
+#define  OPENAT_ENOBUFS        105  /* No buffer space available */
+#define  OPENAT_EISCONN        106  /* Transport endpoint is already connected */
+#define  OPENAT_ENOTCONN       107  /* Transport endpoint is not connected */
+#define  OPENAT_ESHUTDOWN      108  /* Cannot send after transport endpoint shutdown */
+#define  OPENAT_ETOOMANYREFS   109  /* Too many references: cannot splice */
+#define  OPENAT_ETIMEDOUT      110  /* Connection timed out */
+#define  OPENAT_ECONNREFUSED   111  /* Connection refused */
+#define  OPENAT_EHOSTDOWN      112  /* Host is down */
+#define  OPENAT_EHOSTUNREACH   113  /* No route to host */
+#define  OPENAT_EALREADY       114  /* Operation already in progress */
+#define  OPENAT_EINPROGRESS    115  /* Operation now in progress */
+#define  OPENAT_ESTALE         116  /* Stale NFS file handle */
+#define  OPENAT_EUCLEAN        117  /* Structure needs cleaning */
+#define  OPENAT_ENOTNAM        118  /* Not a XENIX named type file */
+#define  OPENAT_ENAVAIL        119  /* No XENIX semaphores available */
+#define  OPENAT_EISNAM         120  /* Is a named type file */
+#define  OPENAT_EREMOTEIO      121  /* Remote I/O error */
+#define  OPENAT_EDQUOT         122  /* Quota exceeded */
+
+#define  OPENAT_ENOMEDIUM      123  /* No medium found */
+#define  OPENAT_EMEDIUMTYPE    124  /* Wrong medium type */
+
+char *ip6addr_ntoa_r(const ip6_addr_t *addr, char *buf, int buflen);
+char*ip4addr_ntoa_r(const ip4_addr_t *addr, char *buf, int buflen);
+int ip6addr_aton(const char *cp, ip6_addr_t *addr);
+int ip4addr_aton(const char *cp, ip4_addr_t *addr);
+
+/**
+ * @defgroup iot_sdk_socket socket接口
+ * @{
+ */
+/**@example socket/demo_socket.c
+* socket接口示例
+*/
+/**创建socket
+*@param		domain:		仅支持AF_INET (IPV4 网络协议)
+@param		type:		支持SOCK_STREAM/SOCK_DGRAM,分别表示TCP、UDP连接
+@param		protocol:   仅支持0
+
+
+*@return	>=0: 	    socket描述符,用于后续操作
+*           <0:         创建socket失败
+*@note      创建的socket不用后需要用close将其关闭
+**/
+
+int socket(int domain, int type, int protocol);
+/**获取域名对应的IP地址
+*@param		name:		域名,例如:www.airm2m.com/www.baidu.com
+*@return	struct hostent 结构体: 该结构体包含了一个DNS域名解析后的ip地址
+*           NULL:  域名解析失败
+**/                       
+struct hostent* gethostbyname(const char *name);
+/**关闭socket
+*@param		fd:	调用socket接口返回的socket描述符
+*@return	0:  表示成功
+            -1  表示有错误
+*           
+**/                          
+int close (int fd);
+/**设置socket的属性
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      level: 支持SOL_SOCKET/IPPROTO_TCP
+@param      optname:  SOL_SOCKET对应optname为 SO_DEBUG/SO_OOBINLINE/SO_SNDTIMEO/SO_RCVTIMEO/SO_RCVBUF/SO_SNDBUF
+                      IPPROTO_TCP对应optname为 SO_TCP_SACKDISABLE/SO_TCP_NODELAY
+@param      optval_p:
+@param      optlen:
+*@return	0:  表示成功
+            <0  表示有错误
+*
+**/          
+
+int setsockopt(int socketfd, 
+                        int level, 
+                        int optname,
+                        void *optval_p, 
+                        openat_socklen_t optlen);
+/**获取socket的属性
+*@param   socketfd: 调用socket接口返回的socket描述符
+@param      level: 支持SOL_SOCKET/IPPROTO_TCP
+@param      optname:  SOL_SOCKET对应optname为 SO_DEBUG/SO_OOBINLINE/SO_SNDTIMEO/SO_RCVTIMEO/SO_RCVBUF/SO_SNDBUF
+                      IPPROTO_TCP对应optname为 SO_TCP_SACKDISABLE/SO_TCP_NODELAY
+@param      optval_p:
+@param      optlen_p:
+*@return  0:  表示成功
+            <0  表示有错误
+*
+**/          
+
+int getsockopt(int socketfd, 
+                        int level, 
+                        int optname,
+                        void *optval_p, 
+                        openat_socklen_t* optlen_p);
+/**设置socket的本地端口和ip地址,一般针对服务器代码需要设置
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      my_addr:   ip地址和端口,ip一般设置INADDR_ANY
+@param      addrlen:  地址长度
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                         
+int bind(int socketfd, 
+                      const struct openat_sockaddr *my_addr, 
+                      openat_socklen_t addrlen);
+/**建立和服务器端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      addr:   指定服务器地址和端口
+@param      addrlen:  sizeof(struct openat_sockaddr)
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                                      
+int connect(int socketfd, const struct openat_sockaddr *addr, openat_socklen_t addrlen);
+/**监听socket连接,一般用作服务器监听客户端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      backlog:   0
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                             
+int listen(int socketfd, 
+                       int backlog);
+/**等待连接,一般用于listen之后等待客户端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      addr:   返回客户端ip地址和端口
+@param      addrlen: 返回地址长度
+*@return	0:  表示成功
+            <0  表示有错误
+*@note      函数会一直阻塞,知道有客户端连接           
+**/                             
+int accept(int socketfd, 
+                        struct openat_sockaddr *addr, 
+                        openat_socklen_t *addrlen);
+/**接收数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      buf:   用于存放数据的缓存
+@param      len:   buf的长度
+@param      flags: 仅支持MSG_DONTWAIT/MSG_PEEK/MSG_OOB,可以通过或来指定多个标志,一般为0
+
+*@return	>0:  接收到的数据长度
+            =0:  对方已经断开连接
+            <0:  读取错误
+*@note      当flags没有设置MSG_DONTWAIT,该函数会阻塞,直到有数据或者读取超时
+**/                                        
+int recv(int socketfd, 
+                      void *buf, 
+                      size_t len,
+                      int flags);
+/**接收指定ip地址发送来的数据,一般用于UDP收取数据
+*@param		sockfd:	调用socket接口返回的socket描述符
+@param      buf:   用于存放数据的缓存
+@param      len:   buf的长度
+@param      flags: 仅支持0
+@param      src_addr: ip地址和端口
+@param      addrlen: sizeof(struct openat_sockaddr)
+
+*@return	>0: 实际收到的数据长度
+            =0:  对方已经断开连接
+            <0:  读取错误
+**/   
+
+int recvfrom(int sockfd, void *buf, size_t len, int flags,
+                    struct openat_sockaddr *src_addr, openat_socklen_t *addrlen);
+/**发送数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      msg:   数据内容
+@param      len:   数据长度
+@param      flags: 仅支持MSG_DONTWAIT/MSG_OOB,可以通过或来指定多个标志,一般为0
+
+*@return	>=0:  实际发送的长度
+            <0: 发送错误
+**/   
+
+int send(int socketfd,
+                      const void *msg,
+                      size_t len,
+                      int flags);
+/**发送数据到指定ip地址,一般用于udp发送数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      buf:   数据内容
+@param      len:   数据长度
+@param      flags: 仅支持0
+@param      to_p: 指定ip地址和端口号
+@param      tolen: sizeof(struct openat_sockaddr)
+
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+**/                        
+int sendto(int socketfd,
+                        const void *buf,
+                        size_t len,
+                        int flags,
+                        const struct openat_sockaddr *to_p, 
+                        openat_socklen_t tolen);
+/**阻塞方式等待socket连接的状态
+*@param		maxfdp1:	最大socketfd+1
+@param      readset:   读取集合,可以为NULL
+@param      writeset:  写集合,可以为NULL
+@param      exceptset: 异常集合,可以为NULL
+@param      timeout: 超时时间
+
+*@return	0:   等待超时
+            >0:  readset+writeset+exceptset的集合个数
+            <0  -1
+**/                 
+int select(int maxfdp1, 
+                        openat_fd_set *readset,
+                        openat_fd_set *writeset,
+                        openat_fd_set *exceptset,
+                        struct openat_timeval *timeout);
+
+/**获取socket的错误值
+*@param		socketfd:	调用socket接口返回的socket描述符
+*@return	[EBADF 到 ENO_RECOVERY]
+**/                                       
+int socket_errno(int socketfd);
+
+/**设备驱动程序中设备控制接口
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      cmd:   	指令,如某一个命令对应驱动层的某一个功能
+@param      argp:   可变参数,跟命令有关,传递进入驱动层的参数或者是接收数据的缓存
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+**/
+int	ioctl(int socketfd, long cmd, void *argp);
+
+/**获取一个描述符的名字
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      name:   	描述符的名字
+@param      namelen:   	描述符的名字长度
+*@return	0:  表示成功
+            <0  表示有错误
+**/
+int getsockname (int socketfd, struct openat_sockaddr *name, openat_socklen_t *namelen);
+
+/**主机名到地址解析
+*@param		nodename:	一个主机名或者地址串
+@param      servname:   服务名可以是十进制的端口号,也可以是已定义的服务名称
+@param      hints:   	可以是一个空指针,也可以是一个指向某个openat_addrinfo结构体的指针
+@param      res: 		通过res指针参数返回一个指向openat_addrinfo结构体链表的指针
+
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+*@note      仅仅支持IPv4,且不允许调用者指定所需地址类型的任何信息,
+			返回的结构只包含了用于存储IPv4地址的空间
+**/
+int getaddrinfo(const char *nodename,
+       const char *servname,
+       const struct openat_addrinfo *hints,
+       struct openat_addrinfo **res);
+
+/**存储空间通过调用freeaddrinfo 返还给系统
+*@param		ai:	指向由getaddrinfo返回的第一个openat_addrinfo结构
+*
+**/
+void freeaddrinfo(struct openat_addrinfo *ai);
+
+/**将IP地址由“点分十进制”转换“二进制整数”
+*@param		af: 地址簇
+*@param		src: 源地址
+*@param		dst: 接收转换后的数据
+*@param		size: 缓存区dst的大小
+*@return	>0: 成功
+            <=0: 失败
+**/ 
+#define inet_ntop(af,src,dst,size) \
+    (((af) == AF_INET6) ? ip6addr_ntoa_r((const ip6_addr_t*)(src),(dst),(size)) \
+     : (((af) == AF_INET) ? ip4addr_ntoa_r((const ip4_addr_t*)(src),(dst),(size)) : NULL))
+
+/**将IP地址由“二进制整数”转换“点分十进制”
+*@param 	af: 地址簇
+*@param 	src: 源地址
+*@param 	dst: 接收转换后的数据
+*@return	>0: 成功
+			<=0: 失败
+**/ 
+#define inet_pton(af,src,dst) \
+    (((af) == AF_INET6) ? ip6addr_aton((src),(ip6_addr_t*)(dst)) \
+     : (((af) == AF_INET) ? ip4addr_aton((src),(ip4_addr_t*)(dst)) : 0))
+
+
+/**本地字节顺序转化为网络字节顺序(16bits)
+*@param		n: 本地字节书序数据
+*@return	网络字节顺序数据
+**/                 
+#define htons(n) 				((n & 0xff) << 8) | ((n & 0xff00) >> 8)
+/**本地字节顺序转化为网络字节顺序(32bits)
+*@param		n: 本地字节书序数据
+*@return	网络字节顺序数据
+**/           
+#define htonl(n) 				((n & 0xff) << 24) |\
+                                    ((n & 0xff00) << 8) |\
+                                ((n & 0xff0000UL) >> 8) |\
+                                    ((n & 0xff000000UL) >> 24)
+/**网络字节顺序转化为本地字节顺序(16bits)
+*@param		n: 网络字节顺序
+*@return	本地字节顺序
+**/                                           
+#define ntohs(n) 				htons(n)
+/**网络字节顺序转化为本地字节顺序(32bits)
+*@param		n: 网络字节顺序
+*@return	本地字节顺序
+**/
+#define ntohl(n) 				htonl(n)
+
+/**将ip地址字符串转为数值,转化后的数值为网络字节顺序
+*@param		cp: ip地址字符串,例如"192.168.1.1"
+*@param		addr: struct in_addr 返回的ip地址数值
+*@return    1: 成功
+            0: 失败
+**/ 
+#define inet_aton(cp, addr)   ipaddr_aton(cp, (openat_ip_addr_t*)addr)
+
+/**将ip地址数值(网络字节顺序),转化为ip地址字符串
+*@param		addr: struct in_addr ip地址数值
+*@return	ip地址字符串
+**/ 
+#define inet_ntoa(addr)       ipaddr_ntoa((openat_ip_addr_t*)&(addr))
+
+/**
+ * Check whether "cp" is a valid ascii representation
+ * of an Internet address and convert to a binary address.
+ * Returns 1 if the address is valid, 0 if not.
+ * This replaces inet_addr, the return value from which
+ * cannot distinguish between failure and a local broadcast address.
+ *
+ * @param cp IP address in ascii represenation (e.g. "127.0.0.1")
+ * @param addr pointer to which to save the ip address in network order
+ * @return 1 if cp could be converted to addr, 0 on failure
+ */
+int
+ipaddr_aton(const char *cp, openat_ip_addr_t *addr);
+
+/**
+ * Ascii internet address interpretation routine.
+ * The value returned is in network order.
+ *
+ * @param cp IP address in ascii represenation (e.g. "127.0.0.1")
+ * @return ip address in network order
+ */
+UINT32
+ipaddr_addr(const char *cp);
+
+/**
+ * Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
+ *
+ * @param addr ip address in network order to convert
+ * @param buf target buffer where the string is stored
+ * @param buflen length of buf
+ * @return either pointer to buf which now holds the ASCII
+ *         representation of addr or NULL if buf was too small
+ */
+char *ipaddr_ntoa_r(const openat_ip_addr_t *addr, char *buf, int buflen);
+
+/**
+ * Convert numeric IP address into decimal dotted ASCII representation.
+ * returns ptr to static buffer; not reentrant!
+ *
+ * @param addr ip address in network order to convert
+ * @return pointer to a global static (!) buffer that holds the ASCII
+ *         represenation of addr
+ */
+char *
+ipaddr_ntoa(const openat_ip_addr_t *addr);
+
+/** @}*/
+
+#endif
+

+ 80 - 0
bsp/air724/sdk/api/include/iot_spi.h

@@ -0,0 +1,80 @@
+#ifndef __IOT_SPI_H__
+#define __IOT_SPI_H__
+
+#include "iot_os.h"
+
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_spi spi接口
+ * @{
+ */
+
+/**配置spi
+*@param		port:		SPI 编号
+*@param		cfg:		初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_spi_open(
+                        E_AMOPENAT_SPI_PORT  port,         
+                        T_AMOPENAT_SPI_PARAM *cfg        
+                  );
+
+/**读取spi数据
+*@param		port:		SPI 编号
+*@param		buf:		存储数据地址
+*@param		bufLen:		存储空间长度
+*@return	UINT32: 	实际读取长度
+**/
+UINT32 iot_spi_read(                                       
+                        E_AMOPENAT_SPI_PORT port,         
+                        UINT8* buf,                      
+                        UINT32 bufLen                      
+                  );
+
+/**写入spi数据
+*@param		port:		SPI 编号
+*@param		buf:		写入数据地址
+*@param		bufLen:		写入数据长度
+*@return	UINT32: 	实际写入长度
+**/
+UINT32 iot_spi_write(                                       
+                        E_AMOPENAT_SPI_PORT port,        
+                        CONST UINT8* buf,                  
+                        UINT32 bufLen                      
+                   );
+
+/**spi全双工读写
+*@note      全双工方式读写,读写长度相同
+*@param		port:		SPI 编号
+*@param		txBuf:		写缓冲
+*@param		rxBuf:		读缓冲
+*@param		len:		读写长度
+*@return	UINT32: 	实际写入长度
+**/
+UINT32 iot_spi_rw(                                       
+                        E_AMOPENAT_SPI_PORT port,         
+                        CONST UINT8* txBuf,               
+                        UINT8* rxBuf,                       
+                        UINT32 len                          
+                );
+
+/**关闭spi
+*@param		port:		SPI 编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_spi_close(
+                        E_AMOPENAT_SPI_PORT  port
+                );    
+
+/** @}*/
+/** @}*/
+
+#endif
+
+
+

+ 67 - 0
bsp/air724/sdk/api/include/iot_sys.h

@@ -0,0 +1,67 @@
+#ifndef __IOT_SYS_H__
+#define __IOT_SYS_H__
+
+#include "iot_os.h"
+#include "openat_ota.h"
+
+/**
+ * @defgroup iot_sdk_fota 远程升级接口
+ * @{
+ */
+	/**@example fota/demo_fota.c
+	* OTA接口示例
+	*/ 
+
+
+/**远程升级初始化
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_init(void);
+
+/**远程升级下载
+*@param		data:				下载固件包数据
+*@param		len:				下载固件包长度
+*@param		total:				固件包总大小
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_download(const char* data, UINT32 len, UINT32 total);
+
+/**远程升级
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_done(void);
+
+/**ota设置new core的文件,用来告知底层需要从文件读取升级新的程序
+*@param		newCoreFile:		新程序文件 
+*@return	TRUE: 成功   FALSE: 失败
+*注:newCoreFile文件必须保存在/fota文件夹下,例如newCoreFile 为 "/fota/core.img"
+**/
+BOOL iot_ota_newcore(              
+                    CONST char* newCoreFile
+               );
+
+
+/**ota设置new app的文件,用来告知底层需要从文件读取升级新的程序
+*@param		newAPPFile:		新程序文件 
+*@return	TRUE: 成功   FALSE: 失败
+*注:newAPPFile文件必须保存在/fota文件夹下,例如newAPPFile 为 "/fota/app.img"
+**/
+BOOL iot_ota_newapp(              
+                    CONST char* newAPPFile
+               );
+
+
+/**将char类型转换为WCHAR,结果用来作为iot_fs_open_file等接口的文件名参数
+*@param     dst:        转换输出结果
+*@param     src:        等待转换的字符串
+*@return    返回dst首地址
+**/ 
+WCHAR* iot_strtows(WCHAR* dst, const char* src);
+
+/** @}*/
+
+#endif
+

+ 56 - 0
bsp/air724/sdk/api/include/iot_tts.h

@@ -0,0 +1,56 @@
+#ifndef __IOT_TTS_H__
+#define __IOT_TTS_H__
+
+#include "iot_os.h"
+
+/**
+ * @defgroup iot_sdk_audio 音频接口
+ * @{
+ */
+
+	/**@example tts/demo_tts.c
+	* tts接口示例
+	*/ 
+
+/**初始化tts引擎
+*@param		cb:		TTS播放结果回调函数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_tts_init(
+                    TTS_PLAY_CB cb         
+              );
+
+/**tts播放文本
+*@param		text:		待播放文本
+*@param		len:		文本长度(字节)
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_play(                                   
+                    char *text,u32 len                    
+              );
+
+
+/**tts停止播放
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_stop(      );
+
+
+/**设置tts配置参数
+*@param		flag:		参数标志
+*@param		value:		参数值
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_set_param(
+		OPENAT_TTS_PARAM_FLAG flag,u32 value
+		);
+
+
+/** @}*/
+/** @}*/
+
+#endif

+ 52 - 0
bsp/air724/sdk/api/include/iot_types.h

@@ -0,0 +1,52 @@
+#ifndef __IOT_TYPES_H__
+#define __IOT_TYPES_H__
+
+#define INVALID_HANDLE_VALUE			(0xffffffff)
+
+#if !(defined(WIN32) || defined(_USERGEN))
+#ifndef __INT8_T__
+typedef char        int8_t;
+#define __INT8_T__
+#endif
+
+#ifndef __INT16_T__
+typedef short       int16_t;
+#define __INT16_T__
+#endif
+
+#ifndef __INT32_T__
+typedef int         int32_t;
+#define __INT32_T__
+#endif
+
+#ifndef __U8_T__
+typedef unsigned char u8_t;
+#define __U8_T__
+#endif
+
+#ifndef __UINT8_T__
+typedef unsigned char   uint8_t;
+#define __UINT8_T__
+#endif
+
+#ifndef __UINT16_T__
+typedef unsigned short  uint16_t;
+#define __UINT16_T__
+#endif
+
+#ifndef __U16_T__
+typedef unsigned short u16_t;
+#define __U16_T__
+#endif
+
+
+#ifndef __UINT32_T__
+typedef unsigned int    uint32_t;
+#define __UINT32_T__
+#endif
+
+typedef unsigned long long  uint64_t;
+typedef long long   int64_t;
+#endif
+
+#endif

+ 67 - 0
bsp/air724/sdk/api/include/iot_uart.h

@@ -0,0 +1,67 @@
+#ifndef __IOT_UART_H__
+#define __IOT_UART_H__
+
+#include "iot_os.h"
+/**
+ * @ingroup iot_sdk_device 外设接口
+ * @{
+ */
+/**
+ * @defgroup iot_sdk_uart 串口接口
+ * @{
+ */
+/**@example uart/demo_uart.c
+* uart接口示例
+*/ 
+
+/**打开uart
+*@param		port:		UART 编号
+*@param		cfg:		配置信息
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_uart_open(
+                        E_AMOPENAT_UART_PORT port,       
+                        T_AMOPENAT_UART_PARAM *cfg         
+                   );
+
+/**关闭uart
+*@param		port:		UART 编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_uart_close(
+                        E_AMOPENAT_UART_PORT port          
+                   );
+
+
+/**读uart
+*@param		port:		UART 编号
+*@param		buf:		存储数据地址
+*@param		bufLen:		存储空间长度
+*@param		timeoutMs:	读取超时 ms
+*@return	UINT32:     实际读取长度
+**/
+UINT32 iot_uart_read(                                       
+                        E_AMOPENAT_UART_PORT port,         
+                        UINT8* buf,                       
+                        UINT32 bufLen,                      
+                        UINT32 timeoutMs                  
+                   );
+
+/**写uart
+*@param		port:		UART 编号
+*@param		buf:		写入数据地址
+*@param		bufLen:		写入数据长度
+*@return	UINT32:     实际读取长度
+**/
+UINT32 iot_uart_write(                                      
+                        E_AMOPENAT_UART_PORT port,        
+                        UINT8* buf,                         
+                        UINT32 bufLen                       
+                    );
+
+/** @}*/
+/** @}*/
+#endif
+

+ 98 - 0
bsp/air724/sdk/api/include/iot_vat.h

@@ -0,0 +1,98 @@
+#ifndef  __IOT_VAT_H__
+#define  __IOT_VAT_H__
+
+#include "am_openat_vat.h"
+#include "iot_network.h"
+
+#define URC_QUEUE_COUNT 10                      /* global urc count */
+#define AT_CMD_QUEUE_COUNT 50
+#define AT_CMD_EXECUTE_DELAY  10                /* 10 ms */
+
+#define AT_CMD_DELAY "DELAY:"
+#define AT_CMD_END "\x0d\x0a"
+#define AT_CMD_CR  '\x0d'
+#define AT_CMD_LF  '\x0a'
+#define STR_TO_INT(x) 	(x-'0') 					/*数字的char转换为int*/
+
+
+typedef enum
+{
+    AT_RSP_ERROR = -1,
+    AT_RSP_WAIT= 0, 
+    AT_RSP_CONTINUE = 1,                        /* 继续执行下一条AT队列里的命令 */
+    AT_RSP_PAUSE= 2,                            /* 暂停执行AT队列命令 */
+    AT_RSP_FINISH = 3,                          /* 停止执行AT队列命令 */
+
+    AT_RSP_FUN_OVER = 4,                        /* 功能模块化AT命令组执行完毕,可以把本次运行的功能清除 */
+    AT_RSP_STEP_MIN = 10,
+    AT_RSP_STEP = 20,                           /* 继续执行本条AT命令 */
+    AT_RSP_STEP_MAX = 30,
+
+}AtCmdRsp;
+
+typedef AtCmdRsp (*AtCmdRspCB)(char *pRspStr);
+typedef VOID (*UrcCB)(char *pUrcStr, u16 len);
+typedef VOID (*ResultNotifyCb)(BOOL result);
+
+typedef struct AtCmdEntityTag
+{
+    char* p_atCmdStr;				/*AT命令字符串*/
+    u16 cmdLen;					/*AT命令长度*/
+    AtCmdRspCB p_atCmdCallBack;	/*AT命令回调函数*/
+}AtCmdEntity;
+
+typedef struct UrcEntityTag
+{
+    char* p_urcStr;
+    UrcCB p_urcCallBack;
+
+}UrcEntity;
+
+typedef struct _CELL_INFO
+{
+	u32 CellId;  //cell ID
+	u32 Lac;  //LAC
+	u16 Mcc;  //MCC
+	u16 Mnc;  //MNC
+	u16 rssi; //rssi
+}CELL_INFO;
+
+typedef struct _gsmloc_cellinfo
+{
+	CELL_INFO Cellinfo[6];
+}gsmloc_cellinfo;
+
+/**
+ * @defgroup iot_sdk_sys 系统接口
+ * @{
+ */
+/**@example vat/demo_vat.c
+* vat接口示例
+*/ 
+/**用来设置虚拟AT通道的回调函数
+*@param		vatHandle:  虚拟AT主动上报或者AT命令结果返回的回调函数
+*@return	TRUE: 成功   FALSE: 失败
+**/
+BOOL iot_vat_init(PAT_MESSAGE vatHandle);
+
+/**用来发送AT命令
+*@param		cmdStr:  AT命令字符串
+*@param   	cmdLen:  AT命令长度
+*@return	TRUE: 成功   FALSE: 失败
+*@note      注意,AT命令字符串cmdStr中需要包含"\r\n"或者"\r"结尾
+**/
+BOOL iot_vat_send_cmd(UINT8* cmdStr, UINT16 cmdLen);
+
+/**用来批量发送AT命令
+*@param		cmd:  AT命令参数
+*@param   	cmd_count:  AT命令个数
+*@return	TRUE: 成功   FALSE: 失败
+**/
+BOOL iot_vat_push_cmd(AtCmdEntity cmd[],u8 cmd_count);
+
+
+/** @}*/
+
+
+#endif
+

+ 51 - 0
bsp/air724/sdk/api/include/iot_zbar.h

@@ -0,0 +1,51 @@
+#ifndef __IOT_ZBAR_H__
+#define __IOT_ZBAR_H__
+#include "iot_os.h"
+
+/**
+ * @defgroup iot_sdk_zbar 二维码解析接口
+ * @{
+ */
+ 
+/**@example zbar/demo_zbar.c
+* 二维码接口示例
+*/ 
+
+/**解析二维码,返回句柄handle
+*@param		width:		解析图片的宽度
+*@param		height:		解析图片的高度
+*@param		data:		解析图片的数据
+*@param		size:		解析图片数据大小
+*@return	获取句柄handle, 不等于0表示解析成功
+*           
+**/
+int iot_zbar_scannerOpen(int width, int height, int size, unsigned char *data);
+
+/**获取解析二维码的数据
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@param		len:		获取数据的长度
+*@return	获取的数据地址
+**/
+char * iot_zbar_getData(int handle, int *len);
+
+/**查看是否还有下一个数据
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return	TRUE:   还有下一个数据
+*			FALSE:  没有下一个数据
+**/
+BOOL iot_zbar_findNextData(int handle);
+
+/**获取当前数据编码的格式
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return	返回的格式类型
+**/
+char * iot_zbar_getType(int handle);
+
+/**释放句柄
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return    void	
+**/
+void iot_zbar_scannerClose(int handle);
+
+/** @}*/
+#endif

+ 32 - 0
bsp/air724/sdk/api/src/iot_adc.c

@@ -0,0 +1,32 @@
+#include "iot_adc.h"
+
+/**ADC初始化 
+*@param		channel:		adc通道
+*@param     mode:       adc模式
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_adc_init(
+                        E_AMOPENAT_ADC_CHANNEL channel  /* ADC编号 */,
+    					E_AMOPENAT_ADC_CFG_MODE mode
+                )
+{
+    return OPENAT_InitADC(channel,mode);
+}
+
+/**读取ADC数据
+*@note ADC值,可以为空, 电压值,可以为空
+*@param		channel:		adc通道
+*@param		adcValue:	ADC值,可以为空
+*@param		voltage:	电压值,可以为空
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_adc_read(
+                        E_AMOPENAT_ADC_CHANNEL channel,     
+                        UINT32* adcValue,                  
+                        UINT32* voltage                   
+                )
+{
+    return OPENAT_ReadADC(channel, adcValue, voltage);
+}

+ 250 - 0
bsp/air724/sdk/api/src/iot_audio.c

@@ -0,0 +1,250 @@
+#include "iot_audio.h"
+
+/****************************** AUDIO ******************************/
+/**打开语音
+*@note  在通话开始时调用
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_auido_open_tch(                                           
+                        VOID
+                )
+{
+    return IVTBL(open_tch)();
+}
+
+/**关闭语音
+*@note  通话结束时调用
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_close_tch(                                          
+                        VOID
+                 )
+{
+    return IVTBL(close_tch)();
+}
+
+/**播放TONE音
+*@param  toneType:      TONE音类型
+*@param  duration:      播放时长
+*@param  volume:        播放音量
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_tone(                                         
+                        E_AMOPENAT_TONE_TYPE toneType,      
+                        UINT16 duration,                   
+                        E_AMOPENAT_SPEAKER_GAIN volume     
+                 )
+{
+    return IVTBL(play_tone)(toneType, duration, volume);
+}
+
+/**停止播放TONE音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_tone(                                         
+                        VOID
+                 )
+{
+    return IVTBL(stop_tone)();
+}
+
+
+/**播放DTMF音
+*@param  dtmfType:      DTMF类型
+*@param  duration:      播放时长
+*@param  volume:        播放音量
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_dtmf(                                        
+                        E_AMOPENAT_DTMF_TYPE dtmfType,     
+                        UINT16 duration,                   
+                        E_AMOPENAT_SPEAKER_GAIN volume     
+                 )
+{
+    return IVTBL(play_dtmf)(dtmfType, duration, volume);
+}
+
+/**停止播放DTMF音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_dtmf(                                          
+                        VOID
+                 )
+{
+    return IVTBL(stop_dtmf)();
+}
+
+/**播放音频
+*@param  playParam:     播放参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_play_music(T_AMOPENAT_PLAY_PARAM*  playParam)
+{
+    return IVTBL(play_music)(playParam);
+}
+
+/**停止音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_stop_music(                                       
+                        VOID
+                  )
+{
+    return IVTBL(stop_music)();
+}
+
+/**暂停音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_pause_music(                                       
+                        VOID
+                   )
+{
+    return IVTBL(pause_music)();
+}
+
+/**恢复音频播放
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_resume_music(                                     
+                        VOID
+                    )
+{
+    return IVTBL(resume_music)();
+}
+
+/**设置扬声器静音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_mute_speaker(                                       
+                        VOID
+                    )
+{
+    return IVTBL(mute_speaker)();
+}
+
+/**解除扬声器静音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_unmute_speaker(                                    
+                        VOID
+                      )
+{
+    return IVTBL(unmute_speaker)();
+}
+
+/**设置扬声器的音量值
+*@param     vol:   设置扬声器音量值
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_speaker_vol(                                   
+                        UINT32 vol 
+                        )
+{
+    return IVTBL(set_music_volume)(vol);
+}
+
+/**获取扬声器的音量值
+*@return	UINT32: 	 返回扬声器的音量值
+**/
+UINT32 iot_audio_get_speaker_vol(                
+                        VOID
+                                           )
+{
+    return IVTBL(get_music_volume)();
+}
+
+/**设通话的音量值
+*@param     vol:   设置通话音量值
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_sph_vol(                                   
+                        UINT32 vol 
+                        )
+{
+    return IVTBL(set_sph_vol)(vol);
+}
+
+/**获取通话的音量值
+*@return	UINT32: 	 返回通话的音量值
+**/
+UINT32 iot_audio_get_sph_vol(                
+                        VOID
+                        )
+{
+    return IVTBL(get_sph_vol)();
+}
+
+
+/**设置音频通道
+*@param     channel:    通道
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_set_channel(                                        
+                        E_AMOPENAT_AUDIO_CHANNEL channel   
+                   )
+{
+    return IVTBL(set_channel)(channel);
+}
+
+/**获取当前通道
+*@return	E_AMOPENAT_AUDIO_CHANNEL: 	  返回通道值
+**/
+E_AMOPENAT_AUDIO_CHANNEL iot_audio_get_current_channel(            
+                        VOID
+                                               )
+
+{
+    return IVTBL(get_current_channel)();
+}
+
+/**开始录音
+*@param     param:   录音参数
+*@param     cb:     获取录音数据回调
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_rec_start(
+                    			E_AMOPENAT_RECORD_PARAM* param,
+								AUD_RECORD_CALLBACK_T cb)
+{
+    return ((IVTBL(audio_record)(param, cb) == 0) ? 1 : 0);
+}
+
+/**停止录音
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_audio_rec_stop()
+{
+    return ((IVTBL(audio_stop_record)() == 0) ? 1 : 0);
+}
+
+/**流播放
+*@param  playformat:    数据流类型
+*@param  cb:    		数据流回调函数
+*@param  data:    		数据流
+*@param  len:  		  	数据流长度
+*@return	>0: 	    播放长度
+*           -1:      	播放失败
+**/
+int iot_audio_streamplay(E_AMOPENAT_AUD_FORMAT playformat,AUD_PLAY_CALLBACK_T cb,char* data,int len)
+{
+	return IVTBL(streamplay)(playformat,cb,data,len);
+}
+

+ 100 - 0
bsp/air724/sdk/api/src/iot_camera.c

@@ -0,0 +1,100 @@
+#include "iot_camera.h"
+#include "iot_fs.h"
+
+/**摄像头初始化
+*@param		cameraParam:		初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_init(T_AMOPENAT_CAMERA_PARAM *cameraParam)
+{
+  return IVTBL(InitCamera)(cameraParam);
+}
+
+/**打开摄像头
+*@param		videoMode:		是否视频模式
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_poweron(BOOL videoMode)
+{
+  return IVTBL(CameraPoweron)(videoMode);
+}
+/**关闭摄像头
+*@return  TRUE:       成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_poweroff(void)
+{
+  IVTBL(CameraPowerOff)();
+  return TRUE;
+}
+/**开始预览
+*@param  previewParam:       预览参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+
+**/
+BOOL iot_camera_preview_open(T_AMOPENAT_CAM_PREVIEW_PARAM *previewParam)
+{
+  return IVTBL(CameraPreviewOpen)(previewParam);
+}
+/**退出预览
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+
+**/
+BOOL iot_camera_preview_close(void)
+{
+  return IVTBL(CameraPreviewClose)();
+}
+/**拍照
+*@param  fileName:      保存图片的文件名
+*@param  captureParam:       预览参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_capture(char *fileName, T_AMOPENAT_CAM_CAPTURE_PARAM *captureParam)
+{ 
+	INT32 fd;
+		
+	if (!fileName)
+	{
+		return FALSE;
+	}
+	
+	iot_fs_delete_file(fileName);
+	fd = iot_fs_create_file(fileName);
+
+	if (fd < 0)
+	{
+		return FALSE; 
+	}
+	
+	if(!IVTBL(CameraCapture)(captureParam))
+	{
+		iot_fs_close_file(fd);
+		return FALSE;
+	}
+
+	if (!IVTBL(CameraSavePhoto)(fd))
+	{
+		iot_fs_close_file(fd);
+		return FALSE; 
+	}
+
+	iot_fs_close_file(fd);
+
+	return TRUE;
+}
+
+/**设置camera寄存器
+*@param  initRegTable_p: cam寄存器表
+*@param  len:   cam寄存器长度
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_camera_WriteReg(PAMOPENAT_CAMERA_REG initRegTable_p, int len)
+{
+	return IVTBL(CameraWriteReg)(initRegTable_p, len);
+}

+ 53 - 0
bsp/air724/sdk/api/src/iot_debug.c

@@ -0,0 +1,53 @@
+#include "iot_debug.h"
+#include "am_openat.h"
+#include "string.h"
+#include <stdio.h>
+
+
+extern BOOL g_s_traceflag;
+/*******************************************
+**                 DEBUG                  **
+*******************************************/
+
+/**assert断言
+*@param		condition:	断言条件
+*@param		func:	    断言函数
+*@param		line:	    断言位置
+*@return	TURE: 	    成功
+*           FALSE:      失败
+**/
+VOID iot_debug_assert(                                          
+                        BOOL condition,                  
+                        CHAR *func,                     
+                        UINT32 line                       
+              )
+{
+    IVTBL(assert)(condition, func, line);
+}
+
+
+/**调试信息打印
+**/
+VOID iot_debug_print(CHAR *fmt, ...)
+{
+	char buff[256] = {0};
+	va_list args;
+	va_start(args, fmt);
+	vsnprintf(buff, 256, fmt, args);
+	if(g_s_traceflag)
+		IVTBL(lua_print)("%s", buff);
+	else
+		IVTBL(print)("%s", buff);
+	va_end (args);
+}
+
+/**设置软件异常时,设备模式
+*@param	  mode:   OPENAT_FAULT_RESET 重启模式
+				  OPENAT_FAULT_HANG  调试模式
+**/
+
+VOID iot_debug_set_fault_mode(E_OPENAT_FAULT_MODE mode)
+{
+	IVTBL(SetFaultMode)(mode);
+}
+

+ 75 - 0
bsp/air724/sdk/api/src/iot_flash.c

@@ -0,0 +1,75 @@
+#include "iot_flash.h"
+#include "hal_config.h"
+
+
+/**获取flash可用的地址空间,返回的地址用来传入iot_flash_erase、iot_flash_write、iot_flash_read等接口。
+*@param		addrout:	返回可用flash地址
+*@param		lenout:	返回可用flash长度,单位为字节
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+*@note      该接口返回的地址是64KB对齐 返回的地址空间根据当前程序大小来确定。
+**/
+VOID iot_flash_getaddr(    
+                    UINT32* addrout,
+                    UINT32* lenout
+               )
+{
+    extern char __flash_start;
+    extern char __flash_end;
+    UINT32 aligned = ((UINT32)&__flash_end + 0x10000 - 1) & (~(0x10000 - 1));
+    if(addrout)
+    {
+        *addrout = aligned - CONFIG_NOR_PHY_ADDRESS;
+    }
+    if(lenout)
+    {
+        *lenout = CONFIG_APPIMG_FLASH_SIZE - (aligned - (UINT32)&__flash_start);
+    }
+}
+
+/**flash擦 
+*@param		startAddr:		擦写地址 64K对齐
+*@param		endAddr:		擦写结束地址
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_erase(             
+                        UINT32 startAddr,
+                        UINT32 endAddr
+                   )
+{
+    return OPENAT_flash_erase(startAddr, endAddr);
+}
+
+/**flash写 
+*@param		startAddr:		写地址 
+*@param		size:		    写数据大小
+*@param		writenSize:		写数据类型大小
+*@param		buf:		    写数据指针
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_write(             
+                        UINT32 startAddr,
+                        UINT32 size,
+                        UINT32* writenSize,
+                        CONST UINT8* buf
+                   )
+{
+    return OPENAT_flash_write(startAddr, size, writenSize, buf);
+}
+
+/**flash读
+*@param		startAddr:		读地址 
+*@param		size:		    读数据大小
+*@param		readSize:		读数据类型大小
+*@param		buf:		    读数据指针
+*@return	E_AMOPENAT_MEMD_ERR: 	成功:OPENAT_MEMD_ERR_NO, 其余失败
+**/
+E_AMOPENAT_MEMD_ERR iot_flash_read(               
+                        UINT32 startAddr,
+                        UINT32 size,
+                        UINT32* readSize,
+                        UINT8* buf
+                   )
+{
+    return OPENAT_flash_read(startAddr, size, readSize, buf);
+}
+

+ 231 - 0
bsp/air724/sdk/api/src/iot_fs.c

@@ -0,0 +1,231 @@
+#include "iot_fs.h"
+
+/*******************************************
+**              FILE SYSTEM               **
+*******************************************/
+
+/**打开文件
+*@param		pszFileNameUniLe:		文件全路径名称
+*@param		iFlag:		打开标志详细请参见E_AMOPENAT_FILE_OPEN_FLAG
+*@return	INT32: 	    返回文件句柄
+**/
+INT32 iot_fs_open_file(                           
+                        char* pszFileNameUniLe,
+                        UINT32 iFlag         
+                  )
+{
+    return OPENAT_open_file(pszFileNameUniLe, iFlag, 0);
+}
+
+/**关闭文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@return	INT32: 	    返回值小于0失败, 其余成功
+**/
+INT32 iot_fs_close_file(                      
+                        INT32 iFd             
+                   )
+{
+    return OPENAT_close_file(iFd);
+}
+
+/**读取文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		pBuf:		数据保存指针
+*@param		iLen:		buf长度
+*@return	INT32: 	    返回读取长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_read_file(                    
+                        INT32 iFd,          
+                        UINT8 *pBuf,       
+                        UINT32 iLen           
+                  )
+{
+    return OPENAT_read_file(iFd, pBuf, iLen);
+}
+
+/**写入文件
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		pBuf:		需要写入的数据指针
+*@param		iLen:		数据长度
+*@return	INT32: 	    返回写入长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_write_file(                    
+                        INT32 iFd,              
+                        UINT8 *pBuf,          
+                        UINT32 iLen           
+                   )
+{
+    return OPENAT_write_file(iFd, pBuf, iLen);
+}
+
+/**立即写入flash
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@return	INT32: 	    返回立即写入长度, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_flush_file(                         
+                        INT32 iFd             
+                   )
+{
+    return OPENAT_flush_file(iFd);
+}
+
+/**文件定位
+*@note      参数iOffset的含义取决于iOrigin的值.
+*@param		iFd:		文件句柄,open_file 或 create_file 返回的
+*@param		iOffset:	偏移量
+*@param		iOrigin:	参数详细请参见E_AMOPENAT_FILE_SEEK_FLAG
+*@return	INT32: 	    返回文件的偏移量
+**/
+INT32 iot_fs_seek_file(                         
+                        INT32 iFd,            
+                        INT32 iOffset,        
+                        UINT8 iOrigin           
+                  )
+{
+    return OPENAT_seek_file(iFd, iOffset, iOrigin);
+}
+
+/**创建文件
+*@param		pszFileNameUniLe:	文件全路径名称
+*@return	INT32: 	            返回文件句柄, 小于0表示失败,其余成功
+**/
+INT32 iot_fs_create_file(                        
+                        char* pszFileNameUniLe       
+                    )
+{
+    return OPENAT_create_file(pszFileNameUniLe, 0);
+}
+
+/**删除文件
+*@param		pszFileNameUniLe:	文件全路径名称
+*@return	INT32: 	            返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_delete_file(                         
+                        char* pszFileNameUniLe
+                    )
+{
+    return OPENAT_delete_file(pszFileNameUniLe);
+}
+
+/**切换当前工作目录
+*@param		pszDirNameUniLe:	目录路径
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_change_dir(                         
+                        char* pszDirNameUniLe  
+                   )
+{
+    return OPENAT_change_dir(pszDirNameUniLe);
+}
+
+/**创建目录
+*@param		pszDirNameUniLe:	目录路径
+*@param		iMode:	            目录属性,详细请参见E_AMOPENAT_FILE_ATTR_TAG
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_make_dir(                            
+                        char* pszDirNameUniLe,
+                        UINT32 iMode            
+                 )
+{
+    return OPENAT_make_dir(pszDirNameUniLe, iMode);
+}
+
+/**删除目录
+*@param		pszDirNameUniLe:	目录路径,该目录必须为空,接口才能返回成功
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_remove_dir(                            
+                        char* pszDirNameUniLe  
+                   )
+{
+    return OPENAT_remove_dir(pszDirNameUniLe);
+}
+
+/**获取当前路径
+*@param		pCurDirUniLe:	目录路径
+*@param		uUnicodeSize:	    存储目录信息空间大小
+*@return	INT32: 	返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_get_current_dir(                      
+                        char* pCurDirUniLe,  
+                        UINT32 uUnicodeSize    
+                        )
+{
+    return OPENAT_get_current_dir(pCurDirUniLe, uUnicodeSize);
+}
+
+
+/**获取文件系统信息
+*@param		devName:	查找文件句柄
+*@param		fileInfo:	文件系统信息
+*@return	INT32 返回值小于0表示失败,其余成功
+**/
+INT32 iot_fs_get_fs_info(                         
+                        E_AMOPENAT_FILE_DEVICE_NAME       devName,         
+                        T_AMOPENAT_FILE_INFO               *fileInfo                 
+                   )
+{
+    return OPENAT_get_fs_info(devName, fileInfo, 0, 0);
+}
+
+/**获取文件大小接口
+*@param	   pszFileNameUniLe:   文件全路径名称
+*@return   UINT32:			   返回文件的大小
+**/
+UINT32 iot_fs_file_size(
+                    char* pszFileNameUniLe
+                )
+{
+    return IVTBL(get_file_size)(pszFileNameUniLe);
+}
+
+/**打开查找,并且获取文件夹下文件名
+*@param		dirName:	路径
+*@param     findResult: 对应路径下的第一个文件
+*@return	fileInfo: 	查找返回的句柄,返回值小于0表示失败,其余成功
+**/                   
+INT32 iot_fs_find_first(
+     char* dirName,
+     PAMOPENAT_FS_FIND_DATA findResult
+)
+{
+    INT32 ret = IVTBL(find_first_file)(dirName, findResult);
+
+	return (ret == 1) ? 0 : -1; 
+}
+
+/**获取文件夹下文件名
+*@param		iFd:  iot_fs_find_first接口返回值
+*@param     findResult: 对应路径下的文件
+*@return	fileInfo: 	返回小于0表示没有剩余文件,其他值表示还有文件
+**/                   
+INT32 iot_fs_find_next(
+     INT32 iFd, 
+     PAMOPENAT_FS_FIND_DATA findResult
+)
+{
+	if (iFd != 0)
+	{
+		return -1;
+	}
+
+	INT32 ret = IVTBL(find_next_file)(1, findResult);
+
+	return (ret == 1) ? 0 : -1;
+}
+
+/**关闭查找
+*@param		iFd:  iot_fs_find_first接口返回值
+*@return	fileInfo: 	返回值小于0表示失败,其余成功
+**/           
+INT32 iot_fs_find_close(
+     INT32 iFd
+)
+{
+	if (iFd != 0)
+	{
+		return -1;
+	}
+    return IVTBL(find_close)(1);
+}

+ 55 - 0
bsp/air724/sdk/api/src/iot_gpio.c

@@ -0,0 +1,55 @@
+#include "iot_gpio.h"
+
+/**配置gpio 
+*@param		port:		GPIO编号
+*@param		cfg:		配置信息
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_gpio_open(                          
+                        E_AMOPENAT_GPIO_PORT port, 
+                        T_AMOPENAT_GPIO_CFG *cfg    
+                   )
+{
+    return OPENAT_config_gpio(port, cfg);
+}
+
+/**设置gpio 
+*@param		port:		GPIO编号
+*@param		value:		0 or 1
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_gpio_set(                               
+                        E_AMOPENAT_GPIO_PORT port,  
+                        UINT8 value                
+                )
+{
+    return OPENAT_set_gpio(port, value);
+}
+
+/**读取gpio 
+*@param		port:		GPIO编号
+*@param		value:		0 or 1
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/				
+BOOL iot_gpio_read(                            
+                        E_AMOPENAT_GPIO_PORT port, 
+                        UINT8* value                
+                  )
+{
+    return OPENAT_read_gpio(port, value);
+}
+
+/**关闭gpio 
+*@param		port:		GPIO编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/	
+BOOL iot_gpio_close(                            
+                        E_AMOPENAT_GPIO_PORT port
+                  )
+{
+    return OPENAT_close_gpio(port);
+}

+ 67 - 0
bsp/air724/sdk/api/src/iot_i2c.c

@@ -0,0 +1,67 @@
+#include "iot_i2c.h"
+
+/**开打i2c
+*@param		port:		I2C 编号
+*@param		param:		初始化参数
+*@return	TRUE:       成功
+*	        FALSE:      失败
+**/
+BOOL iot_i2c_open(
+                        E_AMOPENAT_I2C_PORT  port,         
+                        T_AMOPENAT_I2C_PARAM *param         
+                  )
+{
+    return OPENAT_open_i2c(port, param);
+}
+
+/**关闭i2c
+*@param		port:		I2C 编号
+*@return	TRUE:       成功
+*	        FALSE:      失败
+**/
+BOOL iot_i2c_close(
+                        E_AMOPENAT_I2C_PORT  port          
+                  )
+{
+    return OPENAT_close_i2c(port);
+}
+
+/**写入i2c数据
+*@param		port:		    I2C 编号
+*@param		salveAddr:		从设备地址
+*@param		pRegAddr:		寄存器地址
+*@param		buf:		    写入数据地址
+*@param		bufLen:		    写入数据长度
+*@return	UINT32:         实际写入长度
+**/
+UINT32 iot_i2c_write(                                 
+                        E_AMOPENAT_I2C_PORT port,       
+                        UINT8 salveAddr,
+                        CONST UINT8 *pRegAddr,             
+                        CONST UINT8* buf,                  
+                        UINT32 bufLen                   
+                   )
+{
+	UINT8 psalveAddr = salveAddr << 1;
+    return OPENAT_write_i2c(port, psalveAddr, pRegAddr, buf, bufLen);
+}
+
+/**读取i2c数据
+*@param		port:		    I2C 编号
+*@param		slaveAddr:		从设备地址
+*@param		pRegAddr:		寄存器地址
+*@param		buf:		    存储数据地址
+*@param		bufLen:		    存储空间长度
+*@return	UINT32:         实际读取长度
+**/
+UINT32 iot_i2c_read(                                        
+                        E_AMOPENAT_I2C_PORT port,        
+                        UINT8 slaveAddr, 
+                        CONST UINT8 *pRegAddr,             
+                        UINT8* buf,                      
+                        UINT32 bufLen                      
+                  )
+{
+	UINT8 psalveAddr = slaveAddr << 1;
+	return OPENAT_read_i2c(port, psalveAddr, pRegAddr, buf, bufLen);
+}

+ 16 - 0
bsp/air724/sdk/api/src/iot_keypad.c

@@ -0,0 +1,16 @@
+#include "iot_keypad.h"
+
+
+
+/**键盘初始化 
+*@param		pConfig: 键盘配置参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_keypad_init(                         
+                        T_AMOPENAT_KEYPAD_CONFIG *pConfig
+                  )
+{
+   return OPENAT_init_keypad(  pConfig );
+}
+

+ 73 - 0
bsp/air724/sdk/api/src/iot_lcd.c

@@ -0,0 +1,73 @@
+#include "iot_lcd.h"
+
+
+/**写入 lcd命令
+*@param		cmd: 命令
+**/
+VOID iot_lcd_write_cmd(                          
+                        UINT8 cmd 
+                   )
+{
+    return  IVTBL(send_color_lcd_command)(cmd);
+}
+
+/**lcd 写入lcd数据 
+*@param	 	data: 数据
+**/
+VOID iot_lcd_write_data(                               
+                        UINT8 data                
+                )
+{
+    return IVTBL(send_color_lcd_data)(data);
+}
+
+/**lcd初始化
+*@param		param: lcd初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/	
+BOOL iot_lcd_color_init(T_AMOPENAT_COLOR_LCD_PARAM *param )
+{
+    return IVTBL(init_color_lcd)(  param );
+}
+
+/**  刷新lcd
+*@param		rect: 需要刷新的区域
+*@param		pDisplayBuffer: 刷新的缓冲区
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+VOID iot_lcd_update_color_screen(
+				T_AMOPENAT_LCD_RECT_T* rect,        /* 需要刷新的区域 */
+				UINT16 *pDisplayBuffer    )
+{
+    IVTBL(update_color_lcd_screen)(                       
+                            rect,      
+                            pDisplayBuffer       
+                                   );
+}
+/** 解码jpg格式图片
+*@param		filename: 文件路径包括文件名
+*@param		imageinfo: 文件格式
+*@return	INT32: 解码状态码
+**/
+INT32 iot_decode_jpeg(
+                    CONST char * filename,
+                    T_AMOPENAT_IMAGE_INFO *imageinfo
+                    )
+{
+    return IVTBL(ImgsDecodeJpegBuffer)(filename,imageinfo);
+}
+
+/** 释放jpg格式解码数据
+*@param		buffer: 缓存显示buffer
+*@return	INT32: 释放状态码
+**/
+INT32 iot_free_jpeg_decodedata(
+                    INT16* buffer
+                    )
+{
+    return IVTBL(ImgsFreeJpegDecodedata)((UINT16*)buffer);
+}
+    
+

+ 337 - 0
bsp/air724/sdk/api/src/iot_network.c

@@ -0,0 +1,337 @@
+#include "string.h"
+#include <stdio.h>
+#include "at_process.h"
+#include "at_tok.h"
+#include "iot_debug.h"
+#include "iot_network.h"
+
+static F_OPENAT_NETWORK_IND_CB g_s_gsmStatusCb = NULL;
+static unsigned char g_s_nwMode = 0;
+static E_OPENAT_NETWORK_STATE nw_old_state = OPENAT_NETWORK_DISCONNECT;
+static unsigned char at_init_flag=0;
+
+static void gsmStatusCb( int status);
+
+
+
+
+static BOOL iot_network_get_SYSINFO(int* srv_status,int*sys_mode,int*sim_state)
+{
+    ATResponse *p_response = NULL;
+    bool result = FALSE;  
+    int err = at_send_command_singleline("AT^SYSINFO", "^SYSINFO:", &p_response);
+    if (err < 0 || p_response->success == 0)
+    {
+        iot_debug_print("[iot_network] at_send_command_singleline error %d",__LINE__);
+        goto end;
+    }
+    char* line = p_response->p_intermediates->line;  
+    err = at_tok_start(&line);
+    if (err < 0)
+        goto end;
+    err = at_tok_nextint(&line,srv_status);
+    if (err < 0)
+        goto end;
+    int temp=0;
+    err = at_tok_nextint(&line,&temp);
+    if (err < 0)
+        goto end;
+    err = at_tok_nextint(&line,&temp);
+    if (err < 0)
+        goto end;
+    err = at_tok_nextint(&line,sys_mode);
+    if (err < 0)
+        goto end;
+    err = at_tok_nextint(&line,sim_state);
+    if (err < 0)
+        goto end;
+    result = TRUE;
+end:              
+    if(p_response!=NULL)
+    {
+        at_response_free(p_response);
+        p_response=NULL;
+    }  
+    return result;
+}
+
+
+static BOOL iot_network_get_CSQ(int* rssi)
+{
+
+    ATResponse *p_response = NULL;
+    bool result = FALSE;  
+    int err = at_send_command_singleline("AT+CSQ", "+CSQ:", &p_response);
+    if (err < 0 || p_response->success == 0)
+        goto end;
+    char* line = p_response->p_intermediates->line;  
+    err = at_tok_start(&line);
+    if (err < 0)
+        goto end;
+    err = at_tok_nextint(&line,rssi);
+    if (err < 0)
+        goto end; 
+    result = TRUE;  
+end:              
+    if(p_response!=NULL)
+    {
+        at_response_free(p_response);
+        p_response=NULL;
+    }  
+    return result;
+}
+
+/**获取网络状态
+*@param     status:   返回网络状态
+*@return    TRUE:    成功
+            FLASE:   失败            
+**/                                
+BOOL iot_network_get_status(T_OPENAT_NETWORK_STATUS* status)
+{
+    if(at_init_flag==0)
+    {
+        at_init();
+        at_init_flag=1;
+    }
+
+
+    int rssi=0;
+    if(iot_network_get_CSQ(&rssi)==FALSE)
+    {
+        iot_debug_print("[iot_network] iot_network_get_CSQ error %d",__LINE__);
+        return FALSE;
+    }
+    status->csq=rssi;
+    //iot_debug_print("[iot_network] rssi:%d",rssi);   
+
+
+    int srv_status=0,sys_mode=0,sim_state=0;
+    if(iot_network_get_SYSINFO(&srv_status,&sys_mode,&sim_state)==FALSE)
+    {
+        iot_debug_print("[iot_network] iot_network_get_SYSINFO error %d",__LINE__);
+        return FALSE;
+    }
+    if(sim_state!=1)
+    {
+        status->state=OPENAT_NETWORK_DISCONNECT;
+        goto end;
+    }
+    if(srv_status!=2)
+    {
+        status->state=OPENAT_NETWORK_DISCONNECT;
+        goto end;
+    }
+    if(sys_mode!=17)
+    {
+        status->state=OPENAT_NETWORK_READY;
+        goto end;
+    }
+
+    status->state=OPENAT_NETWORK_LINKED;
+
+end:
+    status->simpresent=sim_state;
+    //iot_debug_print("[iot_network] srv_status:%d,sys_mode:%d,sim_state:%d",srv_status, sys_mode, sim_state);
+    return TRUE;  
+}  
+
+static void gsmStatusCb( int status)
+{
+  E_OPENAT_NETWORK_STATE nw_state;
+
+  if(status >= 0x80 && status < 0x90)
+  {
+      //LTE 
+      status = status - 0x80;
+      if(status == 1 || status == 5)
+      {
+          nw_state = OPENAT_NETWORK_READY;
+
+          g_s_nwMode = 4;
+      }
+      else
+      {
+          nw_state = OPENAT_NETWORK_DISCONNECT;
+
+          g_s_nwMode = 0;
+      }
+  }
+  else if(status >= 0x90)
+  {
+      status = status - 0x90;
+      if(status == 1)
+      {
+          nw_state = OPENAT_NETWORK_LINKED;
+      }
+      else
+      {
+          nw_state = OPENAT_NETWORK_GOING_DOWN;
+      }
+  }
+  else
+  {
+      if(status == 1 || status == 5)
+      {
+          nw_state = OPENAT_NETWORK_READY;
+          g_s_nwMode = 2;
+      }
+      else
+      {
+          nw_state = OPENAT_NETWORK_DISCONNECT;
+          g_s_nwMode = 0;  
+      }
+  }
+
+  iot_debug_print("[iot_network] %s old %d new %d", __FUNCTION__, nw_old_state, nw_state);
+
+  if(g_s_gsmStatusCb && nw_old_state != nw_state)
+  {
+    g_s_gsmStatusCb(nw_state);
+    nw_old_state = nw_state;
+  }
+  
+}
+                           
+/**设置网络状态回调函数
+*@param     indCb:   回调函数
+*@return    TRUE:    成功
+            FLASE:   失败
+**/                            
+BOOL iot_network_set_cb(F_OPENAT_NETWORK_IND_CB indCb)
+{
+    if(at_init_flag==0)
+    {    
+        at_init();
+        at_init_flag=1;
+    }
+    at_regNetStatusCb(gsmStatusCb);
+    g_s_gsmStatusCb = indCb;
+}        
+
+
+static bool gsmGprsPDPActive(const char* apn, const char* user, const char* pwd )
+{
+  int err;
+  ATResponse *p_response = NULL;
+  char cmd[64] = {0};
+
+  memset(cmd, 0, 64);
+
+  sprintf(cmd, "AT+CGDCONT=5,IP,%s\r\n",apn);
+            
+  err = at_send_command(cmd, &p_response);
+  iot_debug_print("[iot_network] CGDCONT error %d, success %d", err,(p_response?p_response->success:-1));
+  if (err < 0 || p_response->success == 0){
+    goto error;
+  }
+
+  at_response_free(p_response);
+  
+  memset(cmd, 0, 64);
+  sprintf(cmd, "AT+CGACT=1,5");
+            
+  err = at_send_command(cmd, &p_response);
+  iot_debug_print("[iot_network] CGACT error %d, success %d", err,(p_response?p_response->success:-1));
+  if (err < 0 || p_response->success == 0){
+    goto error;
+  }
+
+  at_response_free(p_response);
+  return TRUE;
+
+error:
+  at_response_free(p_response);
+  return FALSE;
+}
+
+/**建立网络连接,实际为pdp激活流程
+*@param     connectParam:  网络连接参数,需要设置APN,username,passwrd信息
+*@return    TRUE:    成功
+            FLASE:   失败
+@note      该函数为异步函数,返回后不代表网络连接就成功了,indCb会通知上层应用网络连接是否成功,连接成功后会进入OPENAT_NETWORK_LINKED状态
+           创建socket连接之前必须要建立网络连接
+           建立连接之前的状态需要为OPENAT_NETWORK_READY状态,否则会连接失败
+**/                          
+BOOL iot_network_connect(T_OPENAT_NETWORK_CONNECT* connectParam)
+{
+    //1. 等待4G网络准备好
+    if(g_s_nwMode == 4) //4G直接用。默认激活pdp
+    {
+        return TRUE;
+        
+    }
+    else if(g_s_nwMode == 2)//如果是2g,就回去重新激活一路pdp
+    {
+        if(gsmGprsPDPActive(connectParam->apn, connectParam->username, connectParam->password))
+        {
+            return TRUE;
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    else
+    {
+        return FALSE;
+    }
+
+}      
+
+
+
+static bool gsmGprsPDPDeactive(void)
+{
+  int err;
+  ATResponse *p_response = NULL;
+  char cmd[64] = {0};
+  
+  memset(cmd, 0, 64);
+  sprintf(cmd, "AT+CGACT=0,6");
+            
+  err = at_send_command(cmd, &p_response);
+  if (err < 0 || p_response->success == 0){
+    goto error;
+  }
+
+  at_response_free(p_response);
+  return TRUE;
+
+error:
+  at_response_free(p_response);
+  return FALSE;
+}
+
+
+/**断开网络连接,实际为pdp去激活
+*@param     flymode:   暂时不支持,设置为FLASE
+*@return    TRUE:    成功
+            FLASE:   失败
+@note      该函数为异步函数,返回后不代表网络连接立即就断开了,indCb会通知上层应用
+           连接断开后网络状态会回到OPENAT_NETWORK_READY状态
+           此前创建socket连接也会失效,需要close掉
+**/                                        
+BOOL iot_network_disconnect(BOOL flymode)
+{
+    if(g_s_nwMode == 4) //4G
+    {
+        return TRUE;
+    }
+    else if(g_s_nwMode == 2)
+    {
+        if(gsmGprsPDPDeactive())
+        {
+            return TRUE;
+        }
+        else
+        {
+            return FALSE;
+        }
+    }
+    else
+    {
+        return FALSE;
+    }
+    
+}                          
+

+ 489 - 0
bsp/air724/sdk/api/src/iot_os.c

@@ -0,0 +1,489 @@
+#include "iot_os.h"
+#include "am_openat.h"
+#include "am_openat_debug.h"
+
+BOOL g_s_traceflag = FALSE;
+
+/*******************************************
+**                 SYSTEM                 **
+*******************************************/
+
+/**创建线程
+*@note  nPriority值的返回在0-20, 值越大优先级越低
+*@param	pTaskEntry:		线程主函数
+*@param	pParameter:		作为参数传递给线程主函数
+*@param	nStackSize: 	线程栈大小
+*@param	nPriority: 		线程优先级,该参数越大,线程优先级越低
+*@param nCreationFlags: 线程启动标记, 请参考E_AMOPENAT_OS_CREATION_FLAG
+*@param pTaskName: 		线程名称
+*@return	HANDLE: 	创建成功返回线程句柄
+**/
+HANDLE iot_os_create_task(                         
+                            PTASK_MAIN pTaskEntry, 
+                            PVOID pParameter,     
+                            UINT16 nStackSize,      
+                            UINT8 nPriority,        
+                            UINT16 nCreationFlags, 
+                            PCHAR pTaskName         
+                          )
+{
+    HANDLE h = NULL;
+    OPENAT_create_task(&h, pTaskEntry, pParameter, NULL, 
+                nStackSize, nPriority, nCreationFlags, 10, pTaskName);
+    return h;
+}
+             
+/**删除线程
+*@param		hTask:		线程句柄
+*@return	TURE:		删除线程成功
+*			FALSE: 		删除线程失败
+**/	
+BOOL iot_os_delete_task(                           
+                        HANDLE hTask            
+                   )
+{
+    OPENAT_delete_task(hTask);
+	return TRUE;
+}
+
+/**挂起线程
+*@param		hTask:		线程句柄
+*@return	TURE: 		挂起线程成功
+*			FALSE  : 	挂起线程失败
+**/
+BOOL iot_os_suspend_task(                      
+                            HANDLE hTask          
+                        )
+{
+	return IVTBL(suspend_task)(hTask);
+}
+
+/**恢复线程
+*@param		hTask:		线程句柄
+*@return	TURE: 		恢复线程成功
+*			FALSE  : 	恢复线程失败
+**/
+BOOL iot_os_resume_task(                           
+                        HANDLE hTask          
+                   )
+{
+    return IVTBL(resume_task)(hTask);
+}
+
+/**获取当前线程
+*@return	HANDLE:		返回当前线程句柄
+*
+**/		
+HANDLE iot_os_current_task(                         
+                            VOID
+                          )
+{
+    return OPENAT_current_task();
+}
+
+/**获取当前线程创建信息
+*@param		hTask:		线程句柄
+*@param		pTaskInfo:		线程信息存储接口
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_get_task_info(                         
+                            HANDLE hTask,         
+                            T_AMOPENAT_TASK_INFO *pTaskInfo 
+                         )
+{
+    return IVTBL(get_task_info)(hTask, pTaskInfo);
+}
+
+
+
+
+/**获取线程消息
+*@note 会阻塞
+*@param		hTask:		线程句柄
+*@param		ppMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_wait_message(                          
+                        HANDLE hTask,         
+                        PVOID* ppMessage    
+                    )
+{
+    int msgId;
+    return OPENAT_wait_message(hTask, &msgId, ppMessage, 0);
+}
+
+/**发送线程消息
+*@note 添加到消息队列尾部
+*@param		hTask:		线程句柄
+*@param		pMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_send_message(                       
+                        HANDLE hTask,         
+                        PVOID pMessage         
+                    )
+{
+    return OPENAT_send_message(hTask, 0, pMessage, 0);
+}
+
+/**发送高优先级线程消息
+*@note      添加到消息队列头部
+*@param		hTask:		线程句柄
+*@param		pMessage:	存储消息指针
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_send_high_priority_message(          
+                        HANDLE hTask,          
+                        PVOID pMessage         
+                                  )
+{
+    return IVTBL(SendHighPriorityMessage)(hTask, pMessage);
+}
+
+/**检测消息队列中是否有消息
+*@param		hTask:		线程句柄
+*@return	TURE: 		成功
+*			FALSE  : 	失败
+**/
+BOOL iot_os_available_message(                     
+                        HANDLE hTask           
+                         )
+{
+    return IVTBL(available_message)(hTask);
+}
+
+
+/**创建定时器
+*@param		pFunc:			定时器到时处理函数
+*@param		pParameter:		作为参数传递给定时器到时处理函数
+*@return	HANDLE: 		返回定时器句柄
+*			
+**/	
+HANDLE iot_os_create_timer(                        
+                        PTIMER_EXPFUNC pFunc,   
+                        PVOID pParameter        
+                      )
+{
+    return OPENAT_create_timerTask(pFunc, pParameter);
+}
+
+/**启动定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@param		nMillisecondes:		定时器时间
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/
+BOOL iot_os_start_timer(                         
+                        HANDLE hTimer,         
+                        UINT32 nMillisecondes   
+                   )
+{
+    return OPENAT_start_timer(hTimer, nMillisecondes);
+}
+
+/**停止定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/	
+BOOL iot_os_stop_timer(                          
+                        HANDLE hTimer
+                    )
+{
+    return OPENAT_stop_timer(hTimer);
+}
+
+/**删除定时器
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/	
+BOOL iot_os_delete_timer(                         
+                        HANDLE hTimer          
+                    )
+{
+    return OPENAT_delete_timer(hTimer);
+}
+
+/**检查定时器是否已经启动
+*@param		hTimer:				定时器句柄,create_timer接口返回值
+*@return	TURE: 				成功
+*			FALSE  : 			失败
+**/
+BOOL iot_os_available_timer(                      
+                        HANDLE hTimer         
+                       )
+{
+    return IVTBL(available_timer)(hTimer);
+}
+
+/**获取系统时间
+*@param		pDatetime:		存储时间指针
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/	
+BOOL iot_os_get_system_datetime(                   
+                        T_AMOPENAT_SYSTEM_DATETIME* pDatetime
+                       )
+{
+    return OPENAT_get_system_datetime(pDatetime);
+}
+
+/**设置系统时间
+*@param		pDatetime:		存储时间指针
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/	
+BOOL iot_os_set_system_datetime(                   
+                        T_AMOPENAT_SYSTEM_DATETIME* pDatetime
+                       )
+{
+    return OPENAT_set_system_datetime(pDatetime);
+}
+
+/**闹钟初始化接口
+*@param		pConfig:		闹钟配置参数
+*@return	TURE: 			成功
+*			FALSE: 		    失败
+**/
+BOOL iot_os_init_alarm(                                       
+                        T_AMOPENAT_ALARM_CONFIG *pConfig 
+                   )
+{
+    return IVTBL(InitAlarm)(pConfig);
+}
+				   
+/**闹钟设置/删除接口
+*@param		pAlarmSet:		闹钟设置参数
+*@return	TURE: 			成功
+*			FALSE: 		    失败
+**/
+BOOL iot_os_set_alarm(                                        
+                        T_AMOPENAT_ALARM_PARAM *pAlarmSet    
+                   )
+{
+    return IVTBL(SetAlarm)(pAlarmSet);
+}
+
+/**进入临界资源区接口,关闭所有中断
+*@return	HANDLE:    返回临界资源区句柄,
+**/
+HANDLE iot_os_enter_critical_section(            
+                        VOID
+                                )
+{
+    return OPENAT_enter_critical_section(); 
+}
+								
+/**退出临界资源区接口,开启中断
+*@param		hSection:		临界资源区句柄
+**/
+VOID iot_os_exit_critical_section(                
+                        HANDLE hSection       
+                             )
+{
+    OPENAT_exit_critical_section(hSection); 
+}
+
+/**创建信号量接口
+*@param		nInitCount:		信号量数量
+*@return	HANDLE: 	    返回信号量句柄
+**/
+HANDLE iot_os_create_semaphore(                   
+                        UINT32 nInitCount     
+                          )
+{
+    return OPENAT_create_semaphore(nInitCount); 
+}
+
+/**删除信号量接口
+*@param		hSem:		信号量句柄
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_delete_semaphore(                      
+                        HANDLE hSem            
+                        )
+{
+    return OPENAT_delete_semaphore(hSem);  
+}
+
+/**等待信号量接口
+*@param		hSem:		信号量句柄
+*@param		nTimeOut:   等待信号量超时时间,if nTimeOut < 5ms, means forever
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_wait_semaphore(                  
+                        HANDLE hSem,           
+                        UINT32 nTimeOut        
+                      )
+{
+    return OPENAT_wait_semaphore(hSem, nTimeOut);
+}
+
+/**释放信号量接口
+*@param		hSem:		信号量句柄
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_release_semaphore(
+                        HANDLE hSem           
+                         )
+{
+    return OPENAT_release_semaphore(hSem);
+}
+
+/**获取消耗量值
+*@param		hSem:		 信号量句柄
+*@return	nInitCount:  信号量的个数
+**/
+UINT32 iot_os_get_semaphore_value (                  
+                        HANDLE hSem            
+                        )
+{
+    return IVTBL(get_semaphore_value)(hSem);
+}
+
+/**内存申请接口malloc
+*@param		nSize:		 申请的内存大小
+*@return	PVOID:       内存指针
+**/
+PVOID iot_os_malloc(                                
+                        UINT32 nSize           
+               )
+{
+    return OPENAT_malloc(nSize);
+}
+
+/**内存申请接口realloc
+*@param		pMemory:	     内存指针,malloc接口返回值
+*@param		nSize:	     申请的内存大小
+*@return	PVOID:       内存指针
+**/
+PVOID iot_os_realloc(                            
+                        PVOID pMemory,          
+                        UINT32 nSize           
+                )
+{
+    return OPENAT_realloc(pMemory, nSize);
+}
+
+/**内存释放接口
+*@param		pMemory:	     内存指针,malloc接口返回值
+**/
+VOID iot_os_free(                                  
+                        PVOID pMemory          
+            )
+{
+    OPENAT_free(pMemory);
+}
+
+/**获取堆空间大小
+*@param		total:	     总共大小
+*@param   used:        已经使用
+**/
+VOID iot_os_mem_used(                                  
+                        UINT32* total,
+                        UINT32* used   
+            )
+{
+    IVTBL(MemoryUsed)(total, used);
+} 
+
+/**系统睡眠接口
+*@param		nMillisecondes:	     睡眠时间
+*@return	TURE: 		成功
+*			FALSE: 		失败
+**/
+BOOL iot_os_sleep(                                 
+                        UINT32 nMillisecondes  
+             )
+{
+    return OPENAT_sleep(nMillisecondes);
+}
+			 
+/**获取系统tick接口
+*@return	tick_num:   返回系统时间tick值
+**/
+UINT32 iot_os_get_system_tick(                   
+                        VOID
+                         )
+{
+    return OPENAT_get_system_tick();
+}
+
+/**获取随机数接口
+*@return	rand_num:   返回随机数
+**/
+UINT32 iot_os_rand(                                
+                        VOID
+              )
+{
+    return OPENAT_rand();
+}
+
+/**设置随机数种子接口
+*@param		seed:	     随机数种子
+**/
+VOID iot_os_srand(                              
+                        UINT32 seed           
+             )
+{
+    IVTBL(srand)(seed);
+}
+
+/**关机接口
+**/
+VOID iot_os_shut_down(                             
+                        VOID
+                 )
+{
+    IVTBL(shut_down)();
+}
+
+/**重启接口
+**/
+VOID iot_os_restart(                              
+                        VOID
+               )
+{
+    IVTBL(restart)();
+}
+
+/**设置trace打印口
+*@param		port:		0: uart1
+                        1: uart2
+                        2: uart3
+                        3: usb modem
+                        4: usb AP & UART Host口抓log(默认)
+*@return	TURE: 			成功
+*			FALSE  : 		失败
+**/
+BOOL iot_os_set_trace_port(UINT8 port)
+{
+	if((port > OPENAT_TRACE_QTY) || port < 0)
+		return FALSE;
+	if(4 == port)
+	{
+		g_s_traceflag = FALSE;
+		return TRUE;
+	}
+	else
+		g_s_traceflag = TRUE;
+    return IVTBL(set_trace_port)(port,0);
+}
+
+/**获取wifiscan参数接口
+*@param		wifi_info:	wifiscan参数     
+**/
+VOID iot_wifi_scan(OPENAT_wifiScanRequest* wifi_info)
+{
+	return IVTBL(get_wifiinfo)(wifi_info);
+}
+
+

+ 122 - 0
bsp/air724/sdk/api/src/iot_pmd.c

@@ -0,0 +1,122 @@
+#include "iot_pmd.h"
+
+
+/****************************** PMD ******************************/
+
+/**充电初始化
+*@param		chrMode:		充电方式
+*@param		cfg:		    配置信息
+*@param		pPmMessage:		消息回调函数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_pmd_init(     
+                    E_AMOPENAT_PM_CHR_MODE chrMode,    
+                    T_AMOPENAT_PMD_CFG*    cfg,       
+                    PPM_MESSAGE            pPmMessage  
+            )
+{
+    return OPENAT_init_pmd(chrMode, cfg, pPmMessage);
+}
+
+/**获取电池状态
+*@param		batStatus:		电池状态
+**/
+VOID iot_pmd_get_batteryStatus(
+                    T_AMOPENAT_BAT_STATUS* batStatus    
+                     )
+{
+    IVTBL(get_batteryStatus)(batStatus);    
+}
+
+/**获取充电器状态
+*@param		chrStatus:		充电器状态
+**/
+VOID iot_pmd_get_chargerStatus(
+                    T_AMOPENAT_CHARGER_STATUS* chrStatus
+                     )
+{
+    IVTBL(get_chargerStatus)(chrStatus); 
+}
+
+/**查询充电器HW状态接口
+*@return	E_AMOPENAT_CHR_HW_STATUS: 充电器HW状态接口
+**/
+E_AMOPENAT_CHR_HW_STATUS iot_pmd_get_chargerHwStatus(
+                    VOID
+                    )
+{
+    return IVTBL(get_chargerHwStatus)();
+}
+
+/**查询充电器HW状态接口
+*@param		battStatus:		    电池状态
+*@param		battVolt:		    电压值
+*@param		battLevel:		    电压等级
+*@param		chargerStatus:		充电器状态
+*@param		chargeState:		充电状态
+*@return	int:  返回0成功其余失败
+**/
+int iot_pmd_get_chg_param(BOOL *battStatus, u16 *battVolt, u8 *battLevel, BOOL *chargerStatus, u8 *chargeState)
+{
+    return IVTBL(get_chg_param)(battStatus, battVolt, battLevel, chargerStatus, chargeState);
+}
+
+/**正常开机
+*@param		simStartUpMode:		开启SIM卡方式
+*@param		nwStartupMode:		开启协议栈方式
+*@return	TRUE: 	            成功
+*           FALSE:              失败
+**/
+BOOL iot_pmd_poweron_system(        
+                    E_AMOPENAT_STARTUP_MODE simStartUpMode,
+                    E_AMOPENAT_STARTUP_MODE nwStartupMode
+                  )
+{
+    return OPENAT_poweron_system(simStartUpMode, nwStartupMode);
+}
+
+/**正常关机
+*@note 正常关机 包括关闭协议栈和供电
+**/
+VOID iot_pmd_poweroff_system(void)           
+
+{
+    OPENAT_poweroff_system();
+}
+
+/**打开LDO
+*@param		ldo:		    ldo通道
+*@param		level:		    0-7 0:关闭 1~7电压等级
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_pmd_poweron_ldo(                   
+                    E_AMOPENAT_PM_LDO    ldo,
+                    UINT8                level        
+               )
+{
+    return OPENAT_poweron_ldo(ldo, level);
+}
+
+/**进入睡眠
+**/
+VOID iot_pmd_enter_deepsleep(VOID) 
+{
+    OPENAT_enter_deepsleep();
+}
+
+/**退出睡眠
+**/
+VOID iot_pmd_exit_deepsleep(VOID)
+{
+    OPENAT_exit_deepsleep();
+}
+
+/**获取开机原因值
+*@return	E_AMOPENAT_POWERON_REASON: 	   返回开机原因值
+**/
+E_AMOPENAT_POWERON_REASON iot_pmd_get_poweronCasue (void)
+{
+    return OPENAT_get_poweronCause();
+}

+ 550 - 0
bsp/air724/sdk/api/src/iot_socket.c

@@ -0,0 +1,550 @@
+#include "iot_socket.h"
+#include "errno.h"
+extern UINT32 CFW_TcpipGetLastError(void);
+int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
+int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
+int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
+ int lwip_close(int s);
+int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen);
+int lwip_listen(int s, int backlog);
+ssize_t lwip_recv(int s, void *mem, size_t len, int flags);
+ssize_t lwip_recvfrom(int s, void *mem, size_t len, int flags,
+      struct sockaddr *from, socklen_t *fromlen);
+ssize_t lwip_send(int s, const void *dataptr, size_t size, int flags);
+ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
+    const struct sockaddr *to, socklen_t tolen);
+int lwip_socket(int domain, int type, int protocol);
+int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
+                struct timeval *timeout);
+struct hostent *lwip_gethostbyname(const char *name);
+int lwip_ioctl(int s, long cmd, void *argp);
+int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
+int lwip_getaddrinfo(const char *nodename,
+       const char *servname,
+       const struct addrinfo *hints,
+       struct addrinfo **res);
+void lwip_freeaddrinfo(struct addrinfo *ai);
+
+
+
+/**创建socket
+*@param		domain:		仅支持AF_INET (IPV4 网络协议)
+@param		type:		支持SOCK_STREAM/SOCK_DGRAM,分别表示TCP、UDP连接
+@param		protocol:   仅支持0
+
+
+*@return	>=0: 	    socket描述符,用于后续操作
+*           <0:         创建socket失败
+*@note      创建的socket不用后需要用close将其关闭
+**/
+
+int socket(int domain, int type, int protocol)
+{
+    return lwip_socket(domain, type, protocol);
+}
+/**获取域名对应的IP地址
+*@param		name:		域名,例如:www.airm2m.com/www.baidu.com
+*@return	struct hostent 结构体: 该结构体包含了一个DNS域名解析后的ip地址
+*           NULL:  域名解析失败
+**/                       
+struct hostent* gethostbyname(const char *name)
+{
+    return lwip_gethostbyname(name);
+}
+/**关闭socket
+*@param		fd:	调用socket接口返回的socket描述符
+*@return	0:  表示成功
+            -1  表示有错误
+*           
+**/                          
+int close (int fd)
+{
+    return lwip_close(fd);
+}
+/**设置socket的属性
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      level: 支持SOL_SOCKET/IPPROTO_TCP
+@param      optname:  SOL_SOCKET对应optname为 SO_DEBUG/SO_OOBINLINE/SO_SNDTIMEO/SO_RCVTIMEO/SO_RCVBUF/SO_SNDBUF
+                      IPPROTO_TCP对应optname为 SO_TCP_SACKDISABLE/SO_TCP_NODELAY
+@param      optval_p:
+@param      optlen:
+*@return	0:  表示成功
+            <0  表示有错误
+*
+**/          
+
+int setsockopt(int socketfd, 
+                        int level, 
+                        int optname,
+                        void *optval_p, 
+                        openat_socklen_t optlen)
+{
+    return lwip_setsockopt(socketfd, level, optname, optval_p, optlen);
+}                 
+
+/**获取socket的属性
+*@param   socketfd: 调用socket接口返回的socket描述符
+@param      level: 支持SOL_SOCKET/IPPROTO_TCP
+@param      optname:  SOL_SOCKET对应optname为 SO_DEBUG/SO_OOBINLINE/SO_SNDTIMEO/SO_RCVTIMEO/SO_RCVBUF/SO_SNDBUF
+                      IPPROTO_TCP对应optname为 SO_TCP_SACKDISABLE/SO_TCP_NODELAY
+@param      optval_p:
+@param      optlen_p:
+*@return  0:  表示成功
+            <0  表示有错误
+*
+**/          
+
+int getsockopt(int socketfd, 
+                        int level, 
+                        int optname,
+                        void *optval_p, 
+                        openat_socklen_t* optlen_p)
+{
+    return lwip_getsockopt(socketfd, level, optname, optval_p, optlen_p);
+}       
+/**设置socket的本地端口和ip地址,一般针对服务器代码需要设置
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      my_addr:   ip地址和端口,ip一般设置INADDR_ANY
+@param      addrlen:  地址长度
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                         
+int bind(int socketfd, 
+                      const struct openat_sockaddr *my_addr, 
+                      openat_socklen_t addrlen)
+{
+    return lwip_bind(socketfd, my_addr, addrlen);
+}                      
+/**建立和服务器端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      addr:   指定服务器地址和端口
+@param      addrlen:  sizeof(struct openat_sockaddr)
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                                      
+int connect(int socketfd, const struct openat_sockaddr *addr, openat_socklen_t addrlen)
+{
+    return lwip_connect(socketfd, addr, addrlen);
+}
+/**监听socket连接,一般用作服务器监听客户端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      backlog:   0
+*@return	0:  表示成功
+            <0  表示有错误
+*           
+**/                             
+int listen(int socketfd, 
+                       int backlog)
+
+{
+    return lwip_listen(socketfd, backlog);
+}
+/**等待连接,一般用于listen之后等待客户端的连接
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      addr:   返回客户端ip地址和端口
+@param      addrlen: 返回地址长度
+*@return	0:  表示成功
+            <0  表示有错误
+*@note      函数会一直阻塞,知道有客户端连接           
+**/                             
+int accept(int socketfd, 
+                        struct openat_sockaddr *addr, 
+                        openat_socklen_t *addrlen)
+{
+    return lwip_accept(socketfd, addr, addrlen);
+}
+/**接收数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      buf:   用于存放数据的缓存
+@param      len:   buf的长度
+@param      flags: 仅支持MSG_DONTWAIT/MSG_PEEK/MSG_OOB,可以通过或来指定多个标志,一般为0
+
+*@return	>0:  接收到的数据长度
+            =0:  对方已经断开连接
+            <0:  读取错误
+*@note      当flags没有设置MSG_DONTWAIT,该函数会阻塞,直到有数据或者读取超时
+**/                                        
+int recv(int socketfd, 
+                      void *buf, 
+                      size_t len,
+                      int flags)
+{
+    return lwip_recv(socketfd, buf, len, flags);
+}                      
+/**接收指定ip地址发送来的数据,一般用于UDP收取数据
+*@param		sockfd:	调用socket接口返回的socket描述符
+@param      buf:   用于存放数据的缓存
+@param      len:   buf的长度
+@param      flags: 仅支持0
+@param      src_addr: ip地址和端口
+@param      addrlen: sizeof(struct openat_sockaddr)
+
+*@return	>0: 实际收到的数据长度
+            =0:  对方已经断开连接
+            <0:  读取错误
+**/   
+
+int recvfrom(int sockfd, void *buf, size_t len, int flags,
+                    struct openat_sockaddr *src_addr, openat_socklen_t *addrlen)
+{
+    return lwip_recvfrom(sockfd, buf, len, flags, src_addr, addrlen);
+}
+/**发送数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      msg:   数据内容
+@param      len:   数据长度
+@param      flags: 仅支持MSG_DONTWAIT/MSG_OOB,可以通过或来指定多个标志,一般为0
+
+*@return	>=0:  实际发送的长度
+            <0: 发送错误
+**/   
+
+int send(int socketfd,
+                      const void *msg,
+                      size_t len,
+                      int flags)
+{
+    return lwip_send(socketfd, msg, len, flags);
+}                      
+/**发送数据到指定ip地址,一般用于udp发送数据
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      buf:   数据内容
+@param      len:   数据长度
+@param      flags: 仅支持0
+@param      to_p: 指定ip地址和端口号
+@param      tolen: sizeof(struct openat_sockaddr)
+
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+**/                        
+int sendto(int socketfd,
+                        const void *buf,
+                        size_t len,
+                        int flags,
+                        const struct openat_sockaddr *to_p, 
+                        openat_socklen_t tolen)
+{
+    return lwip_sendto(socketfd, buf, len, flags, to_p, tolen);
+}
+/**阻塞方式等待socket连接的状态
+*@param		maxfdp1:	最大socketfd+1
+@param      readset:   读取集合,可以为NULL
+@param      writeset:  写集合,可以为NULL
+@param      exceptset: 异常集合,可以为NULL
+@param      timeout: 超时时间
+
+*@return	0:   等待超时
+            >0:  readset+writeset+exceptset的集合个数
+            <0  -1
+**/                 
+int select(int maxfdp1, 
+                        openat_fd_set *readset,
+                        openat_fd_set *writeset,
+                        openat_fd_set *exceptset,
+                        struct openat_timeval *timeout)
+{
+    return lwip_select(maxfdp1, readset, writeset, exceptset, timeout);
+}
+/**获取socket的错误值
+*@param		socketfd:	调用socket接口返回的socket描述符
+*@return	[EBADF 到 ENO_RECOVERY]
+**/                                       
+int socket_errno(int socketfd)
+{
+    return (int)CFW_TcpipGetLastError();
+}
+
+/**设备驱动程序中设备控制接口
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      cmd:   	指令,如某一个命令对应驱动层的某一个功能
+@param      argp:   可变参数,跟命令有关,传递进入驱动层的参数或者是接收数据的缓存
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+**/
+int	ioctl(int socketfd, long cmd, void *argp)
+{
+	return lwip_ioctl(socketfd, cmd, argp);
+}
+
+/**获取一个描述符的名字
+*@param		socketfd:	调用socket接口返回的socket描述符
+@param      name:   	描述符的名字
+@param      namelen:   	描述符的名字长度
+*@return	0:  表示成功
+            <0  表示有错误
+**/
+int getsockname (int socketfd, struct openat_sockaddr *name, openat_socklen_t *namelen)
+{
+	return lwip_getsockname(socketfd,name,namelen);
+}
+
+/**主机名到地址解析
+*@param		nodename:	一个主机名或者地址串
+@param      servname:   服务名可以是十进制的端口号,也可以是已定义的服务名称
+@param      hints:   	可以是一个空指针,也可以是一个指向某个openat_addrinfo结构体的指针
+@param      res: 		通过res指针参数返回一个指向openat_addrinfo结构体链表的指针
+
+*@return	>=0:  实际发送的长度
+            <0:  发送错误
+*@note      仅仅支持IPv4,且不允许调用者指定所需地址类型的任何信息,
+			返回的结构只包含了用于存储IPv4地址的空间
+**/
+int getaddrinfo(const char *nodename,
+       const char *servname,
+       const struct openat_addrinfo *hints,
+       struct openat_addrinfo **res)
+{
+	return lwip_getaddrinfo(nodename, servname, hints, res);
+}
+
+/**存储空间通过调用freeaddrinfo 返还给系统
+*@param		ai:	指向由getaddrinfo返回的第一个openat_addrinfo结构
+*
+**/
+void freeaddrinfo(struct openat_addrinfo *ai)
+{
+	lwip_freeaddrinfo(ai);
+}
+
+/******************************
+*function: setNetifDns
+*input:
+*       CHAR* dns1, the value string, like 8.8.8.8
+*       CHAR* dns2, the value string, like 8.8.8.8
+*output:
+*       0, if success full
+*       -1, if failed
+********************************/
+
+int setNetifDns(CHAR *dns1, CHAR *dns2)
+{
+	//return IVTBL(setNetifDns)(dns1, dns2);
+	return -1;
+}
+
+/******************************
+*function: getNetifDns
+*input:
+*       CHAR* dns1, the value string, like 8.8.8.8
+*       CHAR* dns2, the value string, like 8.8.8.8
+*output:
+*       0, if success full
+*       -1, if failed
+********************************/
+
+int getNetifDns(CHAR *dns1, CHAR *dns2)
+{
+	//return IVTBL(getNetifDns)(dns1, dns2);
+	return -1;
+}
+
+
+/* Here for now until needed in other places in lwIP */
+#ifndef isprint
+#define in_range(c, lo, up)  ((UINT8)c >= lo && (UINT8)c <= up)
+#define isprint(c)           in_range(c, 0x20, 0x7f)
+#define isdigit(c)           in_range(c, '0', '9')
+#define isxdigit(c)          (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
+#define islower(c)           in_range(c, 'a', 'z')
+#define isspace(c)           (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
+#endif
+
+
+
+/**
+ * Check whether "cp" is a valid ascii representation
+ * of an Internet address and convert to a binary address.
+ * Returns 1 if the address is valid, 0 if not.
+ * This replaces inet_addr, the return value from which
+ * cannot distinguish between failure and a local broadcast address.
+ *
+ * @param cp IP address in ascii represenation (e.g. "127.0.0.1")
+ * @param addr pointer to which to save the ip address in network order
+ * @return 1 if cp could be converted to addr, 0 on failure
+ */
+int
+ipaddr_aton(const char *cp, openat_ip_addr_t *addr)
+{
+  UINT32 val;
+  UINT8 base;
+  char c;
+  UINT32 parts[4];
+  UINT32 *pp = parts;
+
+  c = *cp;
+  for (;;) {
+    /*
+     * Collect number up to ``.''.
+     * Values are specified as for C:
+     * 0x=hex, 0=octal, 1-9=decimal.
+     */
+    if (!isdigit(c))
+      return (0);
+    val = 0;
+    base = 10;
+    if (c == '0') {
+      c = *++cp;
+      if (c == 'x' || c == 'X') {
+        base = 16;
+        c = *++cp;
+      } else
+        base = 8;
+    }
+    for (;;) {
+      if (isdigit(c)) {
+        val = (val * base) + (int)(c - '0');
+        c = *++cp;
+      } else if (base == 16 && isxdigit(c)) {
+        val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A'));
+        c = *++cp;
+      } else
+        break;
+    }
+    if (c == '.') {
+      /*
+       * Internet format:
+       *  a.b.c.d
+       *  a.b.c   (with c treated as 16 bits)
+       *  a.b (with b treated as 24 bits)
+       */
+      if (pp >= parts + 3) {
+        return (0);
+      }
+      *pp++ = val;
+      c = *++cp;
+    } else
+      break;
+  }
+  /*
+   * Check for trailing characters.
+   */
+  if (c != '\0' && !isspace(c)) {
+    return (0);
+  }
+  /*
+   * Concoct the address according to
+   * the number of parts specified.
+   */
+  switch (pp - parts + 1) {
+
+  case 0:
+    return (0);       /* initial nondigit */
+
+  case 1:             /* a -- 32 bits */
+    break;
+
+  case 2:             /* a.b -- 8.24 bits */
+    if (val > 0xffffffUL) {
+      return (0);
+    }
+    val |= parts[0] << 24;
+    break;
+
+  case 3:             /* a.b.c -- 8.8.16 bits */
+    if (val > 0xffff) {
+      return (0);
+    }
+    val |= (parts[0] << 24) | (parts[1] << 16);
+    break;
+
+  case 4:             /* a.b.c.d -- 8.8.8.8 bits */
+    if (val > 0xff) {
+      return (0);
+    }
+    val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+    break;
+  default:
+    return 0;
+    break;
+  }
+  if (addr) {
+    addr->addr = htonl(val);
+  }
+  return (1);
+}
+
+/**
+ * Ascii internet address interpretation routine.
+ * The value returned is in network order.
+ *
+ * @param cp IP address in ascii represenation (e.g. "127.0.0.1")
+ * @return ip address in network order
+ */
+UINT32
+ipaddr_addr(const char *cp)
+{
+  openat_ip_addr_t val;
+
+  if (ipaddr_aton(cp, &val)) {
+    return val.addr;
+  }
+  return (OPENAT_INADDR_NONE);
+}
+
+/**
+ * Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
+ *
+ * @param addr ip address in network order to convert
+ * @param buf target buffer where the string is stored
+ * @param buflen length of buf
+ * @return either pointer to buf which now holds the ASCII
+ *         representation of addr or NULL if buf was too small
+ */
+char *ipaddr_ntoa_r(const openat_ip_addr_t *addr, char *buf, int buflen)
+{
+  UINT32 s_addr;
+  char inv[3];
+  char *rp;
+  UINT8 *ap;
+  UINT8 rem;
+  UINT8 n;
+  UINT8 i;
+  int len = 0;
+
+  s_addr = addr->addr;
+
+  rp = buf;
+  ap = (UINT8 *)&s_addr;
+  for(n = 0; n < 4; n++) {
+    i = 0;
+    do {
+      rem = *ap % (UINT8)10;
+      *ap /= (UINT8)10;
+      inv[i++] = '0' + rem;
+    } while(*ap);
+    while(i--) {
+      if (len++ >= buflen) {
+        return NULL;
+      }
+      *rp++ = inv[i];
+    }
+    if (len++ >= buflen) {
+      return NULL;
+    }
+    *rp++ = '.';
+    ap++;
+  }
+  *--rp = 0;
+  return buf;
+}
+
+/**
+ * Convert numeric IP address into decimal dotted ASCII representation.
+ * returns ptr to static buffer; not reentrant!
+ *
+ * @param addr ip address in network order to convert
+ * @return pointer to a global static (!) buffer that holds the ASCII
+ *         represenation of addr
+ */
+char *
+ipaddr_ntoa(const openat_ip_addr_t *addr)
+{
+  static char str[16];
+  return ipaddr_ntoa_r(addr, str, 16);
+}
+
+
+

+ 78 - 0
bsp/air724/sdk/api/src/iot_spi.c

@@ -0,0 +1,78 @@
+#include "iot_spi.h"
+
+
+/**配置spi
+*@param		port:		SPI 编号
+*@param		cfg:		初始化参数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_spi_open(
+                    E_AMOPENAT_SPI_PORT  port,         
+                    T_AMOPENAT_SPI_PARAM *cfg          
+              )
+{
+    return OPENAT_OpenSPI(port, cfg);
+}
+
+/**读取spi数据
+*@param		port:		SPI 编号
+*@param		buf:		存储数据地址
+*@param		bufLen:		存储空间长度
+*@return	UINT32: 	实际读取长度
+**/
+UINT32 iot_spi_read(                                   
+                    E_AMOPENAT_SPI_PORT port,         
+                    UINT8* buf,                        
+                    UINT32 bufLen                      
+              )
+{
+    return OPENAT_ReadSPI(port, buf, bufLen);
+}
+
+/**写入spi数据
+*@param		port:		SPI 编号
+*@param		buf:		写入数据地址
+*@param		bufLen:		写入数据长度
+*@return	UINT32: 	实际写入长度
+**/
+UINT32 iot_spi_write(                                   
+                    E_AMOPENAT_SPI_PORT port,         
+                    CONST UINT8* buf,                   
+                    UINT32 bufLen                       
+               )
+{
+    return OPENAT_WriteSPI(port, buf, bufLen, 0);
+}
+
+/**spi全双工读写
+*@note      全双工方式读写,读写长度相同
+*@param		port:		SPI 编号
+*@param		txBuf:		写缓冲
+*@param		rxBuf:		读缓冲
+*@param		len:		读写长度
+*@return	UINT32: 	实际写入长度
+**/
+UINT32 iot_spi_rw(                                        
+                    E_AMOPENAT_SPI_PORT port,         
+                    CONST UINT8* txBuf,                
+                    UINT8* rxBuf,                      
+                    UINT32 len                         
+            )
+{
+    return OPENAT_RwSPI(port, txBuf, rxBuf, len);
+}
+
+
+/**关闭spi
+*@param		port:		SPI 编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_spi_close(
+                    E_AMOPENAT_SPI_PORT  port
+            )
+{
+    return OPENAT_CloseSPI(port);
+}
+

+ 76 - 0
bsp/air724/sdk/api/src/iot_sys.c

@@ -0,0 +1,76 @@
+#include "iot_sys.h"
+
+/**远程升级初始化
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_init(void)
+{
+    return openat_otaInit();
+}
+
+/**远程升级下载
+*@param		data:				下载固件包数据
+*@param		len:				下载固件包长度
+*@param		total:				固件包总大小
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_download(const char* data, UINT32 len, UINT32 total)
+{
+    return openat_otaProcess((char*)data, len,total);
+}
+
+/**远程升级
+*@return	0:   表示成功
+*           <0:  表示有错误
+**/
+E_OPENAT_OTA_RESULT iot_fota_done(void)
+{
+    return openat_otaDone();
+}
+
+/**ota设置new core的文件,用来告知底层需要从文件读取升级新的程序
+*@param		newCoreFile:		新程序文件 
+*@return	TRUE: 成功   FALSE: 失败
+*注:newCoreFile文件必须保存在/fota文件夹下,例如newCoreFile 为 "/fota/core.img"
+**/
+BOOL iot_ota_newcore(              
+                    CONST char* newCoreFile
+               )
+{
+    return IVTBL(FlashSetNewCoreRegion)((char*)newCoreFile);
+}
+
+
+/**ota设置new app的文件,用来告知底层需要从文件读取升级新的程序
+*@param		newAPPFile:		新程序文件 
+*@return	TRUE: 成功   FALSE: 失败
+*注:newAPPFile文件必须保存在/fota文件夹下,例如newAPPFile 为 "/fota/app.img"
+**/
+BOOL iot_ota_newapp(              
+                    CONST char* newAPPFile
+               )
+{
+    return IVTBL(FlashSetNewAppRegion)(newAPPFile);
+}
+
+
+/**将char类型转换为WCHAR,结果用来作为iot_fs_open_file等接口的文件名参数
+*@param     dst:        转换输出结果
+*@param     src:        等待转换的字符串
+*@return    返回dst首地址
+**/ 
+WCHAR* iot_strtows(WCHAR* dst, const char* src)
+{
+   WCHAR* rlt = dst;
+   while(*src)
+   {
+       *dst++ = *src++;
+   }
+   *dst = 0;
+   
+   return (rlt);
+}
+
+

+ 51 - 0
bsp/air724/sdk/api/src/iot_tts.c

@@ -0,0 +1,51 @@
+#include "iot_tts.h"
+
+
+/**初始化tts引擎
+*@param		cb:		TTS播放结果回调函数
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_tts_init(
+                    TTS_PLAY_CB cb         
+              )
+{
+    return OPENAT_tts_init(cb);
+}
+
+/**tts播放文本
+*@param		text:		待播放文本
+*@param		len:		文本长度(字节)
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_play(                                   
+                    char *text,u32 len                    
+              )
+{
+    return OPENAT_tts_play(text, len);
+}
+
+/**tts停止播放
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_stop(      )
+{
+    return OPENAT_tts_stop();
+}
+
+/**设置tts配置参数
+*@param		flag:		参数标志
+*@param		value:		参数值
+*@return	TRUE: 	    成功
+			FALSE:      失败
+**/
+BOOL iot_tts_set_param(
+		OPENAT_TTS_PARAM_FLAG flag,u32 value
+		)
+{
+	return OPENAT_tts_set_param(flag,value);
+}
+
+

+ 74 - 0
bsp/air724/sdk/api/src/iot_uart.c

@@ -0,0 +1,74 @@
+#include "iot_uart.h"
+
+/**打开uart
+*@param		port:		UART 编号
+*@param		cfg:		配置信息
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_uart_open(
+                        E_AMOPENAT_UART_PORT port,          
+                        T_AMOPENAT_UART_PARAM *cfg         
+                   )
+{
+    return OPENAT_config_uart(port, cfg);
+}
+
+/**关闭uart
+*@param		port:		UART 编号
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_uart_close(
+                        E_AMOPENAT_UART_PORT port          
+                   )
+{
+    return OPENAT_close_uart(port);
+}
+ 
+/**读uart
+*@param		port:		UART 编号
+*@param		buf:		存储数据地址
+*@param		bufLen:		存储空间长度
+*@param		timeoutMs:	读取超时 ms
+*@return	UINT32:     实际读取长度
+**/
+UINT32 iot_uart_read(                                      
+                        E_AMOPENAT_UART_PORT port,          
+                        UINT8* buf,                       
+                        UINT32 bufLen,                    
+                        UINT32 timeoutMs                   
+                   )
+{
+    return OPENAT_read_uart(port, buf, bufLen, timeoutMs);
+}
+
+/**写uart
+*@param		port:		UART 编号
+*@param		buf:		写入数据地址
+*@param		bufLen:		写入数据长度
+*@return	UINT32:     实际读取长度
+**/
+UINT32 iot_uart_write(                                        
+                        E_AMOPENAT_UART_PORT port,           
+                        UINT8* buf,                         
+                        UINT32 bufLen                     
+                    )
+{
+    return OPENAT_write_uart(port, buf, bufLen);
+}
+
+/**uart接收中断使能
+*@param		port:		UART 编号
+*@param		enable:		是否使能
+*@return	TRUE: 	    成功
+*           FALSE:      失败
+**/
+BOOL iot_uart_enable_rx_int(
+                        E_AMOPENAT_UART_PORT port,          
+                        BOOL enable                       
+                            )
+{
+    //return IVTBL(uart_enable_rx_int)(port, enable);
+    return FALSE;
+}

+ 628 - 0
bsp/air724/sdk/api/src/iot_vat.c

@@ -0,0 +1,628 @@
+#include "string.h"
+#include "iot_debug.h"
+#include "iot_vat.h"
+#include "iot_os.h"
+
+
+typedef struct UrcEntityQueueTag
+{
+    UrcEntity urcEntityArray[URC_QUEUE_COUNT]; 
+    u8 count;                                 
+}UrcEntityQueue;
+
+typedef struct AtCmdEntityQueueTag
+{
+    u8 current;                                 
+    u8 last;                                    
+    u8 funFirst;                                
+    u8 funLast;                                 
+    AtCmdEntity atCmdEntityArray[AT_CMD_QUEUE_COUNT]; 
+
+}AtCmdEntityQueue;
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+
+int initstatus = FALSE;
+static PAT_MESSAGE g_resp_cb = NULL;
+gsmloc_cellinfo GSMLOC_CELL = {0};
+
+static AtCmdEntityQueue s_atCmdEntityQueue={0};
+static AtCmdRsp AtCmdCbDefault(char* pRspStr);   
+static BOOL AtCmdDelayExe(u16 delay);
+static BOOL iot_vat_queue_head_out(VOID);
+static BOOL iot_vat_queue_tail_out(VOID);
+static BOOL iot_vat_queue_fun_out(VOID);
+static VOID iot_vat_queue_init(VOID);
+static BOOL iot_vat_queue_is_empty(VOID);
+static BOOL iot_vat_queue_fun_set(u8 funCount);
+static BOOL iot_vat_queue_append(AtCmdEntity atCmdEntity);
+static BOOL iot_vat_queue_fun_append(AtCmdEntity atCmdEntity[],u8 funCount);
+static VOID iot_vat_SendCMD(VOID);
+static VOID iot_vat_Modeuleinit(VOID);
+
+static AtCmdRsp AtVatCmdCbDefault(char* pRspStr)
+{
+    iot_debug_print("[envelope] AtVatCmdCbDefault");
+    AtCmdRsp  rspValue = AT_RSP_WAIT;
+    char *rspStrTable[ ] = {"OK","ERROR","+CME ERROR"};
+    s16  rspType = -1;
+    u8  i = 0;
+    if(g_resp_cb)
+    {
+        g_resp_cb((UINT8 *)pRspStr, (UINT16)strlen(pRspStr));
+    }
+    char  *p = pRspStr + 2;
+    for (i = 0; i < sizeof(rspStrTable) / sizeof(rspStrTable[0]); i++)
+    {
+        if (!strncmp(rspStrTable[i], p, strlen(rspStrTable[i])))
+        {
+            rspType = i;
+            break;
+        }
+    }
+    switch (rspType)
+    {
+        case 0:  /* OK */
+        case 1:  /* ERROR */
+        case 2:  /* +CME ERROR */
+            rspValue  = AT_RSP_CONTINUE;
+            break;
+        default:
+            break;
+    }
+    return rspValue;
+}
+
+static AtCmdRsp AtCmdCbDefault(char* pRspStr)
+{
+	iot_debug_print("[vat] AtCmdCbDefault");
+    AtCmdRsp  rspValue = AT_RSP_WAIT;
+    char *rspStrTable[ ] = {"OK","ERROR"};
+    s16  rspType = -1;
+    u8  i = 0;
+    char  *p = pRspStr + 2;
+    for (i = 0; i < sizeof(rspStrTable) / sizeof(rspStrTable[0]); i++)
+    {
+        if (!strncmp(rspStrTable[i], p, strlen(rspStrTable[i])))
+        {
+            rspType = i;
+            break;
+        }
+    }
+    switch (rspType)
+    {
+        case 0:  /* OK */
+        rspValue  = AT_RSP_CONTINUE;
+        break;
+
+        case 1:  /* ERROR */
+        rspValue = AT_RSP_ERROR;
+        break;
+
+        default:
+        break;
+    }
+
+    return rspValue;
+}
+    
+static BOOL AtCmdDelayExe(u16 delay)
+{
+	BOOL ret = FALSE;
+	iot_debug_print("[vat]INFO: at cmd delay execute,%d",delay);
+	if (delay == 0){
+		delay = AT_CMD_EXECUTE_DELAY;
+	}
+	ret = iot_os_sleep(delay);
+	iot_vat_SendCMD();
+	return ret;
+}
+
+static VOID iot_vat_queue_init(VOID)
+{
+    u8 i = 0;
+    u8 first = MIN(s_atCmdEntityQueue.current,s_atCmdEntityQueue.funFirst);
+    for ( i=first; i<=s_atCmdEntityQueue.last; i++) {
+        AtCmdEntity* atCmdEnt = NULL;
+        atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[i]);
+        if(atCmdEnt->p_atCmdStr){
+            iot_os_free(atCmdEnt->p_atCmdStr);
+            atCmdEnt->p_atCmdStr = NULL;
+        }
+        atCmdEnt->p_atCmdCallBack = NULL;
+    }
+    memset(&s_atCmdEntityQueue,0,sizeof(AtCmdEntityQueue));
+}
+
+static BOOL iot_vat_queue_head_out(VOID)
+{
+    AtCmdEntity* atCmdEnt = NULL;
+
+   if(s_atCmdEntityQueue.current == s_atCmdEntityQueue.last) /* the queue is empty */
+       return FALSE;
+
+   if(s_atCmdEntityQueue.current>=s_atCmdEntityQueue.funLast
+           || s_atCmdEntityQueue.current<=s_atCmdEntityQueue.funFirst){
+       atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.current]);
+       if(atCmdEnt->p_atCmdStr){
+           iot_os_free(atCmdEnt->p_atCmdStr);
+           atCmdEnt->p_atCmdStr = NULL;
+       }
+       atCmdEnt->p_atCmdCallBack = NULL;
+   }
+   s_atCmdEntityQueue.current = (s_atCmdEntityQueue.current + 1) %  AT_CMD_QUEUE_COUNT;
+   return TRUE;
+}
+
+static BOOL iot_vat_queue_tail_out(VOID)
+{
+    AtCmdEntity* atCmdEnt = NULL;
+    if(s_atCmdEntityQueue.current == s_atCmdEntityQueue.last)
+        return FALSE;
+    s_atCmdEntityQueue.last = (s_atCmdEntityQueue.last + AT_CMD_QUEUE_COUNT - 1) % AT_CMD_QUEUE_COUNT;
+    atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.last]);
+    if(atCmdEnt->p_atCmdStr){
+        iot_os_free(atCmdEnt->p_atCmdStr);
+        atCmdEnt->p_atCmdStr = NULL;
+    }
+    atCmdEnt->p_atCmdCallBack = NULL;
+    return TRUE;
+}
+
+static BOOL iot_vat_queue_fun_out(VOID)
+{
+    u8 i = 0;
+    if (s_atCmdEntityQueue.funLast == 0)        /* no at cmd func */
+        return FALSE;
+
+    if (s_atCmdEntityQueue.funLast < s_atCmdEntityQueue.funFirst)
+	{
+	    for (i = s_atCmdEntityQueue.funFirst; i < AT_CMD_QUEUE_COUNT; i++) 
+		{
+           AtCmdEntity* atCmdEnt = NULL;
+           atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[i]);
+           if(atCmdEnt->p_atCmdStr){
+               iot_os_free(atCmdEnt->p_atCmdStr);
+               atCmdEnt->p_atCmdStr = NULL;
+           }
+           atCmdEnt->p_atCmdCallBack = NULL;
+       }
+	
+	    for (i = 0;i <= s_atCmdEntityQueue.funLast; i++)
+		{
+            AtCmdEntity* atCmdEnt = NULL;
+            atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[i]);
+            if(atCmdEnt->p_atCmdStr){
+                iot_os_free(atCmdEnt->p_atCmdStr);
+                atCmdEnt->p_atCmdStr = NULL;
+            }
+            atCmdEnt->p_atCmdCallBack = NULL;
+        }
+    }
+	else
+	{
+	    for ( i=s_atCmdEntityQueue.funFirst ;i<=s_atCmdEntityQueue.funLast ; i++) {
+	        AtCmdEntity* atCmdEnt = NULL;
+	        atCmdEnt = &(s_atCmdEntityQueue.atCmdEntityArray[i]);
+	        if(atCmdEnt->p_atCmdStr){
+	            iot_os_free(atCmdEnt->p_atCmdStr);
+	            atCmdEnt->p_atCmdStr = NULL;
+	        }
+	        atCmdEnt->p_atCmdCallBack = NULL;
+	    }
+	}
+
+    if(s_atCmdEntityQueue.current != s_atCmdEntityQueue.funLast){
+        s_atCmdEntityQueue.current = s_atCmdEntityQueue.funLast;
+    }
+
+    s_atCmdEntityQueue.current = (s_atCmdEntityQueue.current + 1) % AT_CMD_QUEUE_COUNT;
+    s_atCmdEntityQueue.funLast = 0;
+    s_atCmdEntityQueue.funFirst = 0;
+    return TRUE;
+
+}
+
+static BOOL iot_vat_queue_is_empty(VOID)
+{
+    return (s_atCmdEntityQueue.current == s_atCmdEntityQueue.last);
+}
+
+static BOOL iot_vat_queue_fun_set(u8 funCount)
+{
+    u8 first =  MAX(s_atCmdEntityQueue.current,s_atCmdEntityQueue.funFirst);
+    u8 freeCount = 0;
+	#if 0
+    if (s_atCmdEntityQueue.funLast != s_atCmdEntityQueue.funFirst){
+        iot_debug_print("[vat]ERROR: fun is exist!");
+        return FALSE;                           /* just one func exist */
+    }
+	#endif
+    if(iot_vat_queue_is_empty()){
+        freeCount = AT_CMD_QUEUE_COUNT;
+    }
+    else {
+        freeCount = (first - s_atCmdEntityQueue.last + AT_CMD_QUEUE_COUNT) % AT_CMD_QUEUE_COUNT;
+    }
+    if(funCount > freeCount) {
+        iot_debug_print("[vat]ERROR: the queue is full! %d,%d,%d",first,funCount,freeCount);
+        return FALSE;                           /* the space is poor */
+    }
+
+    s_atCmdEntityQueue.funFirst = s_atCmdEntityQueue.last;
+    s_atCmdEntityQueue.funLast = (s_atCmdEntityQueue.last + funCount - 1 + AT_CMD_QUEUE_COUNT) % AT_CMD_QUEUE_COUNT;
+    iot_debug_print("[vat]INFO: the at cmd func's range is %d-%d", s_atCmdEntityQueue.funFirst, s_atCmdEntityQueue.funLast);
+    return TRUE;
+}
+
+static BOOL iot_vat_queue_append(AtCmdEntity atCmdEntity)
+{
+                                                /* get first index */
+    u8 first =  MAX(s_atCmdEntityQueue.current,s_atCmdEntityQueue.funFirst);
+
+    if (atCmdEntity.p_atCmdStr == NULL){
+        iot_debug_print("[vat]ERROR: at cmd str is null!");
+        return FALSE;
+    }
+
+    if (atCmdEntity.p_atCmdCallBack == NULL)    /* set default callback function */
+        atCmdEntity.p_atCmdCallBack = AtCmdCbDefault;
+
+    if((s_atCmdEntityQueue.last + 1) % AT_CMD_QUEUE_COUNT == first){
+        iot_debug_print("[vat]ERROR: at cmd queue is full!");
+        return FALSE;                           /* the queue is full */
+    }
+    else{
+        char* pAtCmd = NULL; 
+
+        pAtCmd = iot_os_malloc(atCmdEntity.cmdLen+1);
+		pAtCmd[atCmdEntity.cmdLen] = 0;
+        if (!pAtCmd){
+            iot_debug_print("[vat]ERROR: memory alloc error!");
+            return FALSE;
+        }
+
+        memcpy(pAtCmd,atCmdEntity.p_atCmdStr,atCmdEntity.cmdLen);
+        s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.last].cmdLen = atCmdEntity.cmdLen;
+        s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.last].p_atCmdStr = pAtCmd;
+        s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.last].p_atCmdCallBack = atCmdEntity.p_atCmdCallBack;
+        s_atCmdEntityQueue.last = (s_atCmdEntityQueue.last + 1) %  AT_CMD_QUEUE_COUNT;
+	    iot_debug_print("[vat]pAtCmd : %s",pAtCmd);
+        return TRUE;
+    }
+}
+
+static BOOL iot_vat_queue_fun_append(AtCmdEntity atCmdEntity[],u8 funCount)
+{
+    u8 i = 0;
+    BOOL ret = FALSE;
+    ret = iot_vat_queue_fun_set(funCount);
+    if(!ret)
+        return FALSE;
+
+    for ( i=0; i<funCount; i++) {
+        BOOL ret = FALSE;
+        ret = iot_vat_queue_append(atCmdEntity[i]);
+        if (!ret){
+            break;
+        }
+    }
+
+    if(i != funCount){                           /* error is ocur */
+        for ( i=funCount; i > 0; i--) {
+            iot_vat_queue_tail_out();
+        }
+        iot_debug_print("[vat]ERROR: add to queue is error!,%d",funCount);
+        return FALSE;
+    }
+
+    iot_debug_print("[vat]INFO: funFirst:%d  funLast:%d", s_atCmdEntityQueue.funFirst, s_atCmdEntityQueue.funLast);
+    return TRUE;
+}
+
+static int iot_vat_atoi(char* str_p)
+{
+	int i;
+	int num = 0;
+	char* p;
+	p = str_p;
+	int len = strlen(str_p);
+	for(i = 0; i < len; i++)
+	{
+		if(*(p+i) >= '0' && *(p+i)<='9')
+			num = num*10 + STR_TO_INT(*(p+i));
+	}
+	return num;
+}
+/*获取小区和邻小区信息*/
+static VOID GetCellInfo(UINT8 *pData)
+{
+	int cut = 0;
+	char* p = (char *)pData;
+	char buf[50][15] = {0};
+	/*LTE cellinfo*/
+	if(!strncmp((char *)pData, "\r\n+EEMLTESVC:", strlen("\r\n+EEMLTESVC:")))	
+	{
+		p = p + strlen("\r\n+EEMLTESVC:");
+		char* b = strtok(p, ",");
+		while(b != NULL)
+		{
+
+			strcpy(buf[cut], b);
+			cut++;
+			b = strtok(NULL, ",");
+		}
+		GSMLOC_CELL.Cellinfo[0].Mcc = (u16)iot_vat_atoi(buf[0]);
+		GSMLOC_CELL.Cellinfo[0].Mnc = (u16)iot_vat_atoi(buf[2]);
+		GSMLOC_CELL.Cellinfo[0].Lac= (u32)iot_vat_atoi(buf[3]);
+		GSMLOC_CELL.Cellinfo[0].CellId = (u32)iot_vat_atoi(buf[9]);
+		GSMLOC_CELL.Cellinfo[0].rssi = (u16)iot_vat_atoi(buf[14])/3;
+		iot_debug_print("[vat] mcc: %d,  mnc: %d,  lac: %d,  ci: %d,  rssi: %d,",
+			GSMLOC_CELL.Cellinfo[0].Mcc,
+			GSMLOC_CELL.Cellinfo[0].Mnc,
+			GSMLOC_CELL.Cellinfo[0].Lac,
+			GSMLOC_CELL.Cellinfo[0].CellId,
+			GSMLOC_CELL.Cellinfo[0].rssi);
+	}
+	/*UMT cellinfo*/
+	if(!strncmp((char *)pData, "\r\n+EEMUMTSSVC:", strlen("\r\n+EEMUMTSSVC:")))	
+	{
+		UINT16 cellMeasureFlag;
+		UINT16 cellParamFlag;
+		UINT16 offset = 3;
+		p = p + strlen("\r\n+EEMUMTSSVC:");
+		char* b = strtok(p, ",");
+		while(b != NULL)
+		{
+
+			strcpy(buf[cut], b);
+			cut++;
+			b = strtok(NULL, ",");
+		}
+		cellMeasureFlag = (UINT16)iot_vat_atoi(buf[1]);
+		cellParamFlag = (UINT16)iot_vat_atoi(buf[2]);
+		if(cellMeasureFlag != 0)
+		{
+			offset = offset + 2;
+			GSMLOC_CELL.Cellinfo[0].rssi = (u16)iot_vat_atoi(buf[offset])/3;
+			offset = offset + 4;
+		}
+		else
+		{
+			offset = offset + 2;
+			GSMLOC_CELL.Cellinfo[0].rssi = (u16)iot_vat_atoi(buf[offset])/3;
+			offset = offset + 2;
+		}
+		if(cellParamFlag != 0)
+
+		{
+			offset = offset + 3;
+			iot_debug_print("[vat] buf[%d]: %s,  buf[%d]: %s,  buf[%d]: %s,  buf[%d]: %s,",
+				offset, buf[offset],
+				offset+1, buf[offset+1],
+				offset+2, buf[offset+2],
+				offset+3, buf[offset+3]);
+			GSMLOC_CELL.Cellinfo[0].Mcc = (u16)iot_vat_atoi(buf[offset]);
+			GSMLOC_CELL.Cellinfo[0].Mnc = (u16)iot_vat_atoi(buf[offset+1]);
+			GSMLOC_CELL.Cellinfo[0].Lac= (u32)iot_vat_atoi(buf[offset+2]);
+			GSMLOC_CELL.Cellinfo[0].CellId = (u32)iot_vat_atoi(buf[offset+3]);
+		}
+		iot_debug_print("[vat] mcc: %d,  mnc: %d,  lac: %d,  ci: %d,  rssi: %d,",
+			GSMLOC_CELL.Cellinfo[0].Mcc,
+			GSMLOC_CELL.Cellinfo[0].Mnc,
+			GSMLOC_CELL.Cellinfo[0].Lac,
+			GSMLOC_CELL.Cellinfo[0].CellId,
+			GSMLOC_CELL.Cellinfo[0].rssi);
+	}
+	/*GSM curCellInfo*/
+	if(!strncmp((char *)pData, "\r\n+EEMGINFOSVC:", strlen("\r\n+EEMGINFOSVC:")))	
+	{
+		p = p + strlen("\r\n+EEMGINFOSVC:");
+		char* b = strtok(p, ",");
+		while(b != NULL)
+		{
+
+			strcpy(buf[cut], b);
+			cut++;
+			b = strtok(NULL, ",");
+		}
+		GSMLOC_CELL.Cellinfo[0].Mcc = (u16)iot_vat_atoi(buf[0]);
+		GSMLOC_CELL.Cellinfo[0].Mnc = (u16)iot_vat_atoi(buf[1]);
+		GSMLOC_CELL.Cellinfo[0].Lac= (u32)iot_vat_atoi(buf[2]);
+		GSMLOC_CELL.Cellinfo[0].CellId = (u32)iot_vat_atoi(buf[3]);
+		if(iot_vat_atoi(buf[9]) > 31)
+		{
+			GSMLOC_CELL.Cellinfo[0].rssi = 31;
+		}
+		else if(iot_vat_atoi(buf[9]) < 0)
+		{
+			GSMLOC_CELL.Cellinfo[0].rssi = 0;
+		}
+		else
+		{
+			GSMLOC_CELL.Cellinfo[0].rssi = iot_vat_atoi(buf[9]);
+		}
+		iot_debug_print("[vat] mcc: %d,  mnc: %d,  lac: %d,  ci: %d,  rssi: %d,",
+			GSMLOC_CELL.Cellinfo[0].Mcc,
+			GSMLOC_CELL.Cellinfo[0].Mnc,
+			GSMLOC_CELL.Cellinfo[0].Lac,
+			GSMLOC_CELL.Cellinfo[0].CellId,
+			GSMLOC_CELL.Cellinfo[0].rssi);
+	}
+	/*GSM nbrCellInfo*/
+	if(!strncmp((char *)pData, "\r\n+EEMGINFONC:", strlen("\r\n+EEMGINFONC:")))	
+	{
+		p = p + strlen("\r\n+EEMGINFONC:");
+		char* b = (char*)strtok(p, (const char *)',');
+		u8 id = 0;
+		while(b != NULL)
+		{
+
+			strcpy(buf[cut], b);
+			cut++;
+			b = (char*)strtok(NULL, (const char *)',');
+		}
+		id = iot_vat_atoi(buf[0]);
+		GSMLOC_CELL.Cellinfo[id+1].Mcc = (u16)iot_vat_atoi(buf[1]);
+		GSMLOC_CELL.Cellinfo[id+1].Mnc = (u16)iot_vat_atoi(buf[2]);
+		GSMLOC_CELL.Cellinfo[id+1].Lac= (u32)iot_vat_atoi(buf[3]);
+		GSMLOC_CELL.Cellinfo[id+1].CellId = (u32)iot_vat_atoi(buf[5]);
+		GSMLOC_CELL.Cellinfo[id+1].rssi = (u16)iot_vat_atoi(buf[6]);
+		iot_debug_print("[vat] mcc: %d,  mnc: %d,  lac: %d,  ci: %d,  rssi: %d,",
+			GSMLOC_CELL.Cellinfo[id+1].Mcc,
+			GSMLOC_CELL.Cellinfo[id+1].Mnc,
+			GSMLOC_CELL.Cellinfo[id+1].Lac,
+			GSMLOC_CELL.Cellinfo[id+1].CellId,
+			GSMLOC_CELL.Cellinfo[id+1].rssi);
+	}
+}
+static VOID iot_vat_ATCmdIndHandle(UINT8 *pData, UINT16 length)
+{
+    if (length > 0) 
+	{
+		iot_debug_print("[vat] pData : %s , %d", pData, length);
+		
+	    AtCmdRsp atCmdRsp = AT_RSP_ERROR;
+
+	    if (s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.current].p_atCmdCallBack)
+		{
+	        atCmdRsp = s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.current].p_atCmdCallBack((char*)pData);
+
+	        iot_debug_print("[vat]INFO: callback return %d,%d",s_atCmdEntityQueue.current,atCmdRsp);
+	        switch ( atCmdRsp )
+			{
+	            case AT_RSP_ERROR:
+	                iot_debug_print("[vat]ERROR: at cmd execute error, initial at cmd queue!");
+	                iot_vat_queue_init();
+	                break;
+	            case AT_RSP_CONTINUE:	
+	            case AT_RSP_FINISH:	
+	                iot_vat_queue_head_out();
+	                AtCmdDelayExe(0);
+	                break;
+				case AT_RSP_PAUSE:				/*添加暂停执行AT队列命令*/
+					iot_vat_queue_head_out();
+					break;
+	            case AT_RSP_FUN_OVER:	
+	                iot_vat_queue_fun_out();
+	                AtCmdDelayExe(0);
+	                break;
+
+	            case AT_RSP_WAIT:
+	                break;
+
+	            default:	
+	                if(atCmdRsp>=AT_RSP_STEP_MIN && atCmdRsp<=AT_RSP_STEP_MAX) 
+				   {
+	                    s8 step = s_atCmdEntityQueue.current + atCmdRsp - AT_RSP_STEP;
+	                    iot_debug_print("[vat]DEBUG: cur %d,step %d",s_atCmdEntityQueue.current,step);
+					  iot_debug_print("[vat]s_atCmdEntityQueue.funFirst = %d, s_atCmdEntityQueue.funLast = %d",s_atCmdEntityQueue.funFirst, s_atCmdEntityQueue.funLast);
+	                    if(step<=s_atCmdEntityQueue.funLast && step>= s_atCmdEntityQueue.funFirst)
+					  {
+	                        s_atCmdEntityQueue.current = step;
+	                        AtCmdDelayExe(0);
+	                    }
+	                    else
+					  {
+	                        iot_debug_print("[vat]ERROR: return of AtCmdRsp is error!");
+	                    }
+	                }
+	                break;
+	        }
+	    }
+	}
+}
+
+static VOID iot_vat_SendCMD(VOID)
+{
+	char* pCmd = s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.current].p_atCmdStr;
+	u16 len = s_atCmdEntityQueue.atCmdEntityArray[s_atCmdEntityQueue.current].cmdLen;
+	if(pCmd){
+		u16 lenAct = 0;
+		iot_debug_print("[vat]DEBUG:at cmd is:%d,%s,%d",s_atCmdEntityQueue.current,pCmd,len);
+		if (!strncmp((char*)AT_CMD_DELAY, pCmd, strlen((char*)AT_CMD_DELAY))) {  /* delay some seconds to run next cmd */
+			uint32 delay = 0;
+			int i = 0;
+			for(i = 0; i < (len - strlen((char*)AT_CMD_DELAY)); i++)
+			{
+				if(pCmd[strlen((char*)AT_CMD_DELAY)+i]>='0' && pCmd[strlen((char*)AT_CMD_DELAY)+i] <= '9')
+				{
+					delay = delay*10 + STR_TO_INT(pCmd[strlen(AT_CMD_DELAY)+i]);
+				}else
+				{
+					break;
+				}
+			}
+			iot_vat_queue_head_out();
+			AtCmdDelayExe(delay);
+			return;
+		}
+		lenAct = OPENAT_send_at_command((UINT8 *)pCmd,(UINT16)len);
+		if(!lenAct)
+			iot_debug_print("[vat]ERROR: send at cmd error!");
+		else{
+			iot_debug_print("[vat]send at cmd:%s",pCmd);
+		}
+	}
+}
+
+static VOID iot_vat_Modeuleinit(VOID)
+{
+	if(initstatus)
+	{
+		return;
+	}
+	initstatus = TRUE;
+	iot_vat_queue_init();
+	ril_set_cb(iot_vat_ATCmdIndHandle);
+	//OPENAT_init_at(iot_vat_ATCmdIndHandle);	
+}
+
+/**用来批量发送AT命令
+*@param		cmd:  AT命令参数
+*@param   	cmd_count:  AT命令个数
+*@return	TRUE: 成功   FALSE: 失败
+**/
+BOOL iot_vat_push_cmd(AtCmdEntity cmd[],u8 cmd_count)
+{
+	BOOL result = FALSE;
+	iot_vat_Modeuleinit();
+	result = iot_vat_queue_fun_append(cmd,cmd_count);
+    iot_vat_SendCMD();
+    return result;
+}
+
+/**用来设置虚拟AT通道的回调函数
+*@param		vatHandle:  虚拟AT主动上报或者AT命令结果返回的回调函数
+*@return	TRUE: 成功   FALSE: 失败
+**/
+BOOL iot_vat_init(PAT_MESSAGE vatHandle)
+{
+    iot_vat_Modeuleinit();
+    if(vatHandle)
+    {
+        g_resp_cb = vatHandle;
+    }
+    return TRUE;
+}
+
+/**用来发送AT命令
+*@param		cmdStr:  AT命令字符串
+*@param   	cmdLen:  AT命令长度
+*@return	TRUE: 成功   FALSE: 失败
+*@note      注意,AT命令字符串cmdStr中需要包含"\r\n"或者"\r"结尾
+**/
+BOOL iot_vat_send_cmd(UINT8* cmdStr, UINT16 cmdLen)
+{
+    BOOL result = FALSE;
+    AtCmdEntity atCmdInit[]={
+    	{(char *)cmdStr,cmdLen,AtVatCmdCbDefault},
+    };
+    result = iot_vat_queue_fun_append(atCmdInit,sizeof(atCmdInit) / sizeof(atCmdInit[0]));
+    iot_vat_SendCMD();
+    return result;    
+}
+
+

+ 54 - 0
bsp/air724/sdk/api/src/iot_zbar.c

@@ -0,0 +1,54 @@
+#include "am_openat.h"
+#include "iot_zbar.h"
+
+/**解析二维码,返回句柄handle
+*@param		width:		解析图片的宽度
+*@param		height:		解析图片的高度
+*@param		data:		解析图片的数据
+*@param		size:		解析图片数据大小
+*@return	获取句柄handle, 不等于0表示解析成功
+*           
+**/
+int iot_zbar_scannerOpen(int width, int height, int size, unsigned char *data)
+{
+    return IVTBL(zbar_scanner_open)(width, height, size, data);
+}
+
+/**获取解析二维码的数据
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@param		len:		获取数据的长度
+*@return	获取的数据地址
+**/
+char * iot_zbar_getData(int handle, int *len)
+{
+    return IVTBL(zbar_get_data)(handle, len);
+}
+
+/**查看是否还有下一个数据
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return	TRUE:   还有下一个数据
+*			FALSE:  没有下一个数据
+**/
+BOOL iot_zbar_findNextData(int handle)
+{
+    return IVTBL(zbar_find_nextData)(handle);
+}
+
+/**获取当前数据编码的格式
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return	返回的格式类型
+**/
+char * iot_zbar_getType(int handle)
+{
+  return IVTBL(zbar_get_type)(handle);
+}
+
+/**释放句柄
+*@param		handle:		句柄,由iot_zbar_scannerOpen生成
+*@return    void	
+**/
+void iot_zbar_scannerClose(int handle)
+{
+    IVTBL(zbar_scanner_close)(handle);
+}
+

+ 6 - 0
bsp/air724/sdk/app/luatos/CMakeLists.txt

@@ -0,0 +1,6 @@
+file(GLOB SC_FILE *.c)
+if(CONFIG_APPIMG_LOAD_FLASH)
+add_appimg(${target} ${flash_ldscript} ${SC_FILE})
+else(CONFIG_APPIMG_LOAD_FLASH)
+add_appimg(${target} ${file_ldscript} ${SC_FILE})
+endif()

+ 0 - 0
bsp/air724/sdk/app/luatos/luatos_main.c


+ 524 - 0
bsp/air724/sdk/cmake/extension.cmake

@@ -0,0 +1,524 @@
+# Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+# All rights reserved.
+#
+# This software is supplied "AS IS" without any warranties.
+# RDA assumes no responsibility or liability for the use of the software,
+# conveys no license or title under any patent, copyright, or mask work
+# right to the product. RDA reserves the right to make changes in the
+# software without notification.  RDA also make no representation or
+# warranty that such application will be suitable for the specified use
+# without further testing or modification.
+
+function(print arg)
+    message(STATUS "${arg}: ${${arg}}")
+endfunction()
+
+function(target_include_targets target type)
+    foreach(arg ${ARGN})
+        target_include_directories(${target} ${type}
+            $<TARGET_PROPERTY:${arg},INTERFACE_INCLUDE_DIRECTORIES>)
+    endforeach()
+endfunction()
+
+function(include_targets)
+    foreach(arg ${ARGN})
+        include_directories($<TARGET_PROPERTY:${arg},INTERFACE_INCLUDE_DIRECTORIES>)
+    endforeach()
+endfunction()
+
+macro(target_add_revision target)
+    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${target}_revision.c "const char *${target}_build_revision = \"${BUILD_TARGET}-${BUILD_RELEASE_TYPE}-${BUILD_AUTO_REVISION}\";")
+    target_sources(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${target}_revision.c)
+endmacro()
+
+# Link targets with --whole-archive. PUBLIC/PRIVATE is required as parameter,
+# but PRIVATE will be used forcedly.
+function(target_link_whole_archive target signature)
+    target_link_libraries(${target} PRIVATE -Wl,--whole-archive)
+    foreach(arg ${ARGN})
+        target_link_libraries(${target} PRIVATE ${arg})
+    endforeach()
+    target_link_libraries(${target} PRIVATE -Wl,--no-whole-archive)
+endfunction()
+
+# Link targets with --start-group. PUBLIC/PRIVATE is required as parameter,
+# but PRIVATE will be used forcedly.
+function(target_link_group target signature)
+    target_link_libraries(${target} PRIVATE -Wl,--start-group)
+    foreach(arg ${ARGN})
+        target_link_libraries(${target} PRIVATE ${arg})
+    endforeach()
+    target_link_libraries(${target} PRIVATE -Wl,--end-group)
+endfunction()
+
+function(add_subdirectory_if_exist dir)
+    if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
+        if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt)
+            add_subdirectory(${dir})
+        endif()
+    endif()
+endfunction()
+
+function(cpp_only target file)
+    add_library(${target} OBJECT ${file})
+    set_source_files_properties(${file} PROPERTIES LANGUAGE C)
+    target_compile_options(${target} PRIVATE -E -P -x c)
+    foreach(dep ${ARGN})
+        target_include_directories(${target}
+            PRIVATE $<TARGET_PROPERTY:${dep},INTERFACE_INCLUDE_DIRECTORIES>)
+    endforeach()
+    foreach(dep ${ARGN})
+        target_compile_definitions(${target}
+            PRIVATE $<TARGET_PROPERTY:${dep},INTERFACE_COMPILE_DEFINITIONS>)
+    endforeach()
+endfunction()
+
+function(target_incbin target binfile sym)
+    get_filename_component(binpath ${binfile} ABSOLUTE)
+    get_filename_component(binfilename ${binfile} NAME)
+    set(asmfile ${CMAKE_CURRENT_BINARY_DIR}/${binfilename}.S)
+    file(WRITE ${asmfile}
+        ".text\n\
+        .align 2\n\
+        .global ${sym}\n\
+        ${sym}:\n\
+        .incbin \"${binpath}\"\n"
+    )
+    target_sources(${target} PRIVATE ${asmfile})
+    set_source_files_properties(${asmfile} PROPERTIES OBJECT_DEPENDS ${binfile})
+endfunction()
+
+function(target_incbin_size target binfile sym symsize)
+    get_filename_component(binpath ${binfile} ABSOLUTE)
+    get_filename_component(binfilename ${binfile} NAME)
+    set(asmfile ${CMAKE_CURRENT_BINARY_DIR}/${binfilename}.S)
+    file(WRITE ${asmfile}
+        ".text\n\
+        .align 2\n\
+        .global ${sym}\n\
+        ${sym}:\n\
+        .incbin \"${binpath}\"\n\
+        .global ${symsize}\n\
+        ${symsize}:\n\
+        .word .-${sym}\n"
+    )
+    target_sources(${target} PRIVATE ${asmfile})
+    set_source_files_properties(${asmfile} PROPERTIES OBJECT_DEPENDS ${binfile})
+endfunction()
+
+function(add_uimage target ldscript)
+    set(gen_ldscript ${target}_ldscript)
+    set(target_map_file ${out_hex_dir}/${target}.map)
+    set(target_img_file ${out_hex_dir}/${target}.img)
+    cpp_only(${gen_ldscript} ${ldscript} hal)
+    add_executable(${target} ${ARGN})
+    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out_hex_dir})
+    target_link_libraries(${target} PRIVATE -T $<TARGET_OBJECTS:${gen_ldscript}>)
+    target_link_libraries(${target} PRIVATE -Wl,-Map=${target_map_file} -nostdlib -Wl,--gc-sections ${link_cref_option})
+
+    add_custom_command(TARGET ${target} POST_BUILD
+        COMMAND ${cmd_mkuimage} --name "${BUILD_REVISION}-${BUILD_AUTO_REVISION}"
+            $<TARGET_FILE:${target}> ${target_img_file}
+        BYPRODUCTS ${target_img_file} ${target_map_file}
+    )
+endfunction()
+
+macro(pac_init_fdl cmd pac_config)
+    if(CONFIG_SOC_8910)
+        set(${cmd}
+            cfg-init --pname "UIX8910_MODEM" --palias ${BUILD_TARGET}
+                --pversion "8910 MODULE" --version "BP_R1.0.0"
+                --flashtype 1 ${pac_config}
+            cfg-host-fdl -a ${CONFIG_FDL1_IMAGE_START} -s ${CONFIG_FDL1_IMAGE_SIZE}
+                -p ${out_hex_dir}/fdl1.sign.img ${pac_config}
+            cfg-fdl2 -a ${CONFIG_FDL2_IMAGE_START} -s ${CONFIG_FDL2_IMAGE_SIZE}
+                -p ${out_hex_dir}/fdl2.sign.img ${pac_config}
+        )
+    endif()
+    if(CONFIG_SOC_8811)
+        set(${cmd}
+            cfg-init --pname "8811_MODEM" --palias ${BUILD_TARGET}
+                --pversion "8811 MODULE" --version "BP_R1.0.0"
+                --flashtype 0 ${pac_config}
+            cfg-fdl -a ${CONFIG_NORFDL_IMAGE_START} -s ${CONFIG_NORFDL_IMAGE_SIZE}
+                -p ${out_hex_dir}/norfdl.img ${pac_config}
+        )
+    endif()
+endmacro()
+
+macro(pac_nvitem_8910 cmd pac_config)
+    set(${cmd}
+        cfg-nvitem -n "Calibration" -i 0xFFFFFFFF --use 1 --replace 0 --continue 0 --backup 1 ${pac_config}
+        cfg-nvitem -n "GSM Calibration" -i 0x26d --use 1 --replace 0 --continue 1 --backup 1 ${pac_config}
+        cfg-nvitem -n "LTE Calibration" -i 0x26e --use 1 --replace 0 --continue 0 --backup 1 ${pac_config}
+        cfg-nvitem -n "IMEI" -i 0xFFFFFFFF --use 1 --replace 0 --continue 0 --backup 1 ${pac_config}
+    )
+endmacro()
+
+# Build unittest target. Parameters are source files.
+# When PAC is supported, PAC is create with unittest only.
+function(add_unittest target)
+    if((CONFIG_SOC_8910) OR (CONFIG_SOC_6760))
+        add_uimage(${target} ${unittest_ldscript} EXCLUDE_FROM_ALL ${ARGN})
+        add_dependencies(unittests ${target})
+
+        if((CONFIG_SOC_8910) OR (CONFIG_SOC_8811))
+            set(build_target ${target})
+            set(pac_config ${out_hex_dir}/${target}.json)
+            set(pac_file ${out_hex_dir}/${target}.pac)
+            pac_init_fdl(init_fdl ${pac_config})
+
+            execute_process(
+                COMMAND python3 ${pacgen_py} ${init_fdl}
+                    cfg-image -i UNITTEST -a ${CONFIG_APP_FLASH_ADDRESS} -s ${CONFIG_APP_FLASH_SIZE}
+                        -p ${out_hex_dir}/${target}.img ${pac_config}
+                    dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+                OUTPUT_VARIABLE pac_dep
+                OUTPUT_STRIP_TRAILING_WHITESPACE
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+
+            add_custom_command(OUTPUT ${pac_file}
+                COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+                DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+            add_custom_target(${target}_pacgen DEPENDS ${pac_file})
+            add_dependencies(unittests ${target}_pacgen)
+        endif()
+    endif()
+    if ((CONFIG_SOC_8955) OR (CONFIG_SOC_8909))
+        add_flash_lod(${target} ${SOURCE_TOP_DIR}/components/hal/ldscripts/xcpu_flashrun.ld
+            EXCLUDE_FROM_ALL ${ARGN})
+        add_dependencies(${target}_ldscript ${BUILD_TARGET}_bcpu sysrom_for_xcpu)
+        target_include_directories(${target}_ldscript PRIVATE ${out_hex_dir})
+        add_dependencies(unittests ${target})
+    endif()
+endfunction()
+
+function(add_flash_lod target ldscript)
+    set(gen_ldscript ${target}_ldscript)
+    set(target_map_file ${out_hex_dir}/${target}.map)
+    set(target_hex_file ${out_hex_dir}/${target}.hex)
+    set(target_lod_file ${out_hex_dir}/${target}.lod)
+    cpp_only(${gen_ldscript} ${ldscript} hal)
+    add_executable(${target} ${ARGN})
+    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out_hex_dir})
+    target_link_libraries(${target} PRIVATE -T $<TARGET_OBJECTS:${gen_ldscript}>)
+    target_link_libraries(${target} PRIVATE -Wl,-Map=${target_map_file} -nostdlib -Wl,--gc-sections ${link_cref_option})
+
+    add_custom_command(TARGET ${target} POST_BUILD
+        COMMAND ${cmd_elf2lod} $<TARGET_FILE:${target}> ${target_lod_file}
+            --boot --mips
+            --param FLSH_MODEL=${CONFIG_FLASH_MODEL}
+            --param FLASH_SIZE=${CONFIG_FLASH_SIZE}
+            --param RAM_PHY_SIZE=${CONFIG_RAM_SIZE}
+            --param CALIB_BASE=${CONFIG_CALIB_FLASH_OFFSET}
+            --param FACT_SETTINGS_BASE=${CONFIG_FACTORY_FLASH_OFFSET}
+            --param USER_DATA_BASE=${CONFIG_CALIB_FLASH_OFFSET}
+            --param USER_DATA_SIZE=0x0
+        BYPRODUCTS ${target_lod_file} ${target_map_file}
+    )
+endfunction()
+
+function(add_elf target ldscript)
+    set(gen_ldscript ${target}_ldscript)
+    set(target_map_file ${out_hex_dir}/${target}.map)
+    cpp_only(${gen_ldscript} ${ldscript} hal)
+    add_executable(${target} ${ARGN})
+    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out_hex_dir})
+    target_link_libraries(${target} PRIVATE -T $<TARGET_OBJECTS:${gen_ldscript}>)
+    target_link_libraries(${target} PRIVATE -Wl,-Map=${target_map_file} -nostdlib -Wl,--gc-sections ${link_cref_option})
+endfunction()
+
+# Build appimg with specified link script.
+function(add_appimg target ldscript) # <sources> LINK_LIBRARIES <libs>
+    cmake_parse_arguments(MY "" "" "LINK_LIBRARIES" ${ARGN})
+    set(MY_SOURCES ${MY_UNPARSED_ARGUMENTS} ${core_stub_o})
+    set(MY_LINK_LIBRARIES ${MY_LINK_LIBRARIES} ${libc_file_name} ${libm_file_name} ${libgcc_file_name})
+
+    set(gen_ldscript ${target}_ldscript)
+    set(target_map_file ${out_hex_dir}/${target}.map)
+    set(target_img_file ${out_hex_dir}/${target}.img)
+    cpp_only(${gen_ldscript} ${ldscript})
+    add_executable(${target} ${MY_SOURCES})
+    set_source_files_properties(${core_stub_o} PROPERTIES GENERATED on)
+    set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out_hex_dir})
+    target_link_libraries(${target} PRIVATE -T $<TARGET_OBJECTS:${gen_ldscript}>)
+    target_link_libraries(${target} PRIVATE -Wl,-Map=${target_map_file} -nostdlib -Wl,--gc-sections ${link_cref_option})
+    target_link_libraries(${target} PRIVATE ${MY_LINK_LIBRARIES})
+
+    add_custom_command(TARGET ${target} POST_BUILD
+        COMMAND ${cmd_mkappimg} $<TARGET_FILE:${target}> ${target_img_file}
+        BYPRODUCTS ${target_img_file} ${target_map_file}
+    )
+endfunction()
+
+# Build unittest appimg (linked in flash).
+function(add_appimg_unittest target) # <sources> LINK_LIBRARIES <libs>
+    cmake_parse_arguments(MY "" "" "LINK_LIBRARIES" ${ARGN})
+    set(MY_SOURCES EXCLUDE_FROM_ALL ${MY_UNPARSED_ARGUMENTS})
+    set(MY_LINK_LIBRARIES unity ${MY_LINK_LIBRARIES})
+
+    set(ldscript ${SOURCE_TOP_DIR}/components/apploader/pack/app_flashimg.ld)
+    add_appimg(${target} ${ldscript} ${MY_SOURCES} LINK_LIBRARIES ${MY_LINK_LIBRARIES})
+    add_dependencies(unittests ${target})
+
+    if((CONFIG_SOC_8910) OR (CONFIG_SOC_8811))
+        set(pac_config ${out_hex_dir}/${target}.json)
+        set(pac_file ${out_hex_dir}/${target}.pac)
+        pac_init_fdl(init_fdl ${pac_config})
+        execute_process(
+            COMMAND python3 ${pacgen_py} ${init_fdl}
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_config}
+                dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+            OUTPUT_VARIABLE pac_dep
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+
+        add_custom_command(OUTPUT ${pac_file}
+            COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+            DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+        add_custom_target(${target}_pacgen DEPENDS ${pac_file})
+        add_dependencies(unittests ${target}_pacgen)
+    endif()
+endfunction()
+
+# Build example appimg (linked in flash). Parameters are source files.
+function(add_appimg_flash_example target)
+    set(ldscript ${SOURCE_TOP_DIR}/components/apploader/pack/app_flashimg.ld)
+    add_appimg(${target} ${ldscript} EXCLUDE_FROM_ALL ${ARGN})
+    add_dependencies(examples ${target})
+
+    if((CONFIG_SOC_8910) OR (CONFIG_SOC_8811))
+        set(pac_config ${out_hex_dir}/${target}.json)
+        set(pac_file ${out_hex_dir}/${target}.pac)
+        pac_init_fdl(init_fdl ${pac_config})
+        execute_process(
+            COMMAND python3 ${pacgen_py} ${init_fdl}
+                cfg-image -i APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS} -s ${CONFIG_APPIMG_FLASH_SIZE}
+                    -p ${out_hex_dir}/${target}.img ${pac_config}
+                dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+            OUTPUT_VARIABLE pac_dep
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+
+        add_custom_command(OUTPUT ${pac_file}
+            COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+            DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+        add_custom_target(${target}_pacgen DEPENDS ${pac_file})
+        add_dependencies(examples ${target}_pacgen)
+    endif()
+endfunction()
+
+# Build example appimg (linked in file). Parameters are source files.
+function(add_appimg_file_example target)
+    set(ldscript ${SOURCE_TOP_DIR}/components/apploader/pack/app_fileimg.ld)
+    add_appimg(${target} ${ldscript} EXCLUDE_FROM_ALL ${ARGN})
+    add_dependencies(examples ${target})
+
+    if((CONFIG_SOC_8910) OR (CONFIG_SOC_8811))
+        set(pac_config ${out_hex_dir}/${target}.json)
+        set(pac_file ${out_hex_dir}/${target}.pac)
+        pac_init_fdl(init_fdl ${pac_config})
+        execute_process(
+            COMMAND python3 ${pacgen_py} ${init_fdl}
+                cfg-pack-file -i APPIMG -p ${out_hex_dir}/${target}.img
+                    -n ${CONFIG_APPIMG_LOAD_FILE_NAME} ${pac_config}
+                dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+            OUTPUT_VARIABLE pac_dep
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+
+        add_custom_command(OUTPUT ${pac_file}
+            COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+            DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+            WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+        )
+        add_custom_target(${target}_pacgen DEPENDS ${pac_file})
+        add_dependencies(examples ${target}_pacgen)
+    endif()
+endfunction()
+
+# Build appimg (flash and file) pac to delete appimg.
+function(add_appimg_delete)
+    if((CONFIG_SOC_8910) OR (CONFIG_SOC_8811))
+        if(CONFIG_APPIMG_LOAD_FLASH)
+            set(target appimg_flash_delete)
+            set(pac_config ${out_hex_dir}/${target}.json)
+            set(pac_file ${out_hex_dir}/${target}.pac)
+            pac_init_fdl(init_fdl ${pac_config})
+            execute_process(
+                COMMAND python3 ${pacgen_py} ${init_fdl}
+                    cfg-erase-flash -i ERASE_APPIMG -a ${CONFIG_APPIMG_FLASH_ADDRESS}
+                        -s ${CONFIG_APPIMG_FLASH_SIZE} ${pac_config}
+                    dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+                OUTPUT_VARIABLE pac_dep
+                OUTPUT_STRIP_TRAILING_WHITESPACE
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+
+            add_custom_command(OUTPUT ${pac_file}
+                COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+                DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+            add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
+        endif()
+
+        if(CONFIG_APPIMG_LOAD_FILE)
+            set(target appimg_file_delete)
+            set(pac_config ${out_hex_dir}/${target}.json)
+            set(pac_file ${out_hex_dir}/${target}.pac)
+            pac_init_fdl(init_fdl ${pac_config})
+            execute_process(
+                COMMAND python3 ${pacgen_py} ${init_fdl}
+                    cfg-del-appimg -i DEL_APPIMG ${pac_config}
+                    dep-gen --base ${SOURCE_TOP_DIR} ${pac_config}
+                OUTPUT_VARIABLE pac_dep
+                OUTPUT_STRIP_TRAILING_WHITESPACE
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+
+            add_custom_command(OUTPUT ${pac_file}
+                COMMAND python3 ${pacgen_py} pac-gen ${pac_config} ${pac_file}
+                DEPENDS ${pacgen_py} ${pac_config} ${pac_dep}
+                WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+            )
+            add_custom_target(${target}_pacgen ALL DEPENDS ${pac_file})
+        endif()
+    endif()
+endfunction()
+
+macro(relative_glob var)
+    file(GLOB ${var} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARGN})
+endmacro()
+
+function(beautify_c_code target)
+    if(ARGN)
+        set(beautify_target beautify_${target})
+        if(NOT TARGET ${beautify_target})
+            add_custom_target(${beautify_target})
+            add_dependencies(beautify ${beautify_target})
+        endif()
+        add_custom_command(TARGET ${beautify_target} POST_BUILD
+            COMMAND clang-format -i ${ARGN}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+    endif()
+endfunction()
+
+function(rpcstubgen xml sender receiver)
+    get_filename_component(name ${xml} NAME_WE)
+    configure_file(${xml} ${out_rpc_dir}/${name}.xml)
+    set(gen ${out_rpc_dir}/${name}_${sender}.c
+        ${out_rpc_dir}/${name}_${receiver}.c
+        ${out_rpc_dir}/${name}_api.h
+        ${out_rpc_dir}/${name}_par.h)
+    add_custom_command(
+        OUTPUT ${gen}
+        COMMAND python3 ${tools_dir}/rpcgen.py stubgen ${xml}
+        DEPENDS ${xml} ${tools_dir}/rpcgen.py
+        WORKING_DIRECTORY ${out_rpc_dir}
+    )
+    add_custom_target(${name}_rpcgen DEPENDS ${gen})
+    add_dependencies(rpcgen ${name}_rpcgen)
+endfunction()
+
+function(rpcdispatchgen cfile side)
+    get_filename_component(name ${cfile} NAME_WE)
+    set(xmls)
+    foreach(xml ${ARGN})
+        list(APPEND xmls ${out_rpc_dir}/${xml})
+    endforeach()
+    add_custom_command(
+        OUTPUT ${out_rpc_dir}/${cfile}
+        COMMAND python3 ${tools_dir}/rpcgen.py dispatchgen ${cfile} ${side} ${xmls}
+        DEPENDS ${tools_dir}/rpcgen.py ${xmls}
+        WORKING_DIRECTORY ${out_rpc_dir}
+    )
+    add_custom_target(${name}_rpcgen DEPENDS ${out_rpc_dir}/${cfile})
+    add_dependencies(rpcgen ${name}_rpcgen)
+endfunction()
+
+function(nanopbgen)
+    foreach(file ${ARGN})
+        get_filename_component(name ${file} NAME_WE)
+        get_filename_component(fpath ${file} DIRECTORY)
+        add_custom_command(
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.pb.h ${CMAKE_CURRENT_BINARY_DIR}/${name}.pb.c
+            COMMAND protoc --proto_path=${fpath} --nanopb_out=${CMAKE_CURRENT_BINARY_DIR} ${file}
+            DEPENDS ${file}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        )
+    endforeach(file ${ARGN})
+endfunction()
+
+macro(config_nvm_variant_8910 nvmvariant modembin_dir nvmprj)
+    set(NVM_VARIANT_${nvmvariant}_MODEMBIN_DIR ${modembin_dir})
+    set(NVM_VARIANT_${nvmvariant}_NVMITEM ${nvmprj})
+    set(NVM_VARIANT_${nvmvariant}_NVMPRJ ${modembin_dir}/${nvmprj}/nvitem_modem.prj)
+endmacro()
+
+function(build_modem_image nvmvariant)
+    set(modembin_dir ${NVM_VARIANT_${nvmvariant}_MODEMBIN_DIR})
+    set(modemgen_dir ${BINARY_TOP_DIR}/modemgen/${nvmvariant})
+    set(modem_img ${out_hex_dir}/${nvmvariant}.img)
+    set(nvitem_bin ${out_hex_dir}/${nvmvariant}_nvitem.bin)
+    file(GLOB modembins ${modembin_dir}/*.bin)
+
+    add_custom_command(OUTPUT ${modem_img}
+        COMMAND python3 ${modemgen_py} --config ${CONFIG_MODEM_CONFIG_JSON_PATH}
+            --partinfo ${CONFIG_PARTINFO_JSON_PATH}
+            --bindir ${modembin_dir}
+            --gendir ${modemgen_dir}
+            --nvbin ${nvitem_bin}
+            --img ${modem_img}
+        DEPENDS ${modemgen_py} ${modembins} ${nvitem_bin}
+        WORKING_DIRECTORY ${SOURCE_TOP_DIR}
+    )
+    add_custom_target(${nvmvariant}_gen ALL DEPENDS ${modem_img})
+endfunction()
+
+function(release_lib target)
+    add_custom_command(OUTPUT ${out_rel_dir}/${target}.o
+        COMMAND ${CMAKE_LINKER} ${partial_link_options} -r --whole-archive
+            $<TARGET_FILE:${target}> -o ${out_rel_dir}/${target}.o
+        DEPENDS $<TARGET_FILE:${target}>
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+endfunction()
+
+function(release_lib_with_symbols target symbols)
+    add_custom_command(OUTPUT ${out_rel_dir}/${target}.o
+        COMMAND ${CMAKE_LINKER} ${partial_link_options} -r --whole-archive
+            $<TARGET_FILE:${target}> -o ${target}_rel.o
+        COMMAND ${CMAKE_OBJCOPY} --keep-global-symbols=${CMAKE_CURRENT_SOURCE_DIR}/${symbols} ${target}_rel.o ${out_rel_dir}/${target}.o
+        DEPENDS $<TARGET_FILE:${target}> ${CMAKE_CURRENT_SOURCE_DIR}/${symbols}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+endfunction()
+
+function(rom_for_xcpu_gen rom_elf rom_sym_rename rom_sym_global)
+    set(rom_for_xcpu_elf ${out_hex_dir}/sysrom_for_xcpu.elf)
+    set(rom_for_xcpu_ld ${out_hex_dir}/sysrom_for_xcpu.ld)
+    add_custom_command(OUTPUT ${rom_for_xcpu_elf}
+        COMMAND ${CMAKE_OBJCOPY} --redefine-syms ${rom_sym_rename}
+            --keep-global-symbols ${rom_sym_global}
+            ${rom_elf} ${rom_for_xcpu_elf}
+        DEPENDS ${rom_elf} ${rom_sym_rename} ${rom_sym_global}
+    )
+    add_custom_command(OUTPUT ${rom_for_xcpu_ld}
+        COMMAND python3 ${elf2incld_py} --cross ${CROSS_COMPILE}
+            ${rom_for_xcpu_elf} ${rom_for_xcpu_ld}
+        DEPENDS ${elf2incld_py} ${rom_for_xcpu_elf}
+    )
+    add_custom_target(sysrom_for_xcpu DEPENDS ${rom_for_xcpu_elf} ${rom_for_xcpu_ld})
+endfunction()

+ 85 - 0
bsp/air724/sdk/cmake/toolchain-gcc.cmake

@@ -0,0 +1,85 @@
+# Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+# All rights reserved.
+#
+# This software is supplied "AS IS" without any warranties.
+# RDA assumes no responsibility or liability for the use of the software,
+# conveys no license or title under any patent, copyright, or mask work
+# right to the product. RDA reserves the right to make changes in the
+# software without notification.  RDA also make no representation or
+# warranty that such application will be suitable for the specified use
+# without further testing or modification.
+
+# Configures CMake for using GCC
+
+set(CMAKE_SYSTEM_NAME           Generic)
+find_program(CMAKE_C_COMPILER   ${CROSS_COMPILE}gcc)
+find_program(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++)
+find_program(CMAKE_READELF      ${CROSS_COMPILE}readelf)
+
+set(CMAKE_EXECUTABLE_SUFFIX_ASM .elf)
+set(CMAKE_EXECUTABLE_SUFFIX_C .elf)
+set(CMAKE_EXECUTABLE_SUFFIX_CXX .elf)
+
+if(CONFIG_CPU_ARM_CA5)
+    set(abi_options -mcpu=cortex-a5 -mtune=generic-armv7-a -mthumb -mfpu=neon-vfpv4
+        -mfloat-abi=hard -mno-unaligned-access)
+    set(partial_link_options)
+    set(libc_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/armca5/libc.a)
+    set(libm_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/armca5/libm.a)
+endif()
+
+if(CONFIG_CPU_ARM_CM4F)
+    set(abi_options -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfpu=fpv4-sp-d16
+        -mfloat-abi=hard -mno-unaligned-access)
+    set(partial_link_options)
+    set(libc_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/armcm4f/libc.a)
+    set(libm_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/armcm4f/libm.a)
+endif()
+
+if(CONFIG_CPU_MIPS_XCPU)
+    set(abi_options -march=xcpu -mtune=xcpu -EL -mips16 -msoft-float -mno-gpopt -G0
+        -mdisable-save-restore)
+    set(partial_link_options -EL)
+    set(libc_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/xcpu/libc.a)
+    set(libm_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/xcpu/libm.a)
+endif()
+
+if(CONFIG_CPU_MIPS_XCPU2)
+    set(abi_options -march=xcpu2 -mtune=xcpu2 -EL -mips16 -msoft-float -mno-gpopt -G0)
+    set(partial_link_options -EL)
+    set(libc_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/xcpu2/libc.a)
+    set(libm_file_name ${CMAKE_CURRENT_SOURCE_DIR}/components/newlib/xcpu2/libm.a)
+endif()
+
+function(add_subdirectory_if_exist dir)
+    if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
+        if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt)
+            add_subdirectory(${dir})
+		endif()
+    endif()
+endfunction()
+
+add_compile_options(${abi_options} -g -Os
+    -Wall
+    -fno-strict-aliasing
+    -ffunction-sections -fdata-sections
+)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions -fno-rtti -fno-threadsafe-statics")
+
+# GNU ar will alreay create index
+set(CMAKE_C_ARCHIVE_FINISH "")
+set(CMAKE_CXX_ARCHIVE_FINISH "")
+
+if(WITH_WERROR)
+    add_compile_options(-Werror)
+endif()
+
+if(WITH_LINK_CREF)
+    set(link_cref_option -Wl,-cref)
+endif()
+
+execute_process(COMMAND ${CMAKE_C_COMPILER} ${abi_options} --print-file-name libgcc.a
+    OUTPUT_VARIABLE libgcc_file_name
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+)

+ 62 - 0
bsp/air724/sdk/components/include/app_config.h

@@ -0,0 +1,62 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _APP_CONFIG_H_
+#define _APP_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether to start AT engine
+ */
+#define CONFIG_APP_START_ATR
+
+/**
+ * whether to enable watchdog
+ *
+ * By default, watchdog will be enabled when \p BUILD_RELEASE_TYPE is
+ * "release".
+ */
+#define CONFIG_WDT_ENABLE
+
+/**
+ * Application watchdog max feed interval (ms)
+ */
+#define CONFIG_APP_WDT_MAX_INTERVAL 20000
+
+/**
+ * Application watchdog normal feed interval (ms)
+ */
+#define CONFIG_APP_WDT_FEED_INTERVAL 4000
+
+/**
+ * Whether to support softsim hot plug
+ */
+/* #undef CONFIG_APP_SSIM_SUPPORT */
+
+/* #undef CONFIG_BUILD_AT */
+
+/*
+*\NEW zhuwangbin 2020.3.20 add poc
+*/
+/* #undef CONFIG_POC_SUPPORT */
+
+
+/*+new\rww\2020.4.30\lua tts float空间不足*/
+/* #undef CONFIG_BUILD_LUA_TTS */
+
+
+/* #undef CONFIG_BUILD_LUA_FLOAT */
+/*-new\rww\2020.4.30\lua tts float空间不足*/
+
+
+#endif

+ 281 - 0
bsp/air724/sdk/components/include/atr_config.h

@@ -0,0 +1,281 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _ATR_CONFIG_H_
+#define _ATR_CONFIG_H_
+
+#include "srv_config.h"
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * maximum AT command parameter count
+ */
+#define CONFIG_ATR_CMD_PARAM_MAX 24
+
+/**
+ * maximum AT command line size
+ *
+ * The trailing \r is included, and \0 is not included.
+ */
+#define CONFIG_ATR_CMDLINE_MAX 1024
+
+/**
+ * AT command engine worker thread stack size in bytes
+ */
+#define CONFIG_ATR_CMD_WORKER_STACK_SIZE 2048
+
+/**
+ * whether AT command URC buffer is enabled
+ *
+ * When enabled, URC will be buffered when there are AT commands in
+ * execution. And URC buffer will be flushed after current AT command
+ * finished. When there are too many URC, either size overflow or count
+ * overflow, URC will be discarded.
+ */
+#define CONFIG_ATR_URC_BUFF_ENABLE
+
+/**
+ * AT command URC buffer size
+ *
+ * Each AT channel will have separated URC buffer, this is the buffer size
+ * for each AT channel.
+ */
+#define CONFIG_ATR_URC_BUFF_SIZE 2048
+
+/**
+ * AT command URC buffering count
+ *
+ * Each AT channel will have separated URC buffer, this is the count
+ * for each AT channel.
+ */
+#define CONFIG_ATR_URC_BUFF_COUNT 32
+
+/**
+ * whether to echo command only
+ *
+ * When defined, extra or invalid chracters not belongs to valid AT command
+ * line won't be echoed. For example, "AT\r\n" will be echoed as "AT\r" if
+ * defined.
+ */
+/* #undef CONFIG_ATR_ECHO_COMMAND_ONLY */
+
+/**
+ * timeout in milliseconds to wait '\n' after '\r'
+ *
+ * It only take effects when \p CONFIG_ATR_ECHO_COMMAND_ONLY is not defined,
+ * and only affects echo.
+ *
+ * Though '\r' is the ending character of AT comamnd line, if '\n' comes
+ * immediately after '\r', '\n' is echoed before responses.
+ */
+#define CONFIG_ATR_LF_WAIT_MS 20
+
+/**
+ * whether enable AT command output cache
+ *
+ * When enabled, a small cache will be added to AT command output. It will
+ * make it easier to parse AT command response.
+ */
+#define CONFIG_ATR_CMD_OUTPUT_CACHE_ENABLE
+
+/**
+ * AT command output cache
+ *
+ * There is only one global AT command output. This is the cache size.
+ */
+#define CONFIG_ATR_CMD_OUTPUT_CACHE_SIZE 1024
+
+/**
+ * data mode buffer size
+ *
+ * In PPP mode, it should be enough to hold a complete packet, with HDLC
+ * escape.
+ */
+#define CONFIG_ATR_DATA_BUFF_SIZE 4096
+
+/**
+ * PPP packet check timeout after PPP end
+ *
+ * After PPP terminated, it is possible that peer will still send more PPP
+ * packets. If they are interpreted as AT commands, it is possible some "bad"
+ * commands will be interpreted.
+ */
+#define CONFIG_ATR_PPP_END_CHECK_TIMEOUT 1000
+
+/**
+ * whether CMUX is supported
+ */
+#define CONFIG_ATR_CMUX_SUPPORT
+
+/**
+ * CMUX input buffer size
+ *
+ * It should be enough to hold the input packet. At buffer overflow, the
+ * content of the buffer will be dropped silently.
+ */
+#define CONFIG_ATR_CMUX_IN_BUFF_SIZE 4096
+
+/**
+ * CMUX output buffer size
+ *
+ * It should be enough to hold the output packet. At buffer overflow, the
+ * content of the buffer will be dropped silently.
+ */
+#define CONFIG_ATR_CMUX_OUT_BUFF_SIZE 4096
+
+/**
+ * CMUX sub-channel minimum input buffer size
+ */
+#define CONFIG_ATR_CMUX_SUBCHANNEL_MIN_IN_BUFF_SIZE 64
+
+/**
+ * CMUX maximum DLC number
+ */
+#define CONFIG_ATR_CMUX_DLC_NUM 63
+
+/**
+ * AT profile count
+ */
+#define CONFIG_ATR_PROFILE_COUNT 2
+
+/**
+ * maximum count of delay free memory
+ */
+#define CONFIG_ATR_MEM_FREE_LATER_COUNT 16
+
+/**
+ * whether to enable CINIT URC output
+ */
+/* #undef CONFIG_ATR_CINIT_URC_ENABLED */
+
+/**
+ * maximum registered event count
+ */
+#define CONFIG_ATR_EVENT_MAX_COUNT 200
+
+/**
+ * maximum pending CFW UTI count
+ */
+#define CONFIG_ATR_CFW_PENDING_UTI_COUNT 64
+
+/**
+ * whether to create uart AT device
+ */
+/* #undef CONFIG_ATR_CREATE_UART */
+
+/**
+ * default uart AT device name
+ */
+#define CONFIG_ATR_DEFAULT_UART DRV_NAME_UART1
+
+/**
+ * default uart baud rate
+ */
+#define CONFIG_ATR_DEFAULT_UART_BAUD 115200
+
+/**
+ * uart auto sleep timeout
+ */
+#define CONFIG_ATR_UART_AUTO_SLEEP_TIMEOUT 500
+
+/**
+ * whether to power on CFW automatically
+ *
+ * When not defined, AT engine will wait \p EV_DM_POWER_ON_IND.
+ */
+#define CONFIG_ATR_CFW_AUTO_POWER_ON
+
+/**
+ * whether to create usb serial AT device
+ */
+#define CONFIG_ATR_CREATE_USB_SERIAL
+
+/**
+ * whether to create diag AT device
+ */
+#define CONFIG_ATR_CREATE_DIAG
+
+/**
+ * whether to combine all AT configuration into one file
+ */
+/* #undef CONFIG_ATR_CFG_IN_ONE_FILE */
+
+/**
+ * whether to support file system AT commands
+ */
+/* #undef CONFIG_ATS_FS_SUPPORT */
+
+/**
+ * maximum download (write) file size
+ */
+/* #undef CONFIG_ATS_FS_DWN_SIZE_MAX */
+
+/**
+ * maximum read file size
+ */
+/* #undef CONFIG_ATS_FS_RD_SIZE_MAX */
+
+/**
+ * whether to support +UPDATE AT commands
+ */
+#define CONFIG_ATS_UPDATE_SUPPORT
+
+/**
+ * whether to support alarm AT commands
+ */
+#define CONFIG_ATS_ALARM_SUPPORT
+
+/**
+ * maximum alarm count in AT
+ */
+#define CONFIG_ATS_ALARM_COUNT 16
+
+/**
+ * maximum alarm text length, not including \0
+ */
+#define CONFIG_ATS_ALARM_TEXT_LEN 32
+
+/**
+ * whether to support SGCC AT commands
+ */
+/* #undef CONFIG_ATS_SGCC_CATM_SUPPORT */
+
+/**
+ * whether to support camera AT commands
+ */
+/* #undef CONFIG_AT_CAMERA_SUPPORT */
+
+
+/* #undef CONFIG_AM_AT_PLATFORM */
+
+
+/*+new\rww\2020.4.30\lua tts float空间不足*/
+/* #undef CONFIG_BUILD_LUA_TTS */
+
+
+/* #undef CONFIG_BUILD_LUA_FLOAT */
+/*-new\rww\2020.4.30\lua tts float空间不足*/
+
+/*zhuwangbin 2020-5-20 add at+gpio*/
+/* #undef CONFIG_AT_GPIO_SUPPORT */
+
+/*+\NEW\czm\2020.07.21\添加中国电信自注册项目*/
+/* #undef CONFIG_BUILD_AT_CTREG */
+/*-\NEW\czm\2020.07.21\添加中国电信自注册项目*/
+
+#undef CONFIG_AT_WITHOUT_SAT
+#undef CONFIG_AT_WITHOUT_SMS
+#undef CONFIG_AT_WITHOUT_PBK
+#undef CONFIG_AT_WITHOUT_GPRS
+
+#endif

+ 53 - 0
bsp/air724/sdk/components/include/audio_config.h

@@ -0,0 +1,53 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _AUDIO_CONFIG_H_
+#define _AUDIO_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether audio feature is enabled
+ */
+#define CONFIG_AUDIO_ENABLE
+
+/**
+ * audio work queue stack size
+ */
+#define CONFIG_AUDIO_WQ_STACK_SIZE 16384
+
+/**
+ * whether MP3 decoder enabled
+ */
+#define CONFIG_AUDIO_MP3_DEC_ENABLE
+
+/**
+ * whether AMR-NB decoder enabled
+ */
+#define CONFIG_AUDIO_AMRNB_DEC_ENABLE
+
+/**
+ * whether AMR-WB decoder enabled
+ */
+#define CONFIG_AUDIO_AMRWB_DEC_ENABLE
+
+/**
+ * whether AMR-NB encoder enabled
+ */
+#define CONFIG_AUDIO_AMRNB_ENC_ENABLE
+
+/**
+ * whether AMR-WB encoder enabled
+ */
+#define CONFIG_AUDIO_AMRWB_ENC_ENABLE
+
+#endif

+ 141 - 0
bsp/air724/sdk/components/include/boot_config.h

@@ -0,0 +1,141 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _BOOT_CONFIG_H_
+#define _BOOT_CONFIG_H_
+
+#include "hal_config.h"
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * Whether to enable debug event in bootloader and fdl
+ */
+/* #undef CONFIG_BOOT_EVENT_ENABLED */
+
+/**
+ * Whether to enable trace in bootloader and fdl
+ */
+/* #undef CONFIG_BOOT_TRACE_ENABLED */
+
+/**
+ * bootloader image start address (8910, 8811)
+ *
+ * This is the bootloader loaded address in SRAM, rather than the address
+ * on flash. Also, it is start address of image header. It should match
+ * system ROM.
+ */
+#define CONFIG_BOOT_IMAGE_START 0x8000c0
+
+/**
+ * bootloader maximum image size
+ */
+#define CONFIG_BOOT_IMAGE_SIZE 0xbf40
+
+/**
+ * FDL1 image address in SRAM (8910)
+ *
+ * It should match system ROM.
+ */
+#define CONFIG_FDL1_IMAGE_START 0x810000
+
+/**
+ * FDL1 maximum image size (8910)
+ */
+#define CONFIG_FDL1_IMAGE_SIZE 0x8000
+
+/**
+ * FDL2 image address in SRAM (8910)
+ */
+#define CONFIG_FDL2_IMAGE_START 0x818000
+
+/**
+ * FDL2 maximum image size (8910)
+ */
+#define CONFIG_FDL2_IMAGE_SIZE 0x10000
+
+/**
+ * TTB start address (8910)
+ */
+#define CONFIG_BOOT_TTB_START 0x828000
+
+/**
+ * TTB size (8910)
+ */
+#define CONFIG_BOOT_TTB_SIZE 0x4400
+
+/**
+ * bootloader exception stack start address (8910)
+ */
+#define CONFIG_BOOT_EXCEPTION_STACK_START 0x82c400
+
+/**
+ * bootloader exception stack size (8910)
+ */
+#define CONFIG_BOOT_EXCEPTION_STACK_SIZE 0xc00
+
+/**
+ * heap start address for bootloader, fdl1 and fdl2 (8910)
+ */
+#define CONFIG_BOOT_SRAM_HEAP_START 0x82d000
+
+/**
+ * heap size for bootloader, fdl1 and fdl2 (8910)
+ */
+#define CONFIG_BOOT_SRAM_HEAP_SIZE 0x13000
+
+/**
+ * bootloader SVC stack size (8910)
+ */
+#define CONFIG_BOOT_SVC_STACK_SIZE 0xa00
+
+/**
+ * bootloader IRQ stack size (8910)
+ */
+#define CONFIG_BOOT_IRQ_STACK_SIZE 0x200
+
+/**
+ * bootloader SVC stack top address (8910)
+ */
+#define CONFIG_BOOT_SVC_STACK_TOP 0x82ce00
+
+/**
+ * bootloader IRQ stack top address (8910)
+ */
+#define CONFIG_BOOT_IRQ_STACK_TOP 0x82d000
+
+/**
+ * whether to enable timer interrupt in bootloader (8910)
+ */
+/* #undef CONFIG_BOOT_TIMER_IRQ_ENABLE */
+
+/**
+ * bootloader timer interval in milliseconds (8910)
+ */
+/* #undef CONFIG_BOOT_TIMER_PERIOD */
+
+/**
+ * fixed nv bin maximum size in bytes (8910, 8811)
+ */
+#define CONFIG_NVBIN_FIXED_SIZE 0x20000
+
+/**
+ * FDL1, FDL2 default uart device (8910)
+ */
+#define CONFIG_FDL_DEFAULT_UART DRV_NAME_UART2
+
+/**
+ * FDL1, FDL2 default uart baud rate (8910)
+ */
+#define CONFIG_FDL_UART_BAUD 921600
+
+#endif

+ 44 - 0
bsp/air724/sdk/components/include/cfw_config.h

@@ -0,0 +1,44 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _CFW_CONFIG_H_
+#define _CFW_CONFIG_H_
+
+#include "hal_config.h"
+#include "modem_config.h"
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_GSM_SUPPORT
+#define CONFIG_LTE_NBIOT_SUPPORT
+#define CONFIG_LTE_SUPPORT
+
+#define LTE_SUPPORT
+#define LTE_NBIOT_SUPPORT
+
+#define CFW_GPRS_SUPPORT
+#define CFW_VOLTE_SUPPORT
+#define PHONE_SMS_ENTRY_COUNT 200
+#define DEFAULT_SIM_SLOT 0
+
+#define CONFIG_NUMBER_OF_SIM 2
+#define CONFIG_EVENT_NAME_ENABLED
+
+#define CONFIG_CFW_PENDING_UTI_COUNT 64
+
+/* #undef CONFIG_CFW_SKIP_NV_SAVE_RESTORE */
+
+#define CONFIG_CFW_CALL_WITH_RPC
+/* #undef CONFIG_CFW_CALL_STACK_WITH_IPC */
+/* #undef CONFIG_CFW_DEBUG_IPFILTER */
+
+#endif

+ 43 - 0
bsp/air724/sdk/components/include/diag_config.h

@@ -0,0 +1,43 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _DIAG_CONFIG_H_
+#define _DIAG_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether diag is enabled
+ */
+#define CONFIG_DIAG_ENABLED
+
+/**
+ * diag default uart device
+ */
+#define CONFIG_DIAG_DEFAULT_UART DRV_NAME_UART2
+
+/**
+ * diag uart default baud rate
+ */
+#define CONFIG_DIAG_DEFAULT_UART_BAUD 921600
+
+/**
+ * whether diag through usb serial is supported
+ */
+#define CONFIG_DIAG_DEVICE_USRL_SUPPORT
+
+/**
+ * diag default usb serial device
+ */
+#define CONFIG_DIAG_DEFAULT_USERIAL DRV_NAME_USRL_COM5
+
+#endif

+ 92 - 0
bsp/air724/sdk/components/include/drv_config.h

@@ -0,0 +1,92 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _DRV_CONFIG_H_
+#define _DRV_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether to use IFC for debughost RX
+ */
+/* #undef CONFIG_DEBUGHOST_RX_USE_IFC */
+
+/**
+ * debughost rx DMA size in bytes
+ */
+/* #undef CONFIG_DEBUGHOST_RX_DMA_SIZE */
+
+/**
+ * debughost rx buffer size in bytes
+ *
+ * This is the buffer before parsing host packet format.
+ */
+#define CONFIG_DEBUGHOST_RX_BUF_SIZE 0x200
+
+/**
+ * whether to support charger
+ */
+#define CONFIG_SUPPORT_BATTERY_CHARGER
+
+/**
+ * whether external flash is supported
+ */
+/* #undef CONFIG_SUPPORT_EXT_FLASH */
+
+/**
+ * host command engine packet size
+ */
+#define CONFIG_HOST_CMD_ENGINE_MAX_PACKET_SIZE 0x2020
+
+/**
+ * whether to reuse uart at blue screen
+ */
+#define CONFIG_UART_BLUESCREEN_ENABLE
+
+/**
+ * uart device to be reused at blue screen
+ */
+#define CONFIG_UART_BLUESCREEN DRV_NAME_UART1
+
+/**
+ * uart baud rate to be reused at blue screen
+ */
+#define CONFIG_UART_BLUESCREEN_BAUD 921600
+
+/**
+ * uart TX baud rate at adaptive mode, before baud rate is detected
+ */
+#define CONFIG_UART_AUTOMODE_DEFAULT_BAUD 115200
+
+/**
+ * whether USB is supported
+ */
+#define CONFIG_USB_SUPPORT
+
+#ifdef CONFIG_USB_SUPPORT
+/**
+ * usb connect timeout
+ */
+#define CONFIG_USB_CONNECT_TIMEOUT 10000
+
+/**
+ * usb debounce time in milliseconds before enumarating
+ */
+#define CONFIG_USB_DETECT_DEBOUNCE_TIME 800
+
+/**
+ * udc features, lower 8 bits for config->bmAttributes, higher are software defined
+ */
+#define CONFIG_USB_DEVICE_CONTROLLER_FEATURE 0xE0
+#endif
+
+#endif

+ 18 - 0
bsp/air724/sdk/components/include/fatfs_config.h

@@ -0,0 +1,18 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _FATFS_CONFIG_H_
+#define _FATFS_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#endif

+ 20 - 0
bsp/air724/sdk/components/include/fota_config.h

@@ -0,0 +1,20 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _FOTA_CONFIG_H_
+#define _FOTA_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_AT_FOTA_SUPPORT
+
+#endif

+ 62 - 0
bsp/air724/sdk/components/include/fs_config.h

@@ -0,0 +1,62 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _FS_CONFIG_H_
+#define _FS_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether flash block device default to be v1
+ *
+ * It is known v1 is not power failure safe. Not to use it.
+ */
+/* #undef CONFIG_FS_FBDEV_DEFAULT_V1 */
+
+/**
+ * whether flash block device default to be v2
+ */
+#define CONFIG_FS_FBDEV_DEFAULT_V2
+
+/**
+ * whether flash block device v1 is supported
+ */
+/* #undef CONFIG_FS_FBDEV_V1_SUPPORTED */
+
+/**
+ * whether flash block device v2 is supported
+ */
+#define CONFIG_FS_FBDEV_V2_SUPPORTED
+
+/**
+ * whether to format on mounting flash file system failure
+ *
+ * It is highly recommended not to format on failure.
+ */
+/* #undef CONFIG_FS_FORMAT_FLASH_ON_MOUNT_FAIL */
+
+/**
+ * whether to mount sdcard
+ */
+#define CONFIG_FS_MOUNT_SDCARD
+
+/**
+ * whether to format on mounting sdcard file system failure
+ */
+#define CONFIG_FS_FORMAT_SDCARD_ON_MOUNT_FAIL
+
+/**
+ * sdcard file system mount point
+ */
+#define CONFIG_FS_SDCARD_MOUNT_POINT "/sdcard0"
+
+#endif

+ 36 - 0
bsp/air724/sdk/components/include/fupdate_config.h

@@ -0,0 +1,36 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _FUPDATE_CONFIG_H_
+#define _FUPDATE_CONFIG_H_
+
+#include "hal_config.h"
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_FUPDATE_PACK_FILE_NAME "fota.pack"
+#define CONFIG_FUPDATE_STAGE_FILE_NAME "fota.stage"
+#define CONFIG_FUPDATE_TEMP_FILE_NAME "fota.tmp"
+
+#define CONFIG_FUPDATE_SUPPORT_FLASH_PATCH
+#define CONFIG_FUPDATE_SUPPORT_FS_PATCH
+
+//+zhuwangbin\2020.06.20\add newapp newcore api
+#define CONFIG_NEWAPP_FILE_NAME "newapp.tmp"
+#define FUPDATE_NEWAPP_FILE_NAME CONFIG_FS_FOTA_DATA_DIR "/" CONFIG_NEWAPP_FILE_NAME
+//-zhuwangbin\2020.06.20\add newapp newcore api
+
+#define FUPDATE_PACK_FILE_NAME CONFIG_FS_FOTA_DATA_DIR "/" CONFIG_FUPDATE_PACK_FILE_NAME
+#define FUPDATE_STAGE_FILE_NAME CONFIG_FS_FOTA_DATA_DIR "/" CONFIG_FUPDATE_STAGE_FILE_NAME
+#define FUPDATE_TEMP_FILE_NAME CONFIG_FS_FOTA_DATA_DIR "/" CONFIG_FUPDATE_TEMP_FILE_NAME
+#define LOG_TAG_FUPDATE OSI_MAKE_LOG_TAG('F', 'U', 'P', 'D')
+#endif

+ 229 - 0
bsp/air724/sdk/components/include/hal_iomux_pincfg.h

@@ -0,0 +1,229 @@
+#ifndef _IOMUX_PINCFG_H_
+#define _IOMUX_PINCFG_H_
+
+// Auto generated. Don't edit it manually!
+
+static const halIomuxConfig_t gHalIomuxConfig[] = {
+    {&hwp_iomux->pad_adi_scl_cfg_reg, 0}, // PINFUNC_ADI_SCL
+    {&hwp_iomux->pad_adi_sda_cfg_reg, 0}, // PINFUNC_ADI_SDA
+    {&hwp_iomux->pad_adi_sync_cfg_reg, 0}, // PINFUNC_ADI_SYNC
+    {&hwp_iomux->pad_ap_jtag_tck_cfg_reg, 0}, // PINFUNC_AP_JTAG_TCK
+    {&hwp_iomux->pad_ap_jtag_tdi_cfg_reg, 0}, // PINFUNC_AP_JTAG_TDI
+    {&hwp_iomux->pad_ap_jtag_tdo_cfg_reg, 0}, // PINFUNC_AP_JTAG_TDO
+    {&hwp_iomux->pad_ap_jtag_tms_cfg_reg, 0}, // PINFUNC_AP_JTAG_TMS
+    {&hwp_iomux->pad_ap_jtag_trst_cfg_reg, 0}, // PINFUNC_AP_JTAG_TRST
+    {&hwp_iomux->pad_aud_ad_d0_cfg_reg, 0}, // PINFUNC_AUD_AD_D0
+    {&hwp_iomux->pad_aud_ad_sync_cfg_reg, 0}, // PINFUNC_AUD_AD_SYNC
+    {&hwp_iomux->pad_aud_da_d0_cfg_reg, 0}, // PINFUNC_AUD_DA_D0
+    {&hwp_iomux->pad_aud_da_d1_cfg_reg, 0}, // PINFUNC_AUD_DA_D1
+    {&hwp_iomux->pad_aud_da_sync_cfg_reg, 0}, // PINFUNC_AUD_DA_SYNC
+    {&hwp_iomux->pad_aud_sclk_cfg_reg, 0}, // PINFUNC_AUD_SCLK
+    {&hwp_iomux->pad_camera_pwdn_cfg_reg, 0}, // PINFUNC_CAMERA_PWDN
+    {&hwp_iomux->pad_camera_ref_clk_cfg_reg, 0}, // PINFUNC_CAMERA_REF_CLK
+    {&hwp_iomux->pad_camera_rst_l_cfg_reg, 0}, // PINFUNC_CAMERA_RST_L
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 7}, // PINFUNC_DEBUG_CLK
+    {&hwp_iomux->pad_debug_host_clk_cfg_reg, 0}, // PINFUNC_DEBUG_HOST_CLK
+    {&hwp_iomux->pad_debug_host_rx_cfg_reg, 0}, // PINFUNC_DEBUG_HOST_RX
+    {&hwp_iomux->pad_debug_host_tx_cfg_reg, 0}, // PINFUNC_DEBUG_HOST_TX
+    {&hwp_iomux->pad_rfdig_gpio_2_cfg_reg, 5}, // PINFUNC_DFE_RX_ENABLE_M_I
+    {&hwp_iomux->pad_rfdig_gpio_2_cfg_reg, 7}, // PINFUNC_DFE_RX_ENABLE_S_O
+    {&hwp_iomux->pad_rfdig_gpio_3_cfg_reg, 5}, // PINFUNC_DIGRF_CP_26M_M_O
+    {&hwp_iomux->pad_rfdig_gpio_3_cfg_reg, 7}, // PINFUNC_DIGRF_CP_26M_S_I
+    {&hwp_iomux->pad_rfdig_gpio_7_cfg_reg, 5}, // PINFUNC_DIGRF_RX_DATA_M_O
+    {&hwp_iomux->pad_rfdig_gpio_7_cfg_reg, 7}, // PINFUNC_DIGRF_RX_DATA_S_I
+    {&hwp_iomux->pad_rfdig_gpio_6_cfg_reg, 5}, // PINFUNC_DIGRF_RX_EN_M_O
+    {&hwp_iomux->pad_rfdig_gpio_6_cfg_reg, 7}, // PINFUNC_DIGRF_RX_EN_S_I
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 5}, // PINFUNC_DIGRF_STROBE_M_I
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 7}, // PINFUNC_DIGRF_STROBE_S_O
+    {&hwp_iomux->pad_rfdig_gpio_5_cfg_reg, 5}, // PINFUNC_DIGRF_TX_DATA_M_I
+    {&hwp_iomux->pad_rfdig_gpio_5_cfg_reg, 7}, // PINFUNC_DIGRF_TX_DATA_S_O
+    {&hwp_iomux->pad_rfdig_gpio_4_cfg_reg, 5}, // PINFUNC_DIGRF_TX_EN_M_I
+    {&hwp_iomux->pad_rfdig_gpio_4_cfg_reg, 7}, // PINFUNC_DIGRF_TX_EN_S_O
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 0}, // PINFUNC_GPIO_0
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 0}, // PINFUNC_GPIO_1
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 0}, // PINFUNC_GPIO_2
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 0}, // PINFUNC_GPIO_3
+    {&hwp_iomux->pad_gpio_4_cfg_reg, 0}, // PINFUNC_GPIO_4
+    {&hwp_iomux->pad_gpio_5_cfg_reg, 0}, // PINFUNC_GPIO_5
+    {NULL, 0}, // PINFUNC_GPIO_6
+    {&hwp_iomux->pad_gpio_7_cfg_reg, 0}, // PINFUNC_GPIO_7
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 0}, // PINFUNC_GPIO_8
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 0}, // PINFUNC_GPIO_9
+    {&hwp_iomux->pad_gpio_10_cfg_reg, 0}, // PINFUNC_GPIO_10
+    {&hwp_iomux->pad_gpio_11_cfg_reg, 0}, // PINFUNC_GPIO_11
+    {&hwp_iomux->pad_gpio_12_cfg_reg, 0}, // PINFUNC_GPIO_12
+    {&hwp_iomux->pad_gpio_13_cfg_reg, 0}, // PINFUNC_GPIO_13
+    {&hwp_iomux->pad_gpio_14_cfg_reg, 0}, // PINFUNC_GPIO_14
+    {&hwp_iomux->pad_gpio_15_cfg_reg, 0}, // PINFUNC_GPIO_15
+    {&hwp_iomux->pad_i2c_m1_scl_cfg_reg, 4}, // PINFUNC_GPIO_16
+    {&hwp_iomux->pad_i2c_m1_sda_cfg_reg, 4}, // PINFUNC_GPIO_17
+    {&hwp_iomux->pad_camera_rst_l_cfg_reg, 4}, // PINFUNC_GPIO_18
+    {&hwp_iomux->pad_gpio_19_cfg_reg, 0}, // PINFUNC_GPIO_19
+    {&hwp_iomux->pad_camera_ref_clk_cfg_reg, 4}, // PINFUNC_GPIO_20
+    {&hwp_iomux->pad_gpio_21_cfg_reg, 0}, // PINFUNC_GPIO_21
+    {&hwp_iomux->pad_gpio_22_cfg_reg, 0}, // PINFUNC_GPIO_22
+    {&hwp_iomux->pad_gpio_23_cfg_reg, 0}, // PINFUNC_GPIO_23
+    {&hwp_iomux->pad_sdmmc1_cmd_cfg_reg, 1}, // PINFUNC_GPIO_24
+    {&hwp_iomux->pad_sdmmc1_data_0_cfg_reg, 1}, // PINFUNC_GPIO_25
+    {&hwp_iomux->pad_sdmmc1_data_1_cfg_reg, 1}, // PINFUNC_GPIO_26
+    {&hwp_iomux->pad_sdmmc1_data_2_cfg_reg, 1}, // PINFUNC_GPIO_27
+    {&hwp_iomux->pad_sdmmc1_data_3_cfg_reg, 1}, // PINFUNC_GPIO_28
+    {&hwp_iomux->pad_sim_2_clk_cfg_reg, 2}, // PINFUNC_GPIO_29
+    {&hwp_iomux->pad_sim_2_dio_cfg_reg, 2}, // PINFUNC_GPIO_30
+    {&hwp_iomux->pad_sim_2_rst_cfg_reg, 2}, // PINFUNC_GPIO_31
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 6}, // PINFUNC_GPO_0
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 6}, // PINFUNC_GPO_1
+    {&hwp_iomux->pad_gpio_10_cfg_reg, 6}, // PINFUNC_GPO_2
+    {&hwp_iomux->pad_gpio_11_cfg_reg, 6}, // PINFUNC_GPO_3
+    {&hwp_iomux->pad_gpio_12_cfg_reg, 6}, // PINFUNC_GPO_4
+    {&hwp_iomux->pad_sim_2_clk_cfg_reg, 1}, // PINFUNC_GPO_5
+    {&hwp_iomux->pad_sim_2_dio_cfg_reg, 1}, // PINFUNC_GPO_6
+    {&hwp_iomux->pad_sim_2_rst_cfg_reg, 1}, // PINFUNC_GPO_7
+    {&hwp_iomux->pad_i2c_m1_scl_cfg_reg, 0}, // PINFUNC_I2C_M1_SCL
+    {&hwp_iomux->pad_i2c_m1_sda_cfg_reg, 0}, // PINFUNC_I2C_M1_SDA
+    {&hwp_iomux->pad_gpio_14_cfg_reg, 1}, // PINFUNC_I2C_M2_SCL
+    {&hwp_iomux->pad_gpio_15_cfg_reg, 1}, // PINFUNC_I2C_M2_SDA
+    {&hwp_iomux->pad_lcd_rstb_cfg_reg, 3}, // PINFUNC_I2C_M3_SCL
+    {&hwp_iomux->pad_spi_lcd_sdc_cfg_reg, 3}, // PINFUNC_I2C_M3_SDA
+    {&hwp_iomux->pad_aud_da_sync_cfg_reg, 1}, // PINFUNC_I2S1_BCK
+    {&hwp_iomux->pad_aud_da_d1_cfg_reg, 1}, // PINFUNC_I2S1_LRCK
+    {&hwp_iomux->pad_aud_da_d0_cfg_reg, 1}, // PINFUNC_I2S1_SDAT_I
+    {&hwp_iomux->pad_aud_ad_sync_cfg_reg, 1}, // PINFUNC_I2S1_SDAT_O
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 3}, // PINFUNC_I2S2_BCK
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 3}, // PINFUNC_I2S2_LRCK
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 3}, // PINFUNC_I2S2_SDAT_I
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 3}, // PINFUNC_I2S2_SDAT_O
+    {&hwp_iomux->pad_keyin_0_cfg_reg, 0}, // PINFUNC_KEYIN_0
+    {&hwp_iomux->pad_keyin_1_cfg_reg, 0}, // PINFUNC_KEYIN_1
+    {&hwp_iomux->pad_keyin_2_cfg_reg, 0}, // PINFUNC_KEYIN_2
+    {&hwp_iomux->pad_keyin_3_cfg_reg, 0}, // PINFUNC_KEYIN_3
+    {&hwp_iomux->pad_keyin_4_cfg_reg, 0}, // PINFUNC_KEYIN_4
+    {&hwp_iomux->pad_keyin_5_cfg_reg, 0}, // PINFUNC_KEYIN_5
+    {&hwp_iomux->pad_keyout_0_cfg_reg, 0}, // PINFUNC_KEYOUT_0
+    {&hwp_iomux->pad_keyout_1_cfg_reg, 0}, // PINFUNC_KEYOUT_1
+    {&hwp_iomux->pad_keyout_2_cfg_reg, 0}, // PINFUNC_KEYOUT_2
+    {&hwp_iomux->pad_keyout_3_cfg_reg, 0}, // PINFUNC_KEYOUT_3
+    {&hwp_iomux->pad_keyout_4_cfg_reg, 0}, // PINFUNC_KEYOUT_4
+    {&hwp_iomux->pad_keyout_5_cfg_reg, 0}, // PINFUNC_KEYOUT_5
+    {&hwp_iomux->pad_lcd_fmark_cfg_reg, 0}, // PINFUNC_LCD_FMARK
+    {&hwp_iomux->pad_lcd_rstb_cfg_reg, 0}, // PINFUNC_LCD_RSTB
+    {&hwp_iomux->pad_rfdig_gpio_0_cfg_reg, 2}, // PINFUNC_LTE_GPO_0
+    {&hwp_iomux->pad_rfdig_gpio_1_cfg_reg, 2}, // PINFUNC_LTE_GPO_1
+    {&hwp_iomux->pad_rfdig_gpio_2_cfg_reg, 2}, // PINFUNC_LTE_GPO_2
+    {&hwp_iomux->pad_rfdig_gpio_3_cfg_reg, 2}, // PINFUNC_LTE_GPO_3
+    {&hwp_iomux->pad_rfdig_gpio_4_cfg_reg, 2}, // PINFUNC_LTE_GPO_4
+    {&hwp_iomux->pad_rfdig_gpio_5_cfg_reg, 2}, // PINFUNC_LTE_GPO_5
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 3}, // PINFUNC_LTE_GPO_6
+    {&hwp_iomux->pad_rfdig_gpio_6_cfg_reg, 2}, // PINFUNC_LTE_GPO_7
+    {&hwp_iomux->pad_rfdig_gpio_7_cfg_reg, 2}, // PINFUNC_LTE_GPO_8
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 3}, // PINFUNC_LTE_GPO_9
+    {&hwp_iomux->pad_gpio_10_cfg_reg, 2}, // PINFUNC_LTE_SPI_CS
+    {&hwp_iomux->pad_gpio_11_cfg_reg, 2}, // PINFUNC_LTE_SPI_SCLK
+    {&hwp_iomux->pad_gpio_12_cfg_reg, 2}, // PINFUNC_LTE_SPI_SDIO
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 4}, // PINFUNC_LTE_SPI_SDO
+    {&hwp_iomux->pad_nand_flash_sel_cfg_reg, 0}, // PINFUNC_NAND_FLASH_SEL
+    {&hwp_iomux->pad_gpio_4_cfg_reg, 3}, // PINFUNC_PWL_OUT_0
+    {&hwp_iomux->pad_gpio_7_cfg_reg, 3}, // PINFUNC_PWL_OUT_1
+    {&hwp_iomux->pad_gpio_13_cfg_reg, 1}, // PINFUNC_PWM_LPG_OUT
+    {&hwp_iomux->pad_gpio_5_cfg_reg, 2}, // PINFUNC_PWT_OUT
+    {&hwp_iomux->pad_rfdig_gpio_0_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_0
+    {&hwp_iomux->pad_rfdig_gpio_1_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_1
+    {&hwp_iomux->pad_rfdig_gpio_2_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_2
+    {&hwp_iomux->pad_rfdig_gpio_3_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_3
+    {&hwp_iomux->pad_rfdig_gpio_4_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_4
+    {&hwp_iomux->pad_rfdig_gpio_5_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_5
+    {&hwp_iomux->pad_rfdig_gpio_6_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_6
+    {&hwp_iomux->pad_rfdig_gpio_7_cfg_reg, 0}, // PINFUNC_RFDIG_GPIO_7
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 2}, // PINFUNC_RFDIG_GPIO_8
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 2}, // PINFUNC_RFDIG_GPIO_9
+    {&hwp_iomux->pad_ap_jtag_tck_cfg_reg, 4}, // PINFUNC_RFDIG_JTAG_TCK
+    {&hwp_iomux->pad_ap_jtag_tdi_cfg_reg, 4}, // PINFUNC_RFDIG_JTAG_TDI
+    {&hwp_iomux->pad_ap_jtag_tdo_cfg_reg, 4}, // PINFUNC_RFDIG_JTAG_TDO
+    {&hwp_iomux->pad_ap_jtag_tms_cfg_reg, 4}, // PINFUNC_RFDIG_JTAG_TMS
+    {&hwp_iomux->pad_ap_jtag_trst_cfg_reg, 4}, // PINFUNC_RFDIG_JTAG_TRST
+    {&hwp_iomux->pad_rfdig_gpio_0_cfg_reg, 1}, // PINFUNC_RFFE_SCLK
+    {&hwp_iomux->pad_rfdig_gpio_1_cfg_reg, 1}, // PINFUNC_RFFE_SDATA
+    {&hwp_iomux->pad_sdmmc1_clk_cfg_reg, 0}, // PINFUNC_SDMMC1_CLK
+    {&hwp_iomux->pad_sdmmc1_cmd_cfg_reg, 0}, // PINFUNC_SDMMC1_CMD
+    {&hwp_iomux->pad_sdmmc1_data_0_cfg_reg, 0}, // PINFUNC_SDMMC1_DATA_0
+    {&hwp_iomux->pad_sdmmc1_data_1_cfg_reg, 0}, // PINFUNC_SDMMC1_DATA_1
+    {&hwp_iomux->pad_sdmmc1_data_2_cfg_reg, 0}, // PINFUNC_SDMMC1_DATA_2
+    {&hwp_iomux->pad_sdmmc1_data_3_cfg_reg, 0}, // PINFUNC_SDMMC1_DATA_3
+    {&hwp_iomux->pad_gpio_7_cfg_reg, 1}, // PINFUNC_SDMMC2_CLK
+    {&hwp_iomux->pad_ap_jtag_tck_cfg_reg, 1}, // PINFUNC_SDMMC2_CMD
+    {&hwp_iomux->pad_ap_jtag_trst_cfg_reg, 1}, // PINFUNC_SDMMC2_DATA_0
+    {&hwp_iomux->pad_ap_jtag_tms_cfg_reg, 1}, // PINFUNC_SDMMC2_DATA_1
+    {&hwp_iomux->pad_ap_jtag_tdi_cfg_reg, 1}, // PINFUNC_SDMMC2_DATA_2
+    {&hwp_iomux->pad_ap_jtag_tdo_cfg_reg, 1}, // PINFUNC_SDMMC2_DATA_3
+    {&hwp_iomux->pad_secure_boot_mode_cfg_reg, 0}, // PINFUNC_SECURE_BOOT_MODE
+    {&hwp_iomux->pad_sim_1_clk_cfg_reg, 0}, // PINFUNC_SIM_1_CLK
+    {&hwp_iomux->pad_sim_1_dio_cfg_reg, 0}, // PINFUNC_SIM_1_DIO
+    {&hwp_iomux->pad_sim_1_rst_cfg_reg, 0}, // PINFUNC_SIM_1_RST
+    {&hwp_iomux->pad_sim_2_clk_cfg_reg, 0}, // PINFUNC_SIM_2_CLK
+    {&hwp_iomux->pad_sim_2_dio_cfg_reg, 0}, // PINFUNC_SIM_2_DIO
+    {&hwp_iomux->pad_sim_2_rst_cfg_reg, 0}, // PINFUNC_SIM_2_RST
+    {&hwp_iomux->pad_gpio_9_cfg_reg, 1}, // PINFUNC_SPI_1_CLK
+    {&hwp_iomux->pad_gpio_10_cfg_reg, 1}, // PINFUNC_SPI_1_CS_0
+    {&hwp_iomux->pad_gpio_8_cfg_reg, 1}, // PINFUNC_SPI_1_CS_1
+    {&hwp_iomux->pad_gpio_12_cfg_reg, 1}, // PINFUNC_SPI_1_DI_1
+    {&hwp_iomux->pad_gpio_11_cfg_reg, 1}, // PINFUNC_SPI_1_DIO_0
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 2}, // PINFUNC_SPI_2_CLK
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 2}, // PINFUNC_SPI_2_CS_0
+    {&hwp_iomux->pad_gpio_4_cfg_reg, 2}, // PINFUNC_SPI_2_CS_1
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 2}, // PINFUNC_SPI_2_DI_1
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 2}, // PINFUNC_SPI_2_DIO_0
+    {&hwp_iomux->pad_spi_camera_sck_cfg_reg, 0}, // PINFUNC_SPI_CAMERA_SCK
+    {&hwp_iomux->pad_spi_camera_si_0_cfg_reg, 0}, // PINFUNC_SPI_CAMERA_SI_0
+    {&hwp_iomux->pad_spi_camera_si_1_cfg_reg, 0}, // PINFUNC_SPI_CAMERA_SI_1
+    {&hwp_iomux->pad_spi_camera_si_1_cfg_reg, 2}, // PINFUNC_SPI_CAMERA_SSN
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_CLK
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_CS
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_SIO_0
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_SIO_1
+    {&hwp_iomux->pad_gpio_4_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_SIO_2
+    {&hwp_iomux->pad_gpio_5_cfg_reg, 1}, // PINFUNC_SPI_FLASH1_SIO_3
+    {&hwp_iomux->pad_spi_flash_clk_cfg_reg, 0}, // PINFUNC_SPI_FLASH_CLK
+    {&hwp_iomux->pad_spi_flash_cs_cfg_reg, 0}, // PINFUNC_SPI_FLASH_CS
+    {&hwp_iomux->pad_spi_flash_sel_cfg_reg, 0}, // PINFUNC_SPI_FLASH_SEL
+    {&hwp_iomux->pad_spi_flash_sio_0_cfg_reg, 0}, // PINFUNC_SPI_FLASH_SIO_0
+    {&hwp_iomux->pad_spi_flash_sio_1_cfg_reg, 0}, // PINFUNC_SPI_FLASH_SIO_1
+    {&hwp_iomux->pad_spi_flash_sio_2_cfg_reg, 0}, // PINFUNC_SPI_FLASH_SIO_2
+    {&hwp_iomux->pad_spi_flash_sio_3_cfg_reg, 0}, // PINFUNC_SPI_FLASH_SIO_3
+    {&hwp_iomux->pad_spi_lcd_clk_cfg_reg, 0}, // PINFUNC_SPI_LCD_CLK
+    {&hwp_iomux->pad_spi_lcd_cs_cfg_reg, 0}, // PINFUNC_SPI_LCD_CS
+    {&hwp_iomux->pad_spi_lcd_sdc_cfg_reg, 0}, // PINFUNC_SPI_LCD_SDC
+    {&hwp_iomux->pad_spi_lcd_select_cfg_reg, 0}, // PINFUNC_SPI_LCD_SELECT
+    {&hwp_iomux->pad_spi_lcd_sio_cfg_reg, 0}, // PINFUNC_SPI_LCD_SIO
+    {&hwp_iomux->pad_spi_camera_sck_cfg_reg, 3}, // PINFUNC_SPI_LVDS_CLK
+    {&hwp_iomux->pad_spi_camera_si_1_cfg_reg, 3}, // PINFUNC_SPI_LVDS_CS
+    {&hwp_iomux->pad_camera_ref_clk_cfg_reg, 3}, // PINFUNC_SPI_LVDS_DI
+    {&hwp_iomux->pad_spi_camera_si_0_cfg_reg, 3}, // PINFUNC_SPI_LVDS_DO
+    {&hwp_iomux->pad_gpio_18_cfg_reg, 1}, // PINFUNC_UART_1_CTS
+    {&hwp_iomux->pad_gpio_19_cfg_reg, 1}, // PINFUNC_UART_1_RTS
+    {NULL, 0}, // PINFUNC_UART_1_RXD
+    {NULL, 0}, // PINFUNC_UART_1_TXD
+    {&hwp_iomux->pad_gpio_20_cfg_reg, 1}, // PINFUNC_UART_2_RXD
+    {&hwp_iomux->pad_gpio_21_cfg_reg, 1}, // PINFUNC_UART_2_TXD
+    {&hwp_iomux->pad_keyout_4_cfg_reg, 4}, // PINFUNC_UART_3_RXD
+    {&hwp_iomux->pad_keyout_5_cfg_reg, 4}, // PINFUNC_UART_3_TXD
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 5}, // PINFUNC_UART_RXD_RF
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 5}, // PINFUNC_UART_TXD_RF
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 5}, // PINFUNC_WCN_HST_RXD
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 5}, // PINFUNC_WCN_HST_TXD
+    {&hwp_iomux->pad_gpio_0_cfg_reg, 4}, // PINFUNC_WCN_JTAG_TCK
+    {&hwp_iomux->pad_gpio_3_cfg_reg, 4}, // PINFUNC_WCN_JTAG_TDI
+    {&hwp_iomux->pad_gpio_4_cfg_reg, 4}, // PINFUNC_WCN_JTAG_TDO
+    {&hwp_iomux->pad_gpio_2_cfg_reg, 4}, // PINFUNC_WCN_JTAG_TMS
+    {&hwp_iomux->pad_gpio_1_cfg_reg, 4}, // PINFUNC_WCN_JTAG_TRST
+    {&hwp_iomux->pad_gpio_7_cfg_reg, 5}, // PINFUNC_WCN_UART_RXD
+    {&hwp_iomux->pad_gpio_5_cfg_reg, 5}, // PINFUNC_WCN_UART_TXD
+    {&hwp_iomux->pad_ap_jtag_tck_cfg_reg, 3}, // PINFUNC_ZSP_JTAG_TCK
+    {&hwp_iomux->pad_ap_jtag_tdi_cfg_reg, 3}, // PINFUNC_ZSP_JTAG_TDI
+    {&hwp_iomux->pad_ap_jtag_tdo_cfg_reg, 3}, // PINFUNC_ZSP_JTAG_TDO
+    {&hwp_iomux->pad_ap_jtag_tms_cfg_reg, 3}, // PINFUNC_ZSP_JTAG_TMS
+    {&hwp_iomux->pad_ap_jtag_trst_cfg_reg, 3}, // PINFUNC_ZSP_JTAG_TRST
+    {&hwp_iomux->pad_gpio_22_cfg_reg, 5}, // PINFUNC_ZSP_UART_TXD
+};
+
+#endif
+

+ 229 - 0
bsp/air724/sdk/components/include/hal_iomux_pindef.h

@@ -0,0 +1,229 @@
+#ifndef _IOMUX_PINDEF_H_
+#define _IOMUX_PINDEF_H_
+
+// Auto generated. Don't edit it manually!
+
+enum {
+    PINFUNC_ADI_SCL,
+    PINFUNC_ADI_SDA,
+    PINFUNC_ADI_SYNC,
+    PINFUNC_AP_JTAG_TCK,
+    PINFUNC_AP_JTAG_TDI,
+    PINFUNC_AP_JTAG_TDO,
+    PINFUNC_AP_JTAG_TMS,
+    PINFUNC_AP_JTAG_TRST,
+    PINFUNC_AUD_AD_D0,
+    PINFUNC_AUD_AD_SYNC,
+    PINFUNC_AUD_DA_D0,
+    PINFUNC_AUD_DA_D1,
+    PINFUNC_AUD_DA_SYNC,
+    PINFUNC_AUD_SCLK,
+    PINFUNC_CAMERA_PWDN,
+    PINFUNC_CAMERA_REF_CLK,
+    PINFUNC_CAMERA_RST_L,
+    PINFUNC_DEBUG_CLK,
+    PINFUNC_DEBUG_HOST_CLK,
+    PINFUNC_DEBUG_HOST_RX,
+    PINFUNC_DEBUG_HOST_TX,
+    PINFUNC_DFE_RX_ENABLE_M_I,
+    PINFUNC_DFE_RX_ENABLE_S_O,
+    PINFUNC_DIGRF_CP_26M_M_O,
+    PINFUNC_DIGRF_CP_26M_S_I,
+    PINFUNC_DIGRF_RX_DATA_M_O,
+    PINFUNC_DIGRF_RX_DATA_S_I,
+    PINFUNC_DIGRF_RX_EN_M_O,
+    PINFUNC_DIGRF_RX_EN_S_I,
+    PINFUNC_DIGRF_STROBE_M_I,
+    PINFUNC_DIGRF_STROBE_S_O,
+    PINFUNC_DIGRF_TX_DATA_M_I,
+    PINFUNC_DIGRF_TX_DATA_S_O,
+    PINFUNC_DIGRF_TX_EN_M_I,
+    PINFUNC_DIGRF_TX_EN_S_O,
+    PINFUNC_GPIO_0,
+    PINFUNC_GPIO_1,
+    PINFUNC_GPIO_2,
+    PINFUNC_GPIO_3,
+    PINFUNC_GPIO_4,
+    PINFUNC_GPIO_5,
+    PINFUNC_GPIO_6,
+    PINFUNC_GPIO_7,
+    PINFUNC_GPIO_8,
+    PINFUNC_GPIO_9,
+    PINFUNC_GPIO_10,
+    PINFUNC_GPIO_11,
+    PINFUNC_GPIO_12,
+    PINFUNC_GPIO_13,
+    PINFUNC_GPIO_14,
+    PINFUNC_GPIO_15,
+    PINFUNC_GPIO_16,
+    PINFUNC_GPIO_17,
+    PINFUNC_GPIO_18,
+    PINFUNC_GPIO_19,
+    PINFUNC_GPIO_20,
+    PINFUNC_GPIO_21,
+    PINFUNC_GPIO_22,
+    PINFUNC_GPIO_23,
+    PINFUNC_GPIO_24,
+    PINFUNC_GPIO_25,
+    PINFUNC_GPIO_26,
+    PINFUNC_GPIO_27,
+    PINFUNC_GPIO_28,
+    PINFUNC_GPIO_29,
+    PINFUNC_GPIO_30,
+    PINFUNC_GPIO_31,
+    PINFUNC_GPO_0,
+    PINFUNC_GPO_1,
+    PINFUNC_GPO_2,
+    PINFUNC_GPO_3,
+    PINFUNC_GPO_4,
+    PINFUNC_GPO_5,
+    PINFUNC_GPO_6,
+    PINFUNC_GPO_7,
+    PINFUNC_I2C_M1_SCL,
+    PINFUNC_I2C_M1_SDA,
+    PINFUNC_I2C_M2_SCL,
+    PINFUNC_I2C_M2_SDA,
+    PINFUNC_I2C_M3_SCL,
+    PINFUNC_I2C_M3_SDA,
+    PINFUNC_I2S1_BCK,
+    PINFUNC_I2S1_LRCK,
+    PINFUNC_I2S1_SDAT_I,
+    PINFUNC_I2S1_SDAT_O,
+    PINFUNC_I2S2_BCK,
+    PINFUNC_I2S2_LRCK,
+    PINFUNC_I2S2_SDAT_I,
+    PINFUNC_I2S2_SDAT_O,
+    PINFUNC_KEYIN_0,
+    PINFUNC_KEYIN_1,
+    PINFUNC_KEYIN_2,
+    PINFUNC_KEYIN_3,
+    PINFUNC_KEYIN_4,
+    PINFUNC_KEYIN_5,
+    PINFUNC_KEYOUT_0,
+    PINFUNC_KEYOUT_1,
+    PINFUNC_KEYOUT_2,
+    PINFUNC_KEYOUT_3,
+    PINFUNC_KEYOUT_4,
+    PINFUNC_KEYOUT_5,
+    PINFUNC_LCD_FMARK,
+    PINFUNC_LCD_RSTB,
+    PINFUNC_LTE_GPO_0,
+    PINFUNC_LTE_GPO_1,
+    PINFUNC_LTE_GPO_2,
+    PINFUNC_LTE_GPO_3,
+    PINFUNC_LTE_GPO_4,
+    PINFUNC_LTE_GPO_5,
+    PINFUNC_LTE_GPO_6,
+    PINFUNC_LTE_GPO_7,
+    PINFUNC_LTE_GPO_8,
+    PINFUNC_LTE_GPO_9,
+    PINFUNC_LTE_SPI_CS,
+    PINFUNC_LTE_SPI_SCLK,
+    PINFUNC_LTE_SPI_SDIO,
+    PINFUNC_LTE_SPI_SDO,
+    PINFUNC_NAND_FLASH_SEL,
+    PINFUNC_PWL_OUT_0,
+    PINFUNC_PWL_OUT_1,
+    PINFUNC_PWM_LPG_OUT,
+    PINFUNC_PWT_OUT,
+    PINFUNC_RFDIG_GPIO_0,
+    PINFUNC_RFDIG_GPIO_1,
+    PINFUNC_RFDIG_GPIO_2,
+    PINFUNC_RFDIG_GPIO_3,
+    PINFUNC_RFDIG_GPIO_4,
+    PINFUNC_RFDIG_GPIO_5,
+    PINFUNC_RFDIG_GPIO_6,
+    PINFUNC_RFDIG_GPIO_7,
+    PINFUNC_RFDIG_GPIO_8,
+    PINFUNC_RFDIG_GPIO_9,
+    PINFUNC_RFDIG_JTAG_TCK,
+    PINFUNC_RFDIG_JTAG_TDI,
+    PINFUNC_RFDIG_JTAG_TDO,
+    PINFUNC_RFDIG_JTAG_TMS,
+    PINFUNC_RFDIG_JTAG_TRST,
+    PINFUNC_RFFE_SCLK,
+    PINFUNC_RFFE_SDATA,
+    PINFUNC_SDMMC1_CLK,
+    PINFUNC_SDMMC1_CMD,
+    PINFUNC_SDMMC1_DATA_0,
+    PINFUNC_SDMMC1_DATA_1,
+    PINFUNC_SDMMC1_DATA_2,
+    PINFUNC_SDMMC1_DATA_3,
+    PINFUNC_SDMMC2_CLK,
+    PINFUNC_SDMMC2_CMD,
+    PINFUNC_SDMMC2_DATA_0,
+    PINFUNC_SDMMC2_DATA_1,
+    PINFUNC_SDMMC2_DATA_2,
+    PINFUNC_SDMMC2_DATA_3,
+    PINFUNC_SECURE_BOOT_MODE,
+    PINFUNC_SIM_1_CLK,
+    PINFUNC_SIM_1_DIO,
+    PINFUNC_SIM_1_RST,
+    PINFUNC_SIM_2_CLK,
+    PINFUNC_SIM_2_DIO,
+    PINFUNC_SIM_2_RST,
+    PINFUNC_SPI_1_CLK,
+    PINFUNC_SPI_1_CS_0,
+    PINFUNC_SPI_1_CS_1,
+    PINFUNC_SPI_1_DI_1,
+    PINFUNC_SPI_1_DIO_0,
+    PINFUNC_SPI_2_CLK,
+    PINFUNC_SPI_2_CS_0,
+    PINFUNC_SPI_2_CS_1,
+    PINFUNC_SPI_2_DI_1,
+    PINFUNC_SPI_2_DIO_0,
+    PINFUNC_SPI_CAMERA_SCK,
+    PINFUNC_SPI_CAMERA_SI_0,
+    PINFUNC_SPI_CAMERA_SI_1,
+    PINFUNC_SPI_CAMERA_SSN,
+    PINFUNC_SPI_FLASH1_CLK,
+    PINFUNC_SPI_FLASH1_CS,
+    PINFUNC_SPI_FLASH1_SIO_0,
+    PINFUNC_SPI_FLASH1_SIO_1,
+    PINFUNC_SPI_FLASH1_SIO_2,
+    PINFUNC_SPI_FLASH1_SIO_3,
+    PINFUNC_SPI_FLASH_CLK,
+    PINFUNC_SPI_FLASH_CS,
+    PINFUNC_SPI_FLASH_SEL,
+    PINFUNC_SPI_FLASH_SIO_0,
+    PINFUNC_SPI_FLASH_SIO_1,
+    PINFUNC_SPI_FLASH_SIO_2,
+    PINFUNC_SPI_FLASH_SIO_3,
+    PINFUNC_SPI_LCD_CLK,
+    PINFUNC_SPI_LCD_CS,
+    PINFUNC_SPI_LCD_SDC,
+    PINFUNC_SPI_LCD_SELECT,
+    PINFUNC_SPI_LCD_SIO,
+    PINFUNC_SPI_LVDS_CLK,
+    PINFUNC_SPI_LVDS_CS,
+    PINFUNC_SPI_LVDS_DI,
+    PINFUNC_SPI_LVDS_DO,
+    PINFUNC_UART_1_CTS,
+    PINFUNC_UART_1_RTS,
+    PINFUNC_UART_1_RXD,
+    PINFUNC_UART_1_TXD,
+    PINFUNC_UART_2_RXD,
+    PINFUNC_UART_2_TXD,
+    PINFUNC_UART_3_RXD,
+    PINFUNC_UART_3_TXD,
+    PINFUNC_UART_RXD_RF,
+    PINFUNC_UART_TXD_RF,
+    PINFUNC_WCN_HST_RXD,
+    PINFUNC_WCN_HST_TXD,
+    PINFUNC_WCN_JTAG_TCK,
+    PINFUNC_WCN_JTAG_TDI,
+    PINFUNC_WCN_JTAG_TDO,
+    PINFUNC_WCN_JTAG_TMS,
+    PINFUNC_WCN_JTAG_TRST,
+    PINFUNC_WCN_UART_RXD,
+    PINFUNC_WCN_UART_TXD,
+    PINFUNC_ZSP_JTAG_TCK,
+    PINFUNC_ZSP_JTAG_TDI,
+    PINFUNC_ZSP_JTAG_TDO,
+    PINFUNC_ZSP_JTAG_TMS,
+    PINFUNC_ZSP_JTAG_TRST,
+    PINFUNC_ZSP_UART_TXD,
+};
+
+#endif
+

+ 36 - 0
bsp/air724/sdk/components/include/hal_keypad_def.h

@@ -0,0 +1,36 @@
+#ifndef _HAL_KEYPAD_DEF_
+#define _HAL_KEYPAD_DEF_
+
+
+//  Auto generated. Don't edit it manually!
+
+typedef enum 
+{
+    KEY_MAP_POWER=0,
+    KEY_MAP_1=1,
+    KEY_MAP_2=2,
+    KEY_MAP_3=3,
+    KEY_MAP_LEFT=4,
+    KEY_MAP_OK=5,
+    KEY_MAP_4=9,
+    KEY_MAP_5=10,
+    KEY_MAP_6=11,
+    KEY_MAP_RIGHT=12,
+    KEY_MAP_SOFT_R=13,
+    KEY_MAP_7=17,
+    KEY_MAP_8=18,
+    KEY_MAP_9=19,
+    KEY_MAP_UP=20,
+    KEY_MAP_SOFT_L=21,
+    KEY_MAP_STAR=25,
+    KEY_MAP_0=26,
+    KEY_MAP_WELL=27,
+    KEY_MAP_DOWN=28,
+    KEY_MAP_CANCLE=33,
+    KEY_MAP_SIM1=34,
+    KEY_MAP_SIM2=35,
+    KEY_MAP_MAX_COUNT,
+}keyMap_t;
+
+#endif
+

+ 19 - 0
bsp/air724/sdk/components/include/http_config.h

@@ -0,0 +1,19 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _HTTP_CONFIG_H_
+#define _HTTP_CONFIG_H_
+
+#define CONFIG_LWIP_HTTP_TEST
+
+
+#endif

+ 171 - 0
bsp/air724/sdk/components/include/kernel_config.h

@@ -0,0 +1,171 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _KERNEL_CONFIG_H_
+#define _KERNEL_CONFIG_H_
+
+#include "hal_config.h"
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether enable sysnv mechanism
+ */
+#define CONFIG_KERNEL_SYSNV_ENABLED
+
+/**
+ * whether to put log functions inside critical section
+ *
+ * It will introduce longer interrupt delay to put the whole log functions
+ * inside critical section. At debug, or the log buffer is non-safe, this
+ * can be defined.
+ */
+/* #undef CONFIG_KERNEL_LOG_IN_CRITICAL */
+
+/**
+ * RTOS tick Hz
+ */
+#define CONFIG_KERNEL_TICK_HZ 50
+
+/**
+ * RTOS tick relaxed time
+ *
+ * When it is 0, \p osiThreadSleep, \p osiMutexTryLock and etc. will wakeup
+ * system at sleep. Otherwise, these APIs will wakeup system with relaxed
+ * timeout to save power consumption.
+ */
+#define CONFIG_KERNEL_OSTICK_RELAXED_TIME  0
+
+/**
+ * whether \p OSI_ASSERT will panic
+ */
+#define CONFIG_KERNEL_ASSERT_ENABLED
+
+/**
+ * system minimum utc time in second
+ *
+ * \p CONFIG_KERNEL_MIN_UTC_SECOND and \p CONFIG_KERNEL_MAX_UTC_SECOND are
+ * rough check of epoch time.
+ *
+ * \code
+ * $ date -u -d "@946684800"
+ * Sat Jan  1 00:00:00 UTC 2000
+ * $ date -u -d "@4102444800"
+ * Fri Jan  1 00:00:00 UTC 2100
+ * \endcode
+ */
+#define CONFIG_KERNEL_MIN_UTC_SECOND 946684800LL
+
+/**
+ * system maximum utc time in second
+ */
+#define CONFIG_KERNEL_MAX_UTC_SECOND 4102444800LL
+
+/**
+ * whether global work queue with OSI_PRIORITY_HIGH enabled
+ */
+#define CONFIG_KERNEL_HIGH_PRIO_WQ_ENABLED
+
+/**
+ * whether global work queue with OSI_PRIORITY_LOW enabled
+ */
+#define CONFIG_KERNEL_LOW_PRIO_WQ_ENABLED
+
+/**
+ * whether global work queue for async file write enabled
+ */
+#define CONFIG_KERNEL_FILE_WRITE_WQ_ENABLED
+
+/**
+ * stack size (in bytes) of global high priority work queue
+ */
+#define CONFIG_KERNEL_HIGH_PRIO_WQ_STACKSIZE 4096
+
+/**
+ * stack size (in bytes) of global low priority work queue
+ */
+#define CONFIG_KERNEL_LOW_PRIO_WQ_STACKSIZE 4096
+
+/**
+ * stack size (in bytes) of global async file write work queue
+ */
+#define CONFIG_KERNEL_FILE_WRITE_WQ_STACKSIZE 2048
+
+/**
+ * stack size (in bytes) of timer work queue
+ */
+#define CONFIG_KERNEL_TIMER_WQ_STACKSIZE 4096
+
+/**
+ * minimum periodic timer period in milliseconds
+ */
+#define CONFIG_KERNEL_PERIODIC_TIMER_MIN_PERIOD 10
+
+/**
+ * use 32KHz tick as profile clock (8910)
+ */
+/* #undef CONFIG_KERNEL_PROFILE_CLOCK32K */
+
+/**
+ * use 2mHz tick as profile clock (8910)
+ */
+#define CONFIG_KERNEL_PROFILE_CLOCK2M
+
+/**
+ * profile buffer size in bytes
+ */
+/* #undef CONFIG_KERNEL_PROFILE_BUF_SIZE */
+
+/**
+ * use host packet, flow id 0x97 for log
+ */
+/* #undef CONFIG_KERNEL_TRACE_HOST97 */
+
+/**
+ * use host packet, flow id 0x98 for log
+ */
+#define CONFIG_KERNEL_TRACE_HOST98
+
+/**
+ * use tra packet, type 0xc8/0xc9 for log
+ */
+/* #undef CONFIG_KERNEL_TRACE_BBC8 */
+
+/**
+ * disable traceid forcedly
+ */
+/* #undef CONFIG_KERNEL_DISABLE_TRACEID */
+
+/**
+ * size in bytes for each log buffer
+ */
+#define CONFIG_KERNEL_TRACE_BUF_SIZE 0x8000
+
+/**
+ * log buffer count
+ */
+#define CONFIG_KERNEL_TRACE_BUF_COUNT 2
+
+/**
+ * count of memory allocate/free records
+ */
+#define CONFIG_KERNEL_MEM_RECORD_COUNT 1024
+
+/**
+ * whether to enable watchdog
+ *
+ * By default, watchdog will be enabled when \p BUILD_RELEASE_TYPE is
+ * "release".
+ */
+#define CONFIG_WDT_ENABLE
+
+#endif

+ 21 - 0
bsp/air724/sdk/components/include/mal_config.h

@@ -0,0 +1,21 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _MAL_CONFIG_H_
+#define _MAL_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_MAL_GET_SIM_AUTH_TIMEOUT 5000
+
+#define LOG_TAG_MAL OSI_MAKE_LOG_TAG('M', 'A', 'L', ' ')
+#endif

+ 18 - 0
bsp/air724/sdk/components/include/ml_config.h

@@ -0,0 +1,18 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _ML_CONFIG_H_
+#define _ML_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#endif

+ 20 - 0
bsp/air724/sdk/components/include/modem_config.h

@@ -0,0 +1,20 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _MODEM_CONFIG_H_
+#define _MODEM_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define NUMBER_OF_SIM CONFIG_NUMBER_OF_SIM
+
+#endif

+ 19 - 0
bsp/air724/sdk/components/include/mupnp_config.h

@@ -0,0 +1,19 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _MUPNP_CONFIG_H_
+#define _MUPNP_CONFIG_H_
+
+#define CONFIG_MUPNP_USE_OPENSSL
+
+
+#endif

+ 28 - 0
bsp/air724/sdk/components/include/net_config.h

@@ -0,0 +1,28 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _NET_CONFIG_H_
+#define _NET_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_NET_LWIP_DEBUG
+#define CONFIG_NET_TCPIP_SUPPORT
+#define CONFIG_NET_LWIP_IPV4_ON
+#define CONFIG_NET_LWIP_PPP_ON
+#define CONFIG_NET_LOG_BUF_COUNT 2
+#define CONFIG_NET_LOG_BUF_SIZE 8192
+
+#define CONFIG_NET_TRACE_IP_PACKET
+#define CONFIG_NET_NAT_SUPPORT
+
+#endif

+ 150 - 0
bsp/air724/sdk/components/include/netdb.h

@@ -0,0 +1,150 @@
+/**
+ * @file
+ * NETDB API (sockets)
+ */
+
+/*
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Simon Goldschmidt
+ *
+ */
+#ifndef LWIP_HDR_NETDB_H
+#define LWIP_HDR_NETDB_H
+
+#include "lwip/opt.h"
+
+#if LWIP_DNS && LWIP_SOCKET
+
+#include "lwip/arch.h"
+#include "lwip/inet.h"
+#include "lwip/sockets.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* some rarely used options */
+#ifndef LWIP_DNS_API_DECLARE_H_ERRNO
+#define LWIP_DNS_API_DECLARE_H_ERRNO  1
+#endif
+
+#ifndef LWIP_DNS_API_DEFINE_ERRORS
+#define LWIP_DNS_API_DEFINE_ERRORS    1
+#endif
+
+#ifndef LWIP_DNS_API_DEFINE_FLAGS
+#define LWIP_DNS_API_DEFINE_FLAGS     1
+#endif
+
+#ifndef LWIP_DNS_API_DECLARE_STRUCTS
+#define LWIP_DNS_API_DECLARE_STRUCTS  1
+#endif
+
+#if LWIP_DNS_API_DEFINE_ERRORS
+/** Errors used by the DNS API functions, h_errno can be one of them */
+#define EAI_NONAME      200
+#define EAI_SERVICE     201
+#define EAI_FAIL        202
+#define EAI_MEMORY      203
+#define EAI_FAMILY      204
+
+#define HOST_NOT_FOUND  210
+#define NO_DATA         211
+#define NO_RECOVERY     212
+#define TRY_AGAIN       213
+#endif /* LWIP_DNS_API_DEFINE_ERRORS */
+
+#if LWIP_DNS_API_DEFINE_FLAGS
+/* input flags for struct addrinfo */
+#define AI_PASSIVE      0x01
+#define AI_CANONNAME    0x02
+#define AI_NUMERICHOST  0x04
+#define AI_NUMERICSERV  0x08
+#define AI_V4MAPPED     0x10
+#define AI_ALL          0x20
+#define AI_ADDRCONFIG   0x40
+#endif /* LWIP_DNS_API_DEFINE_FLAGS */
+
+#if LWIP_DNS_API_DECLARE_STRUCTS
+struct hostent {
+    char  *h_name;      /* Official name of the host. */
+    char **h_aliases;   /* A pointer to an array of pointers to alternative host names,
+                           terminated by a null pointer. */
+    int    h_addrtype;  /* Address type. */
+    int    h_length;    /* The length, in bytes, of the address. */
+    char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
+                           network byte order) for the host, terminated by a null pointer. */
+#define h_addr h_addr_list[0] /* for backward compatibility */
+};
+
+struct addrinfo {
+    int               ai_flags;      /* Input flags. */
+    int               ai_family;     /* Address family of socket. */
+    int               ai_socktype;   /* Socket type. */
+    int               ai_protocol;   /* Protocol of socket. */
+    socklen_t         ai_addrlen;    /* Length of socket address. */
+    struct sockaddr  *ai_addr;       /* Socket address of socket. */
+    char             *ai_canonname;  /* Canonical name of service location. */
+    struct addrinfo  *ai_next;       /* Pointer to next in list. */
+};
+#endif /* LWIP_DNS_API_DECLARE_STRUCTS */
+
+#define NETDB_ELEM_SIZE           (sizeof(struct addrinfo) + sizeof(struct sockaddr_storage) + DNS_MAX_NAME_LENGTH + 1)
+
+#if LWIP_DNS_API_DECLARE_H_ERRNO
+/* application accessible error code set by the DNS API functions */
+extern int h_errno;
+#endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
+
+struct hostent *lwip_gethostbyname(const char *name);
+int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
+                size_t buflen, struct hostent **result, int *h_errnop);
+void lwip_freeaddrinfo(struct addrinfo *ai);
+int lwip_getaddrinfo(const char *nodename,
+       const char *servname,
+       const struct addrinfo *hints,
+       struct addrinfo **res);
+
+#if LWIP_COMPAT_SOCKETS
+/** @ingroup netdbapi */
+#define gethostbyname(name) lwip_gethostbyname(name)
+/** @ingroup netdbapi */
+#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
+       lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
+/** @ingroup netdbapi */
+#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
+/** @ingroup netdbapi */
+#define getaddrinfo(nodname, servname, hints, res) \
+       lwip_getaddrinfo(nodname, servname, hints, res)
+#endif /* LWIP_COMPAT_SOCKETS */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LWIP_DNS && LWIP_SOCKET */
+
+#endif /* LWIP_HDR_NETDB_H */

+ 22 - 0
bsp/air724/sdk/components/include/nvm_config.h

@@ -0,0 +1,22 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _NVM_CONFIG_H_
+#define _NVM_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#ifdef CONFIG_SOC_8910
+/* #undef CONFIG_NON_BL_CE_SUPPORT */
+#endif
+
+#endif

+ 11 - 0
bsp/air724/sdk/components/include/openat_config.h

@@ -0,0 +1,11 @@
+#ifndef _OPENAT_CONFIG_H_
+#define _OPENAT_CONFIG_H_
+
+
+
+
+#define CONFIG_AM_SPEEX_SUPPORT on
+
+
+
+#endif

+ 2625 - 0
bsp/air724/sdk/components/include/osi_api.h

@@ -0,0 +1,2625 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _OSI_API_H_
+#define _OSI_API_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include "kernel_config.h"
+#include "osi_compiler.h"
+#include "osi_vsmap.h"
+#include "osi_clock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OSI_WAIT_FOREVER (-1U)
+#define OSI_DELAY_MAX (-1U)
+
+/**
+ * Special value to indicate timer callback will be invoked in
+ * timer ISR.
+ */
+#define OSI_TIMER_IN_ISR ((osiThread_t *)NULL)
+
+/**
+ * Special value to indicate timer callback will be invoked in
+ * timer service thread.
+ */
+#define OSI_TIMER_IN_SERVICE ((osiThread_t *)0xffffffff)
+
+/**
+ * reserved event id to indicate quit event loop
+ */
+#define OSI_EVENT_ID_QUIT (8)
+
+/**
+ * elapsed timer for couting elapsed time
+ */
+typedef uint32_t osiElapsedTimer_t;
+
+/**
+ * opaque data structure for timer
+ */
+typedef struct osiTimer osiTimer_t;
+
+/**
+ * opaque data structure for timer pool
+ */
+typedef struct osiTimerPool osiTimerPool_t;
+
+/**
+ * opaque data structure for thread
+ */
+typedef struct osiThread osiThread_t;
+
+/**
+ * opaque data structure for message queue
+ */
+typedef struct osiMessageQueue osiMessageQueue_t;
+
+/**
+ * opaque data structure for event queue
+ *
+ * Event queue is just a message queue, and the message is \p osiEvent_t
+ * (event itself rather than pointer).
+ */
+typedef struct osiEventQueue osiEventQueue_t;
+
+/**
+ * opaque data structure for mutex
+ */
+typedef struct osiMutex osiMutex_t;
+
+/**
+ * opaque data structure for semaphore
+ */
+typedef struct osiSemaphore osiSemaphore_t;
+
+/**
+ * opaque data structure for work
+ */
+typedef struct osiWork osiWork_t;
+
+/**
+ * opaque data structure for work queue
+ */
+typedef struct osiWorkQueue osiWorkQueue_t;
+
+/**
+ * opaque data structure for thread notify
+ */
+typedef struct osiNotify osiNotify_t;
+
+/**
+ * function type of callback
+ */
+typedef void (*osiCallback_t)(void *ctx);
+
+/**
+ * function type of thread entry
+ */
+typedef void (*osiThreadEntry_t)(void *argument);
+
+/**
+ * function type of interrupt handler
+ */
+typedef void (*osiIrqHandler_t)(void *ctx);
+
+/**
+ * event, with ID and 3 parameters
+ */
+typedef struct osiEvent
+{
+    uint32_t id;     ///< event identifier
+    uint32_t param1; ///< 1st parameter
+    uint32_t param2; ///< 2nd parameter
+    uint32_t param3; ///< 3rd parameter
+} osiEvent_t;
+
+/**
+ * thread priority
+ *
+ * The definition is independent of implementation. Though some
+ * implementation will use larger value for higher priority and
+ * others will use smaller value for highe priority, this enum will
+ * use larger value for higher priority.
+ *
+ * \p OSI_PRIORITY_IDLE and \p OSI_PRIORITY_HISR are reserved, can't
+ * be used.
+ *
+ * The definition is the same as CMSIS-RTOS.
+ */
+typedef enum osiThreadPriority
+{
+    OSI_PRIORITY_IDLE = 1, // reserved
+    OSI_PRIORITY_LOW = 8,
+    OSI_PRIORITY_BELOW_NORMAL = 16,
+    OSI_PRIORITY_NORMAL = 24,
+    OSI_PRIORITY_ABOVE_NORMAL = 32,
+    OSI_PRIORITY_HIGH = 40,
+    OSI_PRIORITY_REALTIME = 48,
+    OSI_PRIORITY_HISR = 56, // reserved
+} osiThreadPriority_t;
+
+/**
+ * suspend mode
+ *
+ * System behavior of suspend modes will be diffrent among underlay
+ * platform. Driver shall take care the difference, and most likely
+ * application won't take care it.
+ */
+typedef enum osiSuspendMode
+{
+    OSI_SUSPEND_PM1, ///< 1st level suspend mode
+    OSI_SUSPEND_PM2  ///< 2nd level suspend mode
+} osiSuspendMode_t;
+
+/**
+ * resume wakeup source
+ *
+ * Resume wakeup source depends on platform. They should be defined in
+ * \p hal_chip.h. One bit indicates one source, and multiple sources are
+ * possible. \p OSI_RESUME_ABORT is reserved to indicate suspend is
+ * aborted.
+ */
+typedef enum osiResumeSource
+{
+    OSI_RESUME_ABORT = (1 << 31), ///< resume by suspend aborted
+} osiResumeSource_t;
+
+/**
+ * \brief boot cause
+ *
+ * This list is for cold boot cause. Though it is rare, it is possible
+ * there exist multiple boot causes simultanuously.
+ *
+ * Usually boot cause is determined from hardware status registers.
+ */
+typedef enum osiBootCause
+{
+    OSI_BOOTCAUSE_UNKNOWN = 0,           ///< placeholder for unknown reason
+    OSI_BOOTCAUSE_PWRKEY = (1 << 0),     ///< boot by power key
+    OSI_BOOTCAUSE_PIN_RESET = (1 << 1),  ///< boot by pin reset
+    OSI_BOOTCAUSE_ALARM = (1 << 2),      ///< boot by alarm
+    OSI_BOOTCAUSE_CHARGE = (1 << 3),     ///< boot by charge in
+    OSI_BOOTCAUSE_WDG = (1 << 4),        ///< boot by watchdog
+    OSI_BOOTCAUSE_PIN_WAKEUP = (1 << 5), ///< boot by wakeup
+    OSI_BOOTCAUSE_PSM_WAKEUP = (1 << 6), ///< boot from PSM wakeup
+    /*+\NEW\zhuwangbin\2020.04.04\区分软件重启和reset按键重启*/
+    OSI_BOOTCAUSE_RESET = (1 << 7),   
+    /*-\NEW\zhuwangbin\2020.04.04\区分软件重启和reset按键重启*/
+} osiBootCause_t;
+
+/**
+ * boot mode
+ *
+ * Besides normal boot, there are several other boot modes. For each
+ * platform, not all boot modes are supported.
+ *
+ * Usually, boot mode can be determined by hardware (for example, some
+ * GPIO) or software (for example, by flags written at \p osiShutdown).
+ */
+typedef enum osiBootMode
+{
+    OSI_BOOTMODE_NORMAL = 0,           ///< normal boot
+    OSI_BOOTMODE_DOWNLOAD = 0x444e,    ///< 'DN' boot to download mode
+    OSI_BOOTMODE_CALIB = 0x434c,       ///< 'CL' boot to calibration mode
+    OSI_BOOTMODE_CALIB_POST = 0x4350,  ///< 'CP' boot to calibration post mode
+    OSI_BOOTMODE_NB_CALIB = 0x4e43,    ///< 'NC' boot to NB calibration mode
+    OSI_BOOTMODE_BBAT = 0x4241,        ///< 'BA' boot to BBAT mode
+    OSI_BOOTMODE_UPGRADE = 0x4654,     ///< 'FT' boot to bootloader upgrade
+    OSI_BOOTMODE_PSM_RESTORE = 0x5053, ///< 'PS' boot to PSM restore
+} osiBootMode_t;
+
+/**
+ * shudown mode
+ *
+ * For each platform, not all shutdown modes are supported.
+ */
+typedef enum osiShutdownMode
+{
+    OSI_SHUTDOWN_RESET = 0,               ///< normal reset
+    OSI_SHUTDOWN_FORCE_DOWNLOAD = 0x5244, ///< 'RD' reset to force download mode
+    OSI_SHUTDOWN_DOWNLOAD = 0x444e,       ///< 'DN' reset to download mode
+    OSI_SHUTDOWN_CALIB_MODE = 0x434c,     ///< 'CL' reset to calibration mode
+    OSI_SHUTDOWN_NB_CALIB_MODE = 0x4e43,  ///< 'NC' reset to NB calibration mode
+    OSI_SHUTDOWN_BBAT_MODE = 0x4241,      ///< 'BA' reset to BBAT mode
+    OSI_SHUTDOWN_UPGRADE = 0x4654,        ///< 'FT' reset to upgrade mode
+    OSI_SHUTDOWN_POWER_OFF = 0x4f46,      ///< 'OF' power off
+    OSI_SHUTDOWN_PSM_SLEEP = 0x5053,      ///< 'PS' power saving mode
+} osiShutdownMode_t;
+
+/**
+ * PSM data owner
+ */
+typedef enum osiPsmDataOwner
+{
+    OSI_PSMDATA_OWNER_KERNEL,     ///< kernel
+    OSI_PSMDATA_OWNER_STACK,      ///< stack
+    OSI_PSMDATA_OWNER_AT,         ///< AT engine
+    OSI_PSMDATA_OWNER_USER = 100, ///< start owner for user application
+} osiPsmDataOwner_t;
+
+/**
+ * shuwdown callback function type
+ *
+ * Before shutdown, the registered callbacks will be invokes. The callbacks
+ * are executed in system high priority work queue, and with interrupt
+ * disabled. So, the callbacks shouldn't rely on system high priority work
+ * queue and interrupts. However, thread schedule is still working and
+ * multi-thread can work still.
+ */
+typedef void (*osiShutdownCallback_t)(void *ctx, osiShutdownMode_t mode);
+
+/**
+ * invoke global constructors
+ *
+ * Global constructors are not called during boot. Rather, they will be called
+ * in \p osiInvokeGlobalCtors, and it shall be called in \p osiAppStart.
+ *
+ * At \p osiAppStart, RTOS is ready. So, it is permitted to call more OSI
+ * APIs at global constructors.
+ *
+ * Though global constructors are supported. It is not encouraged to use this
+ * feature. Only use this feature when you really know what you are doing.
+ */
+void osiInvokeGlobalCtors(void);
+
+/**
+ * kernel start
+ *
+ * Start the kernel. This API will create system threads (at least,
+ * idle thread) and start thread scheduler. So, it won't return.
+ *
+ * Before \p osiKernelStart is called, kernel data structure may be
+ * uninitialized, and many osi APIs can be called. Including
+ *
+ * - timer
+ * - IRQ
+ * - power management
+ */
+OSI_NO_RETURN void osiKernelStart(void);
+
+/**
+ * suspend thread scheduler
+ *
+ * After scheduler is suspended, there are no thread context switch.
+ * However, interrupt handlers will be executed.
+ *
+ * The meaning of return flag depends on underlay RTOS. Don't assume the
+ * meaning of the return value.
+ *
+ * \return  scheduler suspend flag.
+ */
+uint32_t osiSchedulerSuspend(void);
+
+/**
+ * resume thread scheduler
+ *
+ * Scheduler suspend and resume is not *recursive*. That is, after
+ * \p osiSchedulerResume is called, scheduler is resumed no matter
+ * how many times \p osiSchedulerSuspend are called.
+ *
+ * \param [in] flag     scheduler suspend flag returned by the latest
+ *                      \p osiSchedulerSuspend
+ */
+void osiSchedulerResume(uint32_t flag);
+
+/**
+ * \brief enter critical section
+ *
+ * The underlay RTOS may have different implementation for critical
+ * section. It may manipulate CPU IRQ enable bit(s), or manipulate
+ * IRQ mask.
+ *
+ * This can be called in ISR.
+ *
+ * \return  critical section flags
+ */
+uint32_t osiEnterCritical(void);
+
+/**
+ * \brief exit critical section
+ *
+ * Critical section flags is implementation depend. It should be the value
+ * returned by \p osiEnterCritical, and don't change the value manually.
+ *
+ * Critical section is *recursive*. That is, after \p osiExitCritical is
+ * called, it doesn't mean system will enter *unprotected* state. Rather,
+ * it will return to state before last call of \p osiEnterCritical.
+ * For example:
+ *
+ * \code{.cpp}
+ * uint32_t critical1 = osiEnterCritical();
+ * uint32_t critical2 = osiEnterCritical();
+ * // ...
+ * osiExitCritical(critical2);
+ * osiExitCritical(critical1);
+ * \endcode
+ *
+ * After the first call of \p osiExitCritical, system is in *protected*
+ * state still.
+ *
+ * In recursive, the exit order must be the reverse order of enter. For
+ * example, the following codes are wrong:
+ *
+ * \code{.cpp}
+ * uint32_t critical1 = osiEnterCritical();
+ * uint32_t critical2 = osiEnterCritical();
+ * // ...
+ * osiExitCritical(critical1);
+ * osiExitCritical(critical2);
+ * \endcode
+ *
+ * This can be called in ISR.
+ *
+ * \param critical  critical section flags
+ */
+void osiExitCritical(uint32_t critical);
+
+/**
+ * \brief get IRQ flags and disable IRQ
+ *
+ * This will always manipulate CPU IRQ enable bit(s).
+ *
+ * After this call, \p osiEnterCritical can't be called. When
+ * \p osiEnterCritical manipulates IRQ mask, it is very possible that
+ * it will change CPU IRQ enable bit(s) without protection.
+ *
+ * In most cases, \p osiIrqSave and \p osiIrqRestore shouldn't be
+ * used, unless you really know what you are doing.
+ *
+ * \return  IRQ flags before disable IRQ
+ */
+uint32_t osiIrqSave(void);
+
+/**
+ * \brief restore IRQ flags
+ *
+ * IRQ flags is arch and implementation depend. It should be the value
+ * returned by \p osiIrqSave, and don't change the value manually.
+ *
+ * \param flags IRQ flags
+ */
+void osiIrqRestore(uint32_t flags);
+
+/**
+ * set interrupt handler
+ *
+ * When interrupt arrived, the registered handler will be called with
+ * the registered context pointer.
+ *
+ * For each interrupt, only one handler can be registered. When a handler
+ * is already registered for an interrupt, \p osiIrqSetHandler will
+ * replace the old one.
+ *
+ * \p irqn depends on interrupt controller in system. When GIC is used,
+ * it is the number in GIC.
+ *
+ * \param irqn      IRQ number
+ * \param handler   IRQ handler
+ * \param ctx       IRQ handler context pointer
+ * \return
+ *      - true on success
+ *      - false on invalid parameters
+ */
+bool osiIrqSetHandler(uint32_t irqn, osiIrqHandler_t handler, void *ctx);
+
+/**
+ * enable interrupt
+ *
+ * \param irqn      IRQ number
+ * \return
+ *      - true on success
+ *      - false on invalid parameters
+ */
+bool osiIrqEnable(uint32_t irqn);
+
+/**
+ * disable interrupt
+ *
+ * \param irqn      IRQ number
+ * \return
+ *      - true on success
+ *      - false on invalid parameters
+ */
+bool osiIrqDisable(uint32_t irqn);
+
+/**
+ * whether interrupt is enabled
+ *
+ * \param irqn      IRQ number
+ * \return
+ *      - true if interrupt is enabled
+ *      - false if interrupt is disabled
+ */
+bool osiIrqEnabled(uint32_t irqn);
+
+/**
+ * set interrupt priority
+ *
+ * \p priority depends on interrupt controller used on system. When GIC
+ * is used, \p priority should follow GIC requirement and meaning.
+ *
+ * \param irqn      IRQ number
+ * \param priority  IRQ priority
+ * \return
+ *      - true on success
+ *      - false on invalid parameters
+ */
+bool osiIrqSetPriority(uint32_t irqn, uint32_t priority);
+
+/**
+ * get interrupt priority
+ *
+ * When \p irqn is invalid, 0x80000000U will be returned.
+ *
+ * \param irqn      IRQ number
+ * \return      IRQ priority
+ */
+uint32_t osiIrqGetPriority(uint32_t irqn);
+
+/**
+ * check whether there are pending interrupt
+ *
+ * This is for special purpose. It shall be called with interrupt disabled
+ * (not masked off).
+ *
+ * This may be unimplemented in some chips.
+ *
+ * \return
+ *      - true if there are interrupt pending.
+ */
+bool osiIrqPending(void);
+
+/**
+ * enable D-cache
+ *
+ * Usually, it shouldn't be called in application. It will only be called
+ * once in boot code.
+ *
+ * Not all platforms implement this API.
+ */
+void osiDCacheEnable(void);
+
+/**
+ * disable D-cache
+ *
+ * Usually, it shouldn't be called in application. And most likely it will
+ * never be called. It is provided for completeness.
+ *
+ * Not all platforms implement this API.
+ */
+void osiDCacheDisable(void);
+
+/**
+ * enable I-cache
+ *
+ * Usually, it shouldn't be called in application. It will only be called
+ * once in boot code.
+ *
+ * Not all platforms implement this API.
+ */
+void osiICacheEnable(void);
+
+/**
+ * disable I-cache
+ *
+ * Usually, it shouldn't be called in application. And most likely it will
+ * never be called. It is provided for completeness.
+ *
+ * Not all platforms implement this API.
+ */
+void osiICacheDisable(void);
+
+/**
+ * clean (write back) D-cache
+ *
+ * Usually it shall be called **before** the cachable memory will be read by
+ * not cache coherent hardware.
+ *
+ * D-cache clean will operate by cache line. So, is the memory range is
+ * not cache line aligned, other memory on the cache line will be cleaned
+ * also. For example, assuming D-cache line size is 32 byte,
+ * \p osiDCacheClean((void *)8, 32) will clean [0-8], [40-64] also.
+ *
+ * When D-cache coherence is needed to be considered, it is recommended to
+ * declare or allocate memory by the following:
+ *
+ * \code{.cpp}
+ * char mem1[SIZE] OSI_CACHE_LINE_ALIGNED;
+ * void *mem2 = memalign(CONFIG_CACHE_LINE_SIZE, size);
+ * \endcode
+ *
+ * \param address   starting address to be cleaned
+ * \param size      size to be cleaned
+ */
+void osiDCacheClean(const void *address, size_t size);
+
+/**
+ * invalidate D-cache
+ *
+ * Usually it shall be called **before** the cachable memory will be write by
+ * not cache coherent hardware.
+ *
+ * D-cache line alignment is very important for \p osiDCacheInvalidate.
+ * Otherwise, other memory on the cache line will be changed randomly.
+ *
+ * \param address   starting address to be cleaned
+ * \param size      size to be cleaned
+ */
+void osiDCacheInvalidate(const void *address, size_t size);
+
+/**
+ * clean and invalidate D-cache
+ *
+ * \param address   starting address to be cleaned
+ * \param size      size to be cleaned
+ */
+void osiDCacheCleanInvalidate(const void *address, size_t size);
+
+/**
+ * invalidate D-cache range
+ *
+ * \param address   starting address to be cleaned
+ * \param size      size to be cleaned
+ */
+void osiICacheInvalidate(const void *address, size_t size);
+
+/**
+ * sync D-cahce with I-cache
+ *
+ * It shall be called after code memory is operated as data (such as,
+ * copy codes from flash to RAM).
+ *
+ * \param address   starting address to be cleaned
+ * \param size      size to be cleaned
+ */
+void osiICacheSync(const void *address, size_t size);
+
+/**
+ * clean all D-cache
+ */
+void osiDCacheCleanAll(void);
+
+/**
+ * invalidate all D-cache
+ */
+void osiDCacheInvalidateAll(void);
+
+/**
+ * clean and invalidate all D-cache
+ */
+void osiDCacheCleanInvalidateAll(void);
+
+/**
+ * invalidate all I-cache
+ */
+void osiICacheInvalidateAll(void);
+
+/**
+ * sync D-cahce with I-cache for all
+ */
+void osiICacheSyncAll(void);
+
+/**
+ * create a thread
+ *
+ * Each \p osiThread_t will have an event queue. So, the event queue
+ * depth should be specified at creation.
+ *
+ * \p name will be copied to thread control block. So, \p name can be dynamic
+ * memory.
+ *
+ * After a thread is created, it will be executed immediately. So, it is
+ * possible that \p entry will be executed before the return value is
+ * assigned to some variable, if the new thread priority is higher than
+ * current thread priority. Pay attention to use thread pointer in
+ * \p entry.
+ *
+ * \code{.cpp}
+ * void entry(void *argument) {
+ *     osiThread_t *thread = osiThreadCurrent();
+ *     for (;;) {
+ *         osiEvent_t event = {};
+ *         osiEventWait(thread, &event);
+ *         ......
+ *     }
+ * }
+ * \endcode
+ *
+ * In some underlay RTOS, there are limitation on maximum stack size.
+ * For example, when \p configSTACK_DEPTH_TYPE is defined as \p uint16_t,
+ * the stack size must be less than 64KB*4.
+ *
+ * \param name      thread name
+ * \param entry     thread entry function
+ * \param argument  thread entry function argument
+ * \param priority  thread priority
+ * \param stack_size    thread stack size in byte
+ * \param event_count   thread event queue depth (count of events can be hold)
+ * \return
+ *      - thread pointer
+ *      - NULL if failed
+ */
+osiThread_t *osiThreadCreate(const char *name, osiThreadEntry_t entry, void *argument,
+                             uint32_t priority, uint32_t stack_size,
+                             uint32_t event_count);
+
+/*+\new\rww\2020.4.14\添加线程创建接口*/
+osiThread_t *osiThreadCreateNotSuspendScheduler(const char *name, osiCallback_t func, void *argument,
+										uint32_t priority, uint32_t stack_size,
+										uint32_t event_count);
+/*-\new\rww\2020.4.14\添加线程创建接口*/
+
+/**
+ * create a thread with specified stack
+ *
+ * It is similar to \p osiThreadCreate, and the stack won't be dynamic created.
+ * Rather, the specified buffer \p stack will be used at the stack of the
+ * thread. Typical usage is to create performance sensitive thread, and set stack
+ * in SRAM to improve performance.
+ *
+ * Application should always use \p osiThreadCreate. It may be unimplemented on
+ * some platforms.
+ *
+ * \param name      thread name
+ * \param entry     thread entry function
+ * \param argument  thread entry function argument
+ * \param priority  thread priority
+ * \param stack     thread stack buffer, must be valid
+ * \param stack_size    thread stack size in byte
+ * \param event_count   thread event queue depth (count of events can be hold)
+ * \return
+ *      - thread pointer
+ *      - NULL if failed
+ */
+osiThread_t *osiThreadCreateWithStack(const char *name, osiThreadEntry_t entry, void *argument,
+                                      uint32_t priority, void *stack, uint32_t stack_size,
+                                      uint32_t event_count);
+
+/**
+ * get event queue of thread
+ *
+ * When \p thread is NULL, return the event queue of current thread.
+ *
+ * \param thread    thread pointer
+ * \return      event queue of the thread
+ */
+osiEventQueue_t *osiThreadEventQueue(osiThread_t *thread);
+
+/**
+ * get current thread pointer
+ *
+ * \return      current thread pointer
+ */
+osiThread_t *osiThreadCurrent(void);
+
+/**
+ * set whether current thread need FPU
+ *
+ * By default, FPU isn't permitted for new created thread. To enable FPU,
+ * \p osiThreadSetFPUEnabled(true) should be called before floating point
+ * instructions.
+ *
+ * Though it is possible to call \p osiThreadSetFPUEnabled(false) if it is
+ * known that floating point instructions won't be used any more, it is not
+ * necessary. It will only increase a little context save and restore cycles.
+ * Typical usage it to call \p osiThreadSetFPUEnabled(true) at the beginning
+ * of thread entry.
+ *
+ * It is undefined if thread uses floating point instructions whthout call
+ * of \p osiThreadSetFPUEnabled(true).
+ *
+ * \param enabled   true for enable FPU, false for disable FPU.
+ */
+void osiThreadSetFPUEnabled(bool enabled);
+
+/**
+ * get thread priority
+ *
+ * When \p thread is NULL, return the priotity of current thread.
+ *
+ * \param thread    thread pointer
+ * \return      priotity of the thread
+ */
+uint32_t osiThreadPriority(osiThread_t *thread);
+
+/**
+ * set thread priority
+ *
+ * When \p thread is NULL, set the priotity of current thread.
+ *
+ * After the priority changed, it is possible thread context switch
+ * will occur. However, don't depend on this feature.
+ *
+ * \param thread    thread pointer
+ * \param priority  priority to be set
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiThreadSetPriority(osiThread_t *thread, uint32_t priority);
+
+/**
+ * suspend a thread
+ *
+ * When \p thread is NULL, suspend current thread.
+ *
+ * \param thread    thread pointer
+ */
+void osiThreadSuspend(osiThread_t *thread);
+
+/**
+ * resume a thread
+ *
+ * \p thread can't be NULL.
+ *
+ * \param thread    thread pointer
+ */
+void osiThreadResume(osiThread_t *thread);
+
+/**
+ * current thread yield
+ *
+ * When there are threads with the same priority, other threads will
+ * be scheduled.
+ */
+void osiThreadYield(void);
+
+/**
+ * current thread sleep
+ *
+ * Change current thread into sleep mode, and will be rescheduled
+ * after the specified period.
+ *
+ * This will use the underlay RTOS mechanism. It is possible the sleep
+ * time precision is the tick of underlay RTOS.
+ *
+ * \param ms        sleep time in milliseconds
+ */
+void osiThreadSleep(uint32_t ms);
+
+/**
+ * current thread sleep with relaxed timeout
+ *
+ * It is a power optimization version of \p osiThreadSleep. Due to power
+ * saving, it is possible that current thread will be wakeup later then
+ * *normal timeout*, but it will wakeup no later than *relaxed timeout*
+ * even system will enter suspend.
+ *
+ * When \p relax_ms is \p OSI_DELAY_MAX, it means it can be ignored
+ * completed for power saving. However, after system is awoken, the thread
+ * will be wakeup still if the *normal timeout* is expired.
+ *
+ * \param ms        sleep time in milliseconds
+ * \param relax_ms  relaxed sleep time in milliseconds
+ */
+void osiThreadSleepRelaxed(uint32_t ms, uint32_t relax_ms);
+
+/**
+ * thread stack unused space
+ *
+ * It needs underlay RTOS support. When the underlay RTOS doesn't support
+ * this feature, it returns 0.
+ *
+ * The typical method to support this feature in underlay RTOS is to check
+ * stack content, and comparing with preset magic byte or word.
+ *
+ * It is recommended to use it only for debug.
+ *
+ * \param thread    thread pointer, NULL for current thread
+ * \return
+ *      - thread stack unused space in bytes
+ *      - 0 if the underlay RTOS doesn't support this feature
+ */
+uint32_t osiThreadStackUnused(osiThread_t *thread);
+
+/**
+ * space from current stack pointer to current thread stack end
+ *
+ * When \p refill is true, the current stack space will be fill with magic
+ * byte or word for measuring unused stack. When underlay RTOS doesn't
+ * support feature to measure stack remain, \p refill will be ignored.
+ *
+ * It is recommended to use it only for debug.
+ *
+ * \return
+ *      - space to current thread stack end, in bytes
+ */
+uint32_t osiThreadStackCurrentSpace(bool refill);
+
+/**
+ * current thread exit
+ *
+ * When a thread is finished, \p osiThreadExit must be called. And
+ * kernel will release thread resources at appropriate time.
+ */
+OSI_NO_RETURN void osiThreadExit(void);
+
+/**
+ * show thread information through trace
+ *
+ * It is for debug purpose only.
+ */
+void osiShowThreadState(void);
+
+/**
+ * send an event to a thread
+ *
+ * At send, the body of \p event will be copied to event queue
+ * rather then send the pointer of \p event.
+ *
+ * When event queue of the target thread is full, the caller thread
+ * will be block until there are rooms in target thread event queue.
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param event     event to be sent
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiEventSend(osiThread_t *thread, const osiEvent_t *event);
+
+/**
+ * send event loop quit event to a thread
+ *
+ * This is the normalized method to notify a thread to quit. When \p thread
+ * is the current thread, \p wait can't be true.
+ *
+ * \code{.cpp}
+ *     // caller thread
+ *     osiSendQuitEvent(thread);
+ *
+ *     // thread to quit
+ *     for (;;) {
+ *         osiEvent_t event = {};
+ *         osiEventWait(thread, &event);
+ *         if (event.id == OSI_EVENT_ID_QUIT)
+ *             break;
+ *
+ *         // ......
+ *     }
+ *     osiThreadExit();
+ * \endcode
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param wait      whether to wait thread exit
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiSendQuitEvent(osiThread_t *thread, bool wait);
+
+/**
+ * send an event to a thread with timeout
+ *
+ * When \p timeout is 0, this will return false immediately. When \p timeout
+ * is \p OSI_WAIT_FOREVER, this will wait forever until there are
+ * rooms in target thread event queue.
+ *
+ * This can be called in ISR. And in ISR, \p timeout must be 0.
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param event     event to be sent
+ * \param timeout   timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter, or timeout
+ */
+bool osiEventTrySend(osiThread_t *thread, const osiEvent_t *event, uint32_t timeout);
+
+/**
+ * wait an event
+ *
+ * Wait an event from current thread event queue. When current thread
+ * event queue is empty, it will be blocked forever until there are
+ * event in event queue.
+ *
+ * The event body will be copied to \p event.
+ *
+ * There are some event ID used by system. After system event is received
+ * and process, this will return an event with ID of 0. Application can
+ * ignore event ID 0 safely.
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param event     event pointer
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiEventWait(osiThread_t *thread, osiEvent_t *event);
+
+/**
+ * wait an event with timeout
+ *
+ * When \p timeout is 0, this will return false immediately. When \p timeout
+ * is \p OSI_WAIT_FOREVER, this will wait forever until there are
+ * events in target thread event queue.
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param event     event pointer
+ * \param timeout   timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter, or timeout
+ */
+bool osiEventTryWait(osiThread_t *thread, osiEvent_t *event, uint32_t timeout);
+
+/**
+ * whether there are pending event in event queue
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \return
+ *      - true if there are pending event
+ *      - false if not
+ */
+bool osiEventPending(osiThread_t *thread);
+
+/**
+ * set callback to be executed on thread
+ *
+ * Thread callback is implemented by \p osiEvent_t.
+ *
+ * This can be called in ISR. In ISR, the callback event will be lost when
+ * the event queue of target thread is full.
+ *
+ * \param thread    thread pointer, can't be NULL
+ * \param cb        callback to be executed
+ * \param cb_ctx    callback context
+ * \return
+ *      - true on success
+ *      - false on invalid parameter, or event queue is full in ISR
+ */
+bool osiThreadCallback(osiThread_t *thread, osiCallback_t cb, void *cb_ctx);
+
+/**
+ * \brief create a work
+ *
+ * \p run can't be NULL, and \p complete can be NULL.
+ *
+ * \param run       execute function of the work
+ * \param complete  callback to be invoked after the work is finished
+ * \param ctx       context of \p run and \p complete
+ * \return
+ *      - the created work
+ *      - NULL if invalid parameter or out of memory
+ */
+osiWork_t *osiWorkCreate(osiCallback_t run, osiCallback_t complete, void *ctx);
+
+/**
+ * \brief delete the work
+ *
+ * When \p work is running when it is called, it will be deleted after the
+ * current run finished.
+ *
+ * \param work      the work to be deleted
+ */
+void osiWorkDelete(osiWork_t *work);
+
+/**
+ * \brief enqueue a work in specified work queue
+ *
+ * When \p work is running, it will be queued to \wq again and then it
+ * will be invoked again.
+ *
+ * When \p work is queued, and \p wq is the same as original work queue,
+ * nothing will be done. When \p wq is not the same as the original
+ * work queue, it will be removed from the original work queue, and
+ * queue the work into the specified work queue.
+ *
+ * This can be called in ISR.
+ *
+ * \param work      the work pointer, must be valid
+ * \param wq        work queue to run the work, must be valid
+ * \return
+ *      - true on success
+ *      - false for invalid parameter, or work is running
+ */
+bool osiWorkEnqueue(osiWork_t *work, osiWorkQueue_t *wq);
+
+/**
+ * \brief enqueue a work in the last of specified work queue
+ *
+ * It is similar to \p osiWorkEnqueue, except it will consider work order.
+ * For example:
+ *
+ * \code{.cpp}
+ *      osiWorkEnqueue(work1, wq);
+ *      osiWorkEnqueue(work2, wq);
+ *      osiWorkEnqueue(work1, wq);
+ * \encode
+ *
+ * If work queue is busy on another work during these calls, and when work
+ * queue processing these works, it will:
+ * - execute work1->callback
+ * - execute work2->callback
+ *
+ * So, even the order of works aren't preserved. \p work1 is the last queued
+ * work, and the real last executed work is \p work2.
+ *
+ * With \p osiWorkEnqueueLast, it will ensure that the last queued work will
+ * be executed at the last.
+ *
+ * \param work      the work pointer, must be valid
+ * \param wq        work queue to run the work, must be valid
+ * \return
+ *      - true on success
+ *      - false for invalid parameter, or work is running
+ */
+bool osiWorkEnqueueLast(osiWork_t *work, osiWorkQueue_t *wq);
+
+/**
+ * \brief cancel a work
+ *
+ * When \p work is running, the current execution won't be interrupted.
+ *
+ * \param work      the work pointer, must be valid
+ */
+void osiWorkCancel(osiWork_t *work);
+
+/**
+ * \brief wait a work finish
+ *
+ * When \p work is running or enqued, this will wait the work finish.
+ * When \p timeout is 0, it will return immediately. When \p timeout
+ * is \p OSI_WAIT_FOREVER, it will wait infinitely until the work is
+ * finished.
+ *
+ * \param work      the work pointer, must be valid
+ * \param timeout   wait timeout
+ * \return
+ *      - true if the work is finished
+ *      - false on invalid parameter, or wait timeout
+ */
+bool osiWorkWaitFinish(osiWork_t *work, unsigned timeout);
+
+/**
+ * \brief create work queue
+ *
+ * Multiple threads can be created to reduce work execution latency. For
+ * example, when one thread in a work queue is blocked, other threads of
+ * the work queue can execute other works queued to the work queue.
+ *
+ * The maximum thread count is implementation dependent. So, it is possible
+ * that the created thread count is less than \p thread_count. And also it is
+ * possible that \p thread_count is ignored.
+ *
+ * The created threads have the same priority and stack size.
+ *
+ * The work queue thread entry function can't be customized
+ *
+ * \param name      work queue name
+ * \param thread_count  thread count to be created for the work queue
+ * \param priority  work queue thread priority
+ * \param stack_size    thread stack size in byte
+ * \return
+ *      - the work queue pointer
+ *      - NULL if failed
+ */
+osiWorkQueue_t *osiWorkQueueCreate(const char *name, size_t thread_count, uint32_t priority, uint32_t stack_size);
+
+/**
+ * \brief delete work queue
+ *
+ * All resources of the work queue will be deleted.
+ *
+ * The works in running will continue, and \p complete will be invoked as
+ * normal. However, queued work in the work queue won't be executed any more.
+ *
+ * \param wq    work queue to be deleted
+ */
+void osiWorkQueueDelete(osiWorkQueue_t *wq);
+
+/**
+ * \brief get the system high priority work queue
+ *
+ * A work queue with priority \p OSI_PRIORITY_HIGH will be created at kernel
+ * start.
+ *
+ * \return  the system high priority work queue
+ */
+osiWorkQueue_t *osiSysWorkQueueHighPriority(void);
+
+/**
+ * \brief get the system low priority work queue
+ *
+ * A work queue with priority \p OSI_PRIORITY_LOW will be created at kernel
+ * start.
+ *
+ * \return  the system low priority work queue
+ */
+osiWorkQueue_t *osiSysWorkQueueLowPriority(void);
+
+/**
+ * \brief get the system work queue for asynchronuous file system write
+ *
+ * A work queue with priority \p OSI_PRIORITY_BELOW_NORMAL will be created
+ * at kernel start. This work queue shall be used for asynchronuous file
+ * system write.
+ *
+ * Usually file write is slow, especially for file system on NOR flash.
+ * When faster response is needed, file write can be deferred to this
+ * work queue. Also, the work queue will be flushed before system shutdown.
+ *
+ * \return  the system file write work queue
+ */
+osiWorkQueue_t *osiSysWorkQueueFileWrite(void);
+
+/**
+ * \brief create a thread notify
+ *
+ * Thread notify is thread callback with state to avoid duplicated event
+ * to be sent to thread event queue.
+ *
+ * \param thread    thread to execute the callback, can't be NULL
+ * \param cb        callback to be executed, can't be NULL
+ * \param ctx       callback context
+ * \return
+ *      - created notify
+ *      - NULL if parameters are invalid or out of memory
+ */
+osiNotify_t *osiNotifyCreate(osiThread_t *thread, osiCallback_t cb, void *ctx);
+
+/**
+ * \brief delete a thread notify
+ *
+ * The memory of the thread notify will be released.
+ *
+ * When the thread notify is already in thread event queue, the callback
+ * won't be invoked, and the memory may be released delayed.
+ *
+ * \param notify    thread notify pointer, must be valid
+ */
+void osiNotifyDelete(osiNotify_t *notify);
+
+/**
+ * \brief trigger a thread notify
+ *
+ * When the thread notify event isn't in thread event queue, an event for
+ * thread notify will be queued to the tail of thread event queue.
+ *
+ * \param notify    thread notify pointer, must be valid
+ */
+void osiNotifyTrigger(osiNotify_t *notify);
+
+/**
+ * \brief cancel a thread notify
+ *
+ * When the thread notify event has already sent to thread event queue,
+ * the invocation of the callback will be cancelled.
+ *
+ * \param notify    thread notify pointer, must be valid
+ */
+void osiNotifyCancel(osiNotify_t *notify);
+
+/**
+ * \brief create a timer
+ *
+ * Create a timer with specified callback and callback context. After create,
+ * the timer is in stop state. Application can start it in various mode.
+ *
+ * When \p thread is \p OSI_TIMER_IN_ISR, the callback will be executed in
+ * timer ISR. So, the callback should follow ISR programming guide. This is
+ * **not** recommended unless it is absolutely needed.
+ *
+ * When \p thread is \p OSI_TIMER_IN_SERVICE, the callback will be executed
+ * in timer service thread.
+ *
+ * Otherwise, the callback will be executed in the specified thread through
+ * *event* mechanism.
+ *
+ * It is needed to call \p osiTimerDelete to free resources.
+ *
+ * \param thread    thread to execute the callback
+ * \param cb        callback to be executed after timer expire
+ * \param ctx       callback context
+ * \return
+ *      - the created timer instance
+ *      - NULL at out of memory, or invalid parameter
+ */
+osiTimer_t *osiTimerCreate(osiThread_t *thread, osiCallback_t cb, void *ctx);
+
+/**
+ * \brief create a timer, enqueue a work on expiration
+ *
+ * Create a timer with specified callback and callback context. After create,
+ * the timer is in stop state. Application can start it in various mode.
+ *
+ * At expiration, \p work will be enqueued to \p wq.
+ *
+ * It is needed to call \p osiTimerDelete to free resources.
+ *
+ * \param work      work to be enqueued at expiration
+ * \param wq        work queue to be enqueued at expiration
+ * \return
+ *      - the created timer instance
+ *      - NULL at out of memory, or invalid parameter
+ */
+osiTimer_t *osiTimerCreateWork(osiWork_t *work, osiWorkQueue_t *wq);
+
+/**
+ * \brief create a timer, EV_TIMER on expiration
+ *
+ * This is for legacy codes only. **Don't** use it except at porting
+ * legacy codes.
+ *
+ * Create a timer with specified timerid. After the timer expired, the
+ * specified thread will receive an event { EV_TIMER, timerid, 0, 0}.
+ *
+ * It is needed to call \p osiTimerDelete to free resources.
+ *
+ * \param thread    thread to execute the callback, it can't be NULL
+ * \param timerid   timerid in expiration event
+ * \return
+ *      - the created timer instance
+ *      - NULL at out of memory, or invalid parameter
+ */
+osiTimer_t *osiTimerEventCreate(osiThread_t *thread, uint32_t timerid);
+
+/**
+ * \brief set/change callback of timer
+ *
+ * In most cases, timer callback set at create is not needed to be changed.
+ *
+ * \p timer should be created by \p osiTimerCreate. Special values of
+ * \p thread follow \p osiTimerCreate.
+ *
+ * It is permitted to change \p thread of timer, including special values.
+ * For example, it is permitted to change a timer executing in timer service
+ * to timer executing in specified thread. However, it is not recommended.
+ *
+ * This can only be called when \p timer is stopped. Otherwise, it will
+ * return false.
+ *
+ * \param timer     timer to be changed
+ * \param thread    thread to execute the callback
+ * \param cb        callback to be executed after timer expire
+ * \param ctx       callback context
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerSetCallback(osiTimer_t *timer, osiThread_t *thread, osiCallback_t cb, void *ctx);
+
+/**
+ * \brief set/change work and work queue of timer
+ *
+ * In most cases, timer work and work queue set at create is not needed to be changed.
+ *
+ * \p timer should be created by \p osiTimerCreateWork, to enqueue work to work
+ * queue at expiration.
+ *
+ * \param timer     timer to be changed
+ * \param work      work to be enqueued at expiration
+ * \param wq        work queue to be enqueued at expiration
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerSetWork(osiTimer_t *timer, osiWork_t *work, osiWorkQueue_t *wq);
+
+/**
+ * \brief set/change timer event
+ *
+ * In most cases, timer thread and id set at create is not needed to be changed.
+ *
+ * \p timer should be created by \p osiTimerEventCreate.
+ *
+ * \param thread    thread to execute the callback, it can't be NULL
+ * \param timerid   timerid in expiration event
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerSetEvent(osiTimer_t *timer, osiThread_t *thread, uint32_t timerid);
+
+/**
+ * \brief delete a timer
+ *
+ * Delete the timer, and free associated resources.
+ *
+ * When the timer callback will be executed in thread rather than ISR, and the
+ * event for timer expiration has been sent, some resources won't be freed
+ * immediately. Rather, they will be freed after the timer expiration event
+ * is popped out from thread event queue. However, the callback won't be
+ * executed even delete is delayed.
+ *
+ * Refer to document about corner case of timer thread callback.
+ *
+ * \param timer     the timer to be deleted
+ */
+void osiTimerDelete(osiTimer_t *timer);
+/**
+ * \brief change timer relaxed timeout for running timer
+ *
+ * When the timer is not running, it will return false.
+ *
+ * When the timer is started, this will change the relaxed timeout
+ * specified at start.
+ *
+ * This can be called for both one shot timer and periodic timer.
+ *
+ * \p relaxed_ms is the additional time based on normal timeout. It will
+ * only be used for sleep. When \p relaxed_ms is 0, this timer will wakeup
+ * system even system enter sleep mode. When \p relaxed_ms is
+ * \p OSI_DELAY_MAX, this timer will not wakeup system when system enter
+ * sleep mode. Otherwise, system will process the timer no later than the
+ * normal timeout plus additional timeout.
+ *
+ * For example, when the period of a timer is 100ms, and relaxed timeout
+ * is 500ms, system will process the timer no later than 600ms. This can
+ * make system sleep more time, and reduce power consumption.
+ *
+ * For periodic timer, the additional timeout is add to normal timeout of
+ * earch run. For example, a periodic timer period is 100ms, and relaxed
+ * timeout is 50ms, then system will process the timer no later than 150ms.
+ * And even the timer is delayed to 150ms due to system sleep, the next
+ * timeout is 200ms unchanged. Another example, a periodic timer period
+ * is 100ms, and relaxed timeout is 500ms, then system will process the
+ * timer no later than 600ms. When the timer is delayed to 600ms due to
+ * system sleep, the callback will be invoked only once even 6 periods are
+ * elapsed. The next timeout is at 700ms.
+ *
+ * \param timer         the timer to be set
+ * \param relaxed_ms    relaxed timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter, or timer is not running
+ */
+bool osiTimerChangeRelaxed(osiTimer_t *timer, uint32_t relaxed_ms);
+
+/**
+ * \brief set timer period for next call
+ *
+ * The properties will be used by next \p osiTimerStartLast. It can only be
+ * called when the timer is not running.
+ *
+ * It is the same as \p osiTimerSetPeriodRelaxed, with \p relaxed_ms
+ * as 0.
+ *
+ * \param timer     the timer to be set
+ * \param ms        period in milliseconds
+ * \param periodic  true for periodic, false for one shot
+ * \return
+ *      - true on success
+ *      - false on invalid parameter, or timer is started
+ */
+bool osiTimerSetPeriod(osiTimer_t *timer, uint32_t ms, bool periodic);
+
+/**
+ * \brief set timer period for next call, with relaxed timeout
+ *
+ * The properties will be used by next \p osiTimerStartLast. It can only be
+ * called when the timer is not running.
+ *
+ * \param timer     the timer to be set
+ * \param ms        period in milliseconds
+ * \param relaxed   relaxed timeout in milliseconds
+ * \param periodic  true for periodic, false for one shot
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerSetPeriodRelaxed(osiTimer_t *timer, uint32_t ms, uint32_t relaxed_ms, bool periodic);
+
+/**
+ * \brief whether timer is started
+ *
+ * \param timer     the timer to be set
+ * \return
+ *      - true if the timer is started
+ *      - false if not started, or invalid parameter
+ */
+bool osiTimerIsRunning(osiTimer_t *timer);
+
+/**
+ * \brief get remaining time of timer in milliseconds
+ *
+ * Even the timer is already timed out, it will return 0 rather then negative
+ * value. For example, thread callback timer is already timed out, but the
+ * callback hasn't invoked in the specified thread.
+ *
+ * \param timer     the timer to be set
+ * \return
+ *      - remaining time
+ *      - timer is not started, or invalid parameter
+ */
+int64_t osiTimerRemaining(osiTimer_t *timer);
+
+/**
+ * \brief timer expiration time in milliseconds
+ *
+ * The expiration time is in the same coordinate of \p osiUpTime.
+ *
+ * When the timer is not running, it will return -1. For already timeed out
+ * timer, the return value may be smaller than \p osiUpTime.
+ *
+ * \param timer     the timer to be checked
+ * \return
+ *      - expiration time
+ *      - -1 if the timer is not running
+ */
+int64_t osiTimerExpiration(osiTimer_t *timer);
+
+/**
+ * \brief start a timer with last period
+ *
+ * The last period is the period set by \p osiTimerSetPeriod, or other start
+ * APIs with period parameter.
+ *
+ * It is recommended that not to mixing start API with period parameter, and
+ * start API without period parameter. Though the behavior is determinstic,
+ * it is harder to be understood.
+ *
+ * \param timer     the timer to be started
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartLast(osiTimer_t *timer);
+
+/**
+ * \brief start a timer
+ *
+ * Start a timer, and the timer will be expired in specified period from
+ * now. After the callback is executed, the timer will come to stopped state
+ * automatically.
+ *
+ * When the timer is in stated state before this function, the previous
+ * expiration won't be executed.
+ *
+ * Refer to document about corner case of timer thread callback.
+ *
+ * It is valid that the timeout period is 0. In this case, the timer will
+ * expire very soon.
+ *
+ * Due to timeout is 32bits of milliseconds, The maximum timeout period is
+ * ~50 days.
+ *
+ * It is the same as \p osiTimerStartRelaxed, with \p relaxed_ms is 0.
+ *
+ * \param timer     the timer to be started
+ * \param ms        timeout period
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStart(osiTimer_t *timer, uint32_t ms);
+
+/**
+ * \brief start a timer with relaxed timeout
+ *
+ * It is a power optimization version of \p osiTimerStart.
+ *
+ * Refer to \p osiTimerChangeRelaxed for explaination of \p relaxed_ms.
+ *
+ * \param timer     the timer to be started
+ * \param ms        normal timeout period
+ * \param relax_ms  relaxed timeout period
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartRelaxed(osiTimer_t *timer, uint32_t ms, uint32_t relax_ms);
+
+/**
+ * \brief start a timer with relaxed timeout, in unit of hardware tick
+ *
+ * **Don't** call this in application code. It is only for legacy codes.
+ *
+ * The frequency of hardware tick is chip dependent, and implementation dependent.
+ *
+ * \param timer     the timer to be started
+ * \param ticks     normal timeout period in hardware tick
+ * \param relax_ticks   relaxed timeout period in hardware tick
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartHWTickRelaxed(osiTimer_t *timer, uint32_t ticks, uint32_t relax_ticks);
+
+/**
+ * \brief start a timer, timeout in unit of microseconds
+ *
+ * Timeout in microseconds can support higher precision. However, the maximum
+ * timeout is shorter, ~1.2 hours.
+ *
+ * The real precision depends on hardware.
+
+ * \param timer     the timer to be started
+ * \param us        timeout period in microseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartMicrosecond(osiTimer_t *timer, uint32_t us);
+
+/**
+ * \brief start a periodic timer
+ *
+ * Internally, the period may be aligned to hardware tick (larger than
+ * 16384Hz), there may exist accumulated error in long run. So, don't use
+ * periodic timer count for long time time, \p osiUpTime is a better choice.
+ *
+ * When the period of periodic timer is too small, it will have serious impact
+ * on system. Internally, the period taking effect will no less than
+ * \p CONFIG_KERNEL_PERIODIC_TIMER_MIN_PERIOD.
+ *
+ * It is the same as \p osiTimerStartPeriodicRelaxed, with \p relaxed_ms is 0.
+ *
+ * \param timer     the timer to be started
+ * \param ms        interval in microseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartPeriodic(osiTimer_t *timer, uint32_t ms);
+
+/**
+ * \brief start a periodic timer with relaxed timeout
+ *
+ * It is a power optimization version of \p osiTimerStartPeriodic.
+ *
+ * Refer to \p osiTimerChangeRelaxed for explaination of \p relaxed_ms.
+ *
+ * \param timer     the timer to be started
+ * \param ms        interval in microseconds
+ * \param relaxed_ms    relaxed timeout period
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStartPeriodicRelaxed(osiTimer_t *timer, uint32_t ms, uint32_t relaxed_ms);
+
+/**
+ * \brief stop a time
+ *
+ * Stop a not-started or stopped timer is valid, just do nothing.
+ *
+ * Refer to document about corner case of timer thread callback.
+ *
+ * \param timer     the timer to be stopped
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiTimerStop(osiTimer_t *timer);
+
+/**
+ * \brief tickless light sleep for timer
+ *
+ * When OS tick is implemented in timer, \p idle_tick is the maximum
+ * idle OS tick count (not hardware tick count) for sleep.
+ *
+ * The timer interrupt will be moved to minimum of:
+ * * OS timer, after \p idle_tick
+ * * other timers timeout time
+ *
+ * When there are no timers, timer interrupt will be disabled.
+ *
+ * The normal timeout time of timer, rather than the relaxed timeout
+ * time of timer, will be used.
+ *
+ * When the timer interrupt is moved, it will return true. In that case,
+ * the timer interrupt will be moved back after light sleep.
+ *
+ * \param idle_tick     OS tick sleep count
+ * \return
+ *      - true if timer interrupt is moved
+ *      = false if timer interrupt is not moved
+ */
+bool osiTimerLightSleep(uint32_t idle_tick);
+
+/**
+ * \brief calculate the deep sleep time of all timers
+ *
+ * When OS tick is implemented in timer, \p idle_tick is the maximum
+ * idle OS tick count (not hardware tick count) for sleep.
+ *
+ * When there are timers which will wakeup system, the return value is
+ * the earliest timer wakeup time from now in milliseconds.
+ *
+ * When there are no timer will wakeup system, return \p INT64_MAX.
+ *
+ * The relaxed timeout time of timer, rather than the normal timeout
+ * time, is used in checking sleep time.
+ *
+ * Usually, it will be called by system sleep module. And it is not
+ * prohibited to be called in other cases.
+ *
+ * It **must** be called with interrupt disabled. The implementation
+ * won't perform protection.
+ *
+ * \param idle_tick     OS tick sleep count
+ * \return
+ *      - the earliest sleep timer from now in milliseconds.
+ *        \p INT64_MAX for no need to wakeup.
+ */
+int64_t osiTimerDeepSleepTime(uint32_t idle_tick);
+
+/**
+ * \brief calculate the PSM wakup time of all timers
+ *
+ * When OS tick is implemented in timer, OS tick is not considered.
+ * That is, PSM wont't be waken by OS tick.
+ *
+ * The there are times which will wakeup system, the return value is
+ * the earliest timer wakeup time in milliseconds.
+ *
+ * When there are no timer will wakeup system, return \p INT64_MAX.
+ *
+ * The relaxed timeout time of timer, rather than the normal timeout
+ * time, is used in checking sleep time.
+ *
+ * It **must** be called with interrupt disabled. The implementation
+ * won't perform protection.
+ *
+ * \return
+ *      - the earliest wakeup timer from now in milliseconds.
+ *        \p INT64_MAX for no need to wakeup.
+ */
+int64_t osiTimerPsmWakeUpTime(void);
+
+/**
+ * \brief timer module processing after wakeup
+ *
+ * In case \p osiUpHWTick will be discontinued at sleep, it should be called
+ * after \p osiUpHWTick is stable.
+ *
+ * Usually, it will be called by system sleep module. And it is not
+ * prohibited to be called in other cases.
+ *
+ * It **must** be called with interrupt disabled. The implementation
+ * won't perform protection.
+ */
+void osiTimerWakeupProcess(void);
+
+/**
+ * \brief dump timer information to memory
+ *
+ * It is for debug only. The data format of timer information dump is
+ * not stable, and may change. When the provided memory size is not
+ * enough for all timers, some timers will be absent in dump.
+ *
+ * \param mem       memory for timer information dump
+ * \param size      provided memory size
+ * \return
+ *      - dump memory size
+ */
+int osiTimerDump(void *mem, unsigned size);
+
+/**
+ * create a message queue
+ *
+ * \param msg_count maximum message count can be hold in queue
+ * \param msg_size  size of each message in bytes
+ * \return
+ *      - message queue pointer
+ *      - NULL on invalid parameter or out of memory
+ */
+osiMessageQueue_t *osiMessageQueueCreate(uint32_t msg_count, uint32_t msg_size);
+
+/**
+ * delete a message queue
+ *
+ * When \p mq is NULL, nothing will be done, just as \p free.
+ *
+ * \param mq    message queue pointer
+ */
+void osiMessageQueueDelete(osiMessageQueue_t *mq);
+
+/**
+ * put a message to message queue
+ *
+ * \p msg should hold content size the same as \p msg_size specified at
+ * \p osiMessageQueueCreate.
+ *
+ * After put, the content of \p msg will be copied to message queue.
+ *
+ * When \p mq is full, it will be blocked until there are rooms.
+ *
+ * \param mq    message queue pointer
+ * \param msg   mesage pointer
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiMessageQueuePut(osiMessageQueue_t *mq, const void *msg);
+
+/**
+ * put a message to message queue with timeout
+ *
+ * This can be called in ISR. And in ISR, \p timeout must be 0.
+ *
+ * \param mq        message queue pointer
+ * \param msg       mesage pointer
+ * \param timeout   timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter or timeout
+ */
+bool osiMessageQueueTryPut(osiMessageQueue_t *mq, const void *msg, uint32_t timeout);
+
+/**
+ * get a message to message queue
+ *
+ * \p msg should be able tp hold content size of \p msg_size specified at
+ * \p osiMessageQueueCreate.
+ *
+ * After get, the content of message will be copied to \p msg.
+ *
+ * When \p mq is empty, it will be blocked until there are messages.
+ *
+ * \param mq    message queue pointer
+ * \param msg   mesage pointer
+ * \return
+ *      - true on success
+ *      - false on invalid parameter
+ */
+bool osiMessageQueueGet(osiMessageQueue_t *mq, void *msg);
+
+/**
+ * get a message to message queue with timeout
+ *
+ * This can be called in ISR. And in ISR, \p timeout must be 0.
+ *
+ * \param mq        message queue pointer
+ * \param msg       mesage pointer
+ * \param timeout   timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on invalid parameter or timeout
+ */
+bool osiMessageQueueTryGet(osiMessageQueue_t *mq, void *msg, uint32_t timeout);
+
+/**
+ * create a semaphore
+ *
+ * When \p max_count is 1, it is a binary semaphore. Otherwise, it is
+ * counting semaphore.
+ *
+ * \param max_count     maximum count of the semaphore
+ * \param init_count    initial count of the semaphore
+ * \return
+ *      - semaphore pointer
+ *      - NULL on invalid parameter or out of memory
+ */
+osiSemaphore_t *osiSemaphoreCreate(uint32_t max_count, uint32_t init_count);
+
+/**
+ * delete the semaphore
+ *
+ * When there are blocked thread on the semaphore, the behavior is undefined
+ * for \p osiSemaphoreDelete.
+ *
+ * \param semaphore     semaphore pointer
+ */
+void osiSemaphoreDelete(osiSemaphore_t *semaphore);
+
+/**
+ * acquire from semaphore
+ *
+ * After acquire, the count of semaphore will be decreased by 1.
+ *
+ * When the count of semaphore is 0, it will be blocked until the count
+ * becomes non-zero (increased by \p osiSemaphoreRelease).
+ *
+ * \param semaphore     semaphore pointer
+ */
+void osiSemaphoreAcquire(osiSemaphore_t *semaphore);
+
+/**
+ * acquire from semaphore with timeout
+ *
+ * This can be called in ISR. And in ISR, \p timeout must be 0.
+ *
+ * \param semaphore     semaphore pointer
+ * \param timeout       timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on timeout
+ */
+bool osiSemaphoreTryAcquire(osiSemaphore_t *semaphore, uint32_t timeout);
+
+/**
+ * release to semaphore
+ *
+ * After release, the count of semaphore will be increased by 1.
+ * When there are blocked thread on the semaphore, one of the blocked
+ * thread will be unblocked.
+ *
+ * This can be called in ISR.
+ *
+ * \param semaphore     semaphore pointer
+ */
+void osiSemaphoreRelease(osiSemaphore_t *semaphore);
+
+/**
+ * create a mutex
+ *
+ * After creation, the mutex is in *open* state.
+ *
+ * \return
+ *      - mutex pointer
+ *      - NULL on out of memory
+ */
+osiMutex_t *osiMutexCreate(void);
+
+/**
+ * delete the mutex
+ *
+ * When \p mutex is NULL, nothing will be done, just as \p free.
+ *
+ * \param mutex     mutex pointer to be deleted
+ */
+void osiMutexDelete(osiMutex_t *mutex);
+
+/**
+ * lock the mutex
+ *
+ * When \p mutex is locked by another thread, it will wait forever
+ * until the mutex is unlocked.
+ *
+ * \param mutex     mutex pointer to be locked
+ */
+void osiMutexLock(osiMutex_t *mutex);
+
+/**
+ * lock the mutex with timeout
+ *
+ * \param mutex     mutex pointer to be locked
+ * \param timeout   timeout in milliseconds
+ * \return
+ *      - true on success
+ *      - false on timeout
+ */
+bool osiMutexTryLock(osiMutex_t *mutex, uint32_t timeout);
+
+/**
+ * unlock the mutex
+ *
+ * \param mutex     mutex pointer to be unlocked
+ */
+void osiMutexUnlock(osiMutex_t *mutex);
+
+/**
+ * \brief monoclinic system time
+ *
+ * It is a relative time from system boot. Even after suspend and resume,
+ * the monoclinic system time will be contiguous.
+ *
+ * \return      monoclinic system time in milliseconds
+ */
+int64_t osiUpTime(void);
+
+/**
+ * \brief monoclinic system time in microsecond
+ *
+ * The monoclinic system time in unit of microsecond.
+ *
+ * \return      monoclinic system time in microseconds
+ */
+int64_t osiUpTimeUS(void);
+
+/**
+ * \brief set monoclinic system time
+ *
+ * When it is known that the hardware resource for monoclinic system time
+ * is discontinued, such as power off during deep sleep, this is called to
+ * set monoclinic system time.
+ *
+ * When up time is changed, epoch time and local time aren't be changed.
+ *
+ * It should only be called in system integration.
+ *
+ * \param ms        target monoclinic system time in microseconds
+ */
+void osiSetUpTime(int64_t ms);
+
+/**
+ * \brief get the epoch time
+ *
+ * The time is millisecond (1/1000 second) from 1970-01-01 UTC. To avoid
+ * overflow, the data type is 64 bits.
+ *
+ * Epoch time is not monoclinic time. For example, when system time is
+ * synchronized with network, there may exist a jump (forward or backward)
+ * of epoch time.
+ *
+ * In 2 cases, this system time may be not reliable:
+ * - During boot, and before RTC is initialized.
+ * - During wakeup, and the elapsed sleep time hasn't compensated.
+ *
+ * \return      epoch time in milliseconds
+ */
+int64_t osiEpochTime(void);
+
+/**
+ * \brief get the epoch time in second
+ *
+ * The time is seconds from 1970-01-01 UTC. To avoid overflow, the data
+ * type is 64 bits.
+ * - signed 32bits will overflow at year 2038
+ * - unsigned 32bits will overflow at year 2106
+ *
+ * Epoch time is not monoclinic time. For example, when system time is
+ * synchronized with network, there may exist a jump (forward or backward)
+ * of epoch time.
+ *
+ * In 2 cases, this system time may be not reliable:
+ * - During boot, and before RTC is initialized.
+ * - During wakeup, and the elapsed sleep time hasn't compensated.
+ *
+ * \return      epoch time in seconds
+ */
+int64_t osiEpochSecond(void);
+
+/**
+ * \brief set the monoclinic system time
+ *
+ * After the system time is changed, RTC won't be updated automatically.
+ * It is needed to call RTC API to sync system time to RTC.
+ *
+ * When epoch time is changed, the monoclilinc system up time isn't changed,
+ * and local time is changed correspondingly. The delta bewteen epoch time
+ * and local time is only affected by timezone.
+ *
+ * \param ms    epoch time in milliseconds
+ *
+ * \return      true on succeed else fail
+ */
+bool osiSetEpochTime(int64_t ms);
+
+/**
+ * \brief get time zone in second
+ *
+ * Time zone is the offset between local time and epoch time:
+ *      local_time = epoch_time + time_zone
+ *
+ * OSI won't keep time zone at power off. Other module should store
+ * time zone in NVRAM, and set to OSI at boot.
+ *
+ * \return  time zone in second
+ */
+int osiTimeZoneOffset(void);
+
+/**
+ * \brief set time zone in second
+ *
+ * Time zone is the offset between local time and epoch time:
+ *      local_time = epoch_time + time_zone
+ *
+ * Time zone should be in [-12*3600, 12*3600]. However, it is not checked
+ * inside this. The caller should make sure the \p offset is reasonable.
+ *
+ * \param offset    time zone in second
+ */
+void osiSetTimeZoneOffset(int offset);
+
+/**
+ * \brief get the local time
+ *
+ * It is just: epoch_time + time_zone
+ *
+ * \return      local time in milliseconds
+ */
+int64_t osiLocalTime(void);
+
+/**
+ * \brief get the local time in seconds
+ *
+ * It is just: epoch_time + time_zone
+ *
+ * \return      local time in seconds
+ */
+int64_t osiLocalSecond(void);
+
+/**
+ * \brief monoclinic system hardware tick
+ *
+ * **Don't** call this in application code. It is only for legacy codes.
+ *
+ * The frequency of hardware tick is chip dependent, and implementation dependent.
+ *
+ * \return      monoclinic system hardware tick
+ */
+int64_t osiUpHWTick(void);
+
+/**
+ * \brief hardware tick count in 16384Hz
+ *
+ * The return value should be fulll 32bits value. That is, the next tick of
+ * 0xffffffff will be 0. Then the simple substract will always provide the tick
+ * delta.
+ *
+ * This is only for legacy codes. \p osiUpTime or \p osiUpTimeUS is recommended.
+ * On some platform, it may be un-implemented.
+ *
+ * \return      hardware tick count
+ */
+uint32_t osiHWTick16K(void);
+
+/**
+ * \brief convert epoch time to up time
+ *
+ * When some values has special meanings, such as INT64_MAX means invalid or not
+ * exist, caller should check special values before call this.
+ *
+ * \param epoch     epoch time in milliseconds
+ * \return  up time in milliseconds
+ */
+int64_t osiEpochToUpTime(int64_t epoch);
+
+/**
+ * \brief start couting of elsapsed timer
+ *
+ * \param timer     elapsed timer, must be valid
+ */
+void osiElapsedTimerStart(osiElapsedTimer_t *timer);
+
+/**
+ * \brief elapsed milliseconds after start
+ *
+ * \param timer     elapsed timer, must be valid
+ * \return
+ *      - elapsed milliseconds after start
+ */
+uint32_t osiElapsedTime(osiElapsedTimer_t *timer);
+
+/**
+ * \brief elapsed microseconds after start
+ *
+ * \param timer     elapsed timer, must be valid
+ * \return
+ *      - elapsed microseconds after start
+ */
+uint32_t osiElapsedTimeUS(osiElapsedTimer_t *timer);
+
+/**
+ * \brief convert uptime to epoch time
+ *
+ * When some values has special meanings, such as INT64_MAX means invalid or not
+ * exist, caller should check special values before call this.
+ *
+ * \param epoch     up time in milliseconds
+ * \return  epoch time in milliseconds
+ */
+int64_t osiUpTimeToEpoch(int64_t uptime);
+
+/**
+ * \brief CPU suspend
+ *
+ * Usually, it shouldn't be called directly by application. Rather, it is
+ * implemented by BSP, and called by \p osiPmSuspend.
+ *
+ * \param mode  suspend mode
+ * \param ms    suspend time in milliseconds
+ * \return
+ *      suspend resume source. \p OSI_RESUME_ABORT bit indicates suspend
+ *      aborted.
+ */
+uint32_t osiPmCpuSuspend(osiSuspendMode_t mode, int64_t ms);
+
+/**
+ * \brief PM source callbacks
+ *
+ * All the callbacks are called with interrupt disabled. So, it is not
+ * needed to call \p osiEnterCritical or \p osiIrqSave for protection.
+ * And it is not error to call them.
+ *
+ * Don't call blocking API in the callback.
+ */
+typedef struct osiPmSourceOps
+{
+    void (*suspend)(void *ctx, osiSuspendMode_t mode);                 ///< callback to be called before suspend
+    void (*resume)(void *ctx, osiSuspendMode_t mode, uint32_t source); ///< callback to be called after resume
+    bool (*prepare)(void *ctx);                                        ///< callback to be called at suspend check
+    void (*prepare_abort)(void *ctx);                                  ///< callback to be called at suspend check fail
+} osiPmSourceOps_t;
+
+/**
+ * PM source opaque data struct
+ */
+typedef struct osiPmSource osiPmSource_t;
+
+/**
+ * \brief power management module initialization
+ *
+ * It should be called in early stage of boot, due to many other modules
+ * may register suspend and resume callback at initialization.
+ */
+void osiPmInit(void);
+
+/**
+ * \brief power management core start
+ *
+ * To avoid suspend too early, PM core won't be started at initialization
+ * automatically. After system is initialized, and necessary PM sources
+ * are created, \p osiPmStart shall be called.
+ *
+ * Only after \p osiPmStart is called, PM core will check and enter suspend.
+ */
+void osiPmStart(void);
+
+/**
+ * \brief power management core stop
+ *
+ * Stop PM core, and systen will never suspend.
+ *
+ * It is only for debug. And it shouldn't be used in real application.
+ */
+void osiPmStop(void);
+
+/**
+ * \brief create PM source
+ *
+ * Modules are distinguished by FOURCC *tag*. So, tag should be unique
+ * system wise.
+ *
+ * When the *tag* is already registered, it will return existed PM source.
+ *
+ * \p ops is permitted to be NULL, and all callbacks inside it are permitted
+ * to be NULL.
+ *
+ * Resume callbacks are called in create order, suspend callbacks are called
+ * in revered order. When resume order does matter, call \p osiPmResumeReorder
+ * or \p osiPmResumeFirst to change resume order.
+ *
+ * The returned pointer should be destroyed and freed by \p osiPmSourceDelete.
+ *
+ * PM source lock and unlock is binary. That is, there is no *counter* inside.
+ * When \p osiPmWakeUnlock is called, the PM source won't prevent system
+ * suspend, no matter how many times of \p osiPmWakeLock is called.
+ *
+ * \param tag       module tag
+ * \param ops       callbacks during suspend and resume
+ * \param ctx       callback context, shared by all callbacks
+ * \return
+ *      - PM source pointer
+ *      - NULL on out of memory
+ */
+osiPmSource_t *osiPmSourceCreate(uint32_t tag, const osiPmSourceOps_t *ops, void *ctx);
+
+/**
+ * \brief destroy PM source
+ *
+ * \param ps        PM source
+ */
+void osiPmSourceDelete(osiPmSource_t *ps);
+
+/**
+ * \brief ensure resume callback order
+ *
+ * In cases that the resume callback order is important, this API will check
+ * and change resume callback order if needed. After the call, the resumed
+ * order is ensured.
+ *
+ * When resume callback order is changed, suspend callback order is changed
+ * also.
+ *
+ * It won't be checked whether the tags are valid.
+ *
+ * \param tag_later     module tag to be resumed laster
+ * \param tag_earlier   module tag to be resumed earlier
+ */
+void osiPmResumeReorder(uint32_t tag_later, uint32_t tag_earlier);
+
+/**
+ * \brief move PM source to the first in resume order
+ *
+ * Find the PM source, and move it to the head of resume list. When PM source
+ * with \p tag is not found in resume list, nothing will be done.
+ *
+ * \param tag       module tag to be moved
+ */
+void osiPmResumeFirst(uint32_t tag);
+
+/**
+ * \brief wake lock to prevent suspend
+ *
+ * Indicate the PM source will prevent system suspend. PM source is *NOT*
+ * counting, \p osiPmWakeLock will just set the PM source state. Multiple
+ * calls of \p osiPmWakeLock is equivalent to a single call.
+ *
+ * When \p ops.prepare is not NULL, the internal state of PM source is
+ * *suspend possible* rather than *active*. When system wants to
+ * suspend, \p ops.prepare will be called to double check whether
+ * suspend is permitted.
+ *
+ * \param ps        PM source
+ */
+void osiPmWakeLock(osiPmSource_t *ps);
+
+/**
+ * \brief wake unlock to permit suspend
+ *
+ * Indicate the PM source won't prevent system suspend. PM source is *NOT*
+ * counting. No matter how many calls of \p osiPmWakeLock are called,
+ * \p osiPmWakeUnlock will set the PM source to unlock state.
+ *
+ * \param ps        PM source
+ */
+void osiPmWakeUnlock(osiPmSource_t *ps);
+
+/**
+ * \brief power management suspend
+ *
+ * Usually, it shouldn't be called directly by application. Rather, it will
+ * be called after suspend criteria are met.
+ */
+void osiPmSleep(uint32_t idle_tick);
+
+/**
+ * \brief dump PM source information to memory
+ *
+ * It is for debug only. The data format of timer information dump is
+ * not stable, and may change. Currently, there is 4 bytes header, and
+ * 4 bytes for each PM source.
+ *
+ * Caller should make sure \p mem is enough for hold PM source information
+ * of \p count.
+ *
+ * \param mem       memory for PM source information dump
+ * \param count     maximum PM source count to be dump
+ * \return
+ *      - dump memory size
+ *      - -1 if \p count is too small
+ */
+int osiPmSourceDump(void *mem, int count);
+
+/**
+ * \brief set 32K sleep flag
+ *
+ * For platforms support both 32K sleep and suspend, the default sleep
+ * mode is suspend. When it is needed to use 32K sleep forcedly, it is
+ * needed to call this API.
+ *
+ * Each bit of \p flag represents a request source. When there are any
+ * 32K sleep requests, system will use 32K sleep rather than suspend.
+ *
+ * The 32K sleep request sources depend on platform. And they are
+ * defined in platform dependent hal_chip.h.
+ *
+ * \param flag      32K sleep request flag
+ */
+void osiSet32KSleepFlag(uint32_t flag);
+
+/**
+ * \brief clear 32K sleep flag
+ *
+ * \param flag      32K sleep request flag
+ */
+void osiClear32KSleepFlag(uint32_t flag);
+
+/**
+ * \brief register a shutdown callback
+ *
+ * When the callback and context is already registered, it will return
+ * false.
+ *
+ * The order to invoke callbacks is undefined.
+ *
+ * *Don't* call \p osiRegisterShutdownCallback or
+ * \p osiUnregisterShutdownCallback inside the callbacks.
+ *
+ * \param cb        shutdown callback to be registered, can't be NULL
+ * \param ctx       shutdown callback context
+ * \return
+ *      - true if callback registered
+ *      - false if callback is already registered, or callback is NULL
+ */
+bool osiRegisterShutdownCallback(osiShutdownCallback_t cb, void *ctx);
+
+/**
+ * \brief unregister a shutdown callback
+ *
+ * \param cb        shutdown callback to be unregistered, can't be NULL
+ * \param ctx       shutdown callback context
+ * \return
+ *      - true if callback unregistered
+ *      - false if callback isn't found
+ */
+bool osiUnregisterShutdownCallback(osiShutdownCallback_t cb, void *ctx);
+
+/**
+ * \brief get PSM expiration time in uptime
+ *
+ * \return
+ *      - PSM expiration time in uptime
+ *      - INT64_MAX if PSM not enabled
+ */
+int64_t osiGetPsmWakeUpTime(void);
+
+/**
+ * \brief set PSM expiration time in uptime
+ *
+ * \param uptime    PSM expiration time in uptime
+ *                  or INT64_MAX to disable PSM
+ */
+void osiSetPsmWakeUpTime(int64_t uptime);
+
+/**
+ * \brief set PSM sleep time from now
+ *
+ * \param ms        PSM sleep time from now
+ *                  or INT64_MAX to disable PSM
+ */
+void osiSetPsmSleepTime(int64_t ms);
+
+/**
+ * \brief get PSM elapsed time in milliseconds
+ *
+ * The starting point is the time \p osiSetPsmWakeUpTime or
+ * \p osiSetPsmSleepTime is called. And this returns the elapsed time from
+ * the starting point to now.
+ *
+ * \return      PSM elsapsed time
+ */
+int64_t osiGetPsmElapsedTime(void);
+
+/**
+ * \brief get cp deep sleep time in milliseconds
+ *
+ * \return      cp deep sleep time
+ */
+uint64_t osiCpDeepSleepTime(void);
+
+/**
+ * \brief shutdown to specified mode
+ *
+ * When parameter is wrong, it will return false:
+ * - When \p mode is OSI_SHUTDOWN_PSM_SLEEP, and PSM isn't enabled.
+ *   Caller should check whether PSM is enabled before calling
+ *   \p osiShutdown.
+ * - When \p mode is not supported in the platform.
+ *
+ * It never return true.
+ *
+ * \param mode      shutdown mode
+ * \return
+ *      - false on parameter error
+ */
+bool osiShutdown(osiShutdownMode_t mode);
+
+/**
+ * \brief get boot causes
+ *
+ * It is possible there are multiple boot causes. The returned value is
+ * bit or of all boot causes.
+ *
+ * It is possible hardware registers will be cleared after accessed. So,
+ * always call \p osiGetBootCauses to get the boot causes, rather than
+ * accessing hardware registers directly.
+ *
+ * \return  boot causes
+ */
+uint32_t osiGetBootCauses(void);
+
+/**
+ * \brief set a boot cause
+ *
+ * It is intended only for system integration.
+ *
+ * \param cause     boot cause
+ */
+void osiSetBootCause(osiBootCause_t cause);
+
+/**
+ * \brief clear a boot cause
+ *
+ * It is intended only for system integration.
+ *
+ * \param cause     boot cause
+ */
+void osiClearBootCause(osiBootCause_t cause);
+
+/**
+ * \brief get boot mode
+ *
+ * \return  boot mode
+ */
+osiBootMode_t osiGetBootMode(void);
+
+/**
+ * \brief set boot mode
+ *
+ * It is intended only for system integration. At calling, caller should
+ * take care conflict of other boot mode detection.
+ *
+ * \param mode      boot mode
+ */
+void osiSetBootMode(osiBootMode_t mode);
+
+/**
+ * \brief PSM save preparation
+ *
+ * It will be called before any \p osiPsmDataSave. Usually, it will prepare
+ * PSM data memory.
+ *
+ * \param mode      shutdown mode
+ */
+void osiPsmSavePrepare(osiShutdownMode_t mode);
+
+/**
+ * \brief PSM save
+ *
+ * Save all owner's PSM data to persistent storage.
+ *
+ * \param mode      shutdown mode
+ */
+void osiPsmSave(osiShutdownMode_t mode);
+
+/**
+ * \brief PSM restore
+ *
+ * It should be called in system initialization, after file system
+ * initialization.
+ */
+void osiPsmRestore(void);
+
+/**
+ * \brief save PSM data
+ *
+ * PSM data save is implemented in platform. PSM data should be saved in
+ * persistent storage, which can be flash or aon memory. Caller shouldn't
+ * assume the storage type.
+ *
+ * It should only be called in \p osiShutdown callbacks.
+ *
+ * For each owner, \p osiPsmDataSave shall be called only once at most.
+ *
+ * It is recommended to use fixed size buffer, which is the same at each
+ * PSM shutdown. However, variable size buffer is also supported.
+ *
+ * As a special case, \p size of 0 is permitted. It just keep record that
+ * the owner is saved without real data.
+ *
+ * \param owner     PSM data owner
+ * \param buf       owner's PSM data buffer
+ * \param size      owner's PSM data buffer size
+ * \return
+ *      - true on success
+ *      - false on fail
+ *          - duplicated owner
+ *          - out of memory
+ */
+bool osiPsmDataSave(osiPsmDataOwner_t owner, const void *buf, uint32_t size);
+
+/**
+ * \brief restore PSM data
+ *
+ * Restore PSM data. At PSM resume boot, PSM data owner calls this to get
+ * the data saved by \p osiPsmDataSave
+ *
+ * The buffer size should be equal or larger than the saved size. If it is
+ * smaller than saved size, return -1.
+ *
+ * When \p buf is NULL, it will return PSM data size without copy. It can
+ * be used to get the PSM data size.
+ *
+ * \param owner     PSM data owner
+ * \param buf       buffer for owner's PSM data
+ * \param size      buffer size
+ * \return
+ *      - PSM data size on success
+ *      - 0 if there are no PSM data
+ *      - -1 on error
+ */
+int osiPsmDataRestore(osiPsmDataOwner_t owner, void *buf, uint32_t size);
+
+/**
+ * send out debug event to trace tool
+ *
+ * If system and trace tool support debug event, this will send
+ * a word to trace tool.
+ *
+ * It should be only used in quick debug. It is possible that platform
+ * can't support debug event, and debug event output may be turned off
+ * by compiling option.
+ *
+ * \param event     word which will appear on trace tool
+ */
+void osiDebugEvent(uint32_t event);
+
+/**
+ * panic
+ *
+ * Called on fatal error, and system can't go on.
+ *
+ * It is different from \p assert. It will always cause system panic,
+ * and there are no compiling option to ignore it.
+ */
+OSI_NO_RETURN void osiPanic(void);
+
+/**
+ * whether system is in panic mode
+ *
+ * In panic mode, system will still run a small daemon. And there is no
+ * interrupt in panic mode. So, features used in panic daemon shall take
+ * care of this.
+ *
+ * \return
+ *      - true if system is in panic mode
+ *      - false if system is not in panic mode
+ */
+bool osiIsPanic(void);
+
+#ifdef CONFIG_KERNEL_ASSERT_ENABLED
+/*+\NEW\zhuwangbin\2020.4.2\添加AT*exinfo指令*/
+extern void osiPanicInfoFuncLineSet(const char *func, int line);
+
+#define OSI_ASSERT(expect_true, info) OSI_DO_WHILE0(if (!(expect_true)) {osiPanicInfoFuncLineSet(__FUNCTION__,__LINE__);osiPanic();})
+#else
+#define OSI_ASSERT(expect_true, info)
+#endif
+/*-\NEW\zhuwangbin\2020.4.2\添加AT*exinfo指令*/
+/**
+ * busy loop delay
+ *
+ * The precision of delay depends on platform. And it will ensure to delay
+ * at least the specified time.
+ *
+ * \param us    delay time in microseconds
+ */
+OSI_NO_MIPS16 void osiDelayUS(uint32_t us);
+
+/**
+ * delay by CPU loop
+ *
+ * The absolute delay time depends on CPU frequency. \p count is the loop
+ * count, not the delayed instruction count.
+ *
+ * \param count     delay loop count
+ */
+void osiDelayLoops(uint32_t count);
+
+/**
+ * call function with specified stack
+ *
+ * This will only be called with low level codes, and most likely, it is not
+ * needed for application.
+ *
+ * This function is located in SRAM. So, it can be called even the external
+ * RAM in unavailable.
+ *
+ * \p function shall have 2 parameters at most. It can return one word. When
+ * \p function doesn't return value, the return value of this wrapper is
+ * undefined.
+ *
+ * \p sp should be 8 bytes aligned.
+ *
+ * \param sp        the stack to be used for \p function
+ * \param function  the real function
+ * \param param0    the first parameter for \p function
+ * \param param1    the second parameter for \p function
+ * \return
+ *      - the return value of \p function
+ */
+uint32_t osiCallWithStack(void *sp, void *function, uint32_t param0, uint32_t param1);
+
+#ifndef DOXYGEN
+// it is needed to place such definitions in a better place
+#define PM_TAG_ADI_BUS OSI_MAKE_TAG('A', 'D', 'I', 'B')
+#define PM_TAG_IOMUX OSI_MAKE_TAG('I', 'O', 'M', 'X')
+#define PM_TAG_GPIO OSI_MAKE_TAG('G', 'P', 'I', 'O')
+#define PM_TAG_AXI_DMA OSI_MAKE_TAG('A', 'D', 'M', 'A')
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif

+ 224 - 0
bsp/air724/sdk/components/include/osi_clock.h

@@ -0,0 +1,224 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _OSI_CLOCK_H_
+#define _OSI_CLOCK_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief callback function for clk_sys change
+ *
+ * The callback is platform dependent. Typical usage is for hardware module,
+ * whose clock is divided from clk_sys. So, when clk_sys is changed, it is
+ * needed to update the divider from clk_sys.
+ *
+ * It is recommended to add callback only in hardware driver, and divider
+ * change is needed.
+ *
+ * To ensure atomic, the callback will be called with interrupt disabled.
+ * So, the callback should be as fast as possible, even trace inside
+ * callback is discouraged.
+ *
+ * \param [in] sysClkFreq   new clk_sys to be changed
+ * \return  hardware module working frequency
+ */
+typedef uint32_t (*osiSysClkChangeCallback_t)(uint32_t sysClkFreq);
+
+/**
+ * \brief clk_sys change callback registry
+ */
+typedef struct
+{
+    uint32_t tag; ///< name tag
+    //! @cond Doxygen_Suppress
+    uint32_t dummy0;
+    uint32_t dummy1;
+    uint32_t dummy2;
+    //! @endcond
+} osiSysClkCallbackRegistry_t;
+
+/**
+ * \brief clk_sys constraint registry
+ */
+typedef struct
+{
+    uint32_t tag; ///< name tag
+    //! @cond Doxygen_Suppress
+    uint32_t dummy0;
+    uint32_t dummy1;
+    uint32_t dummy2;
+    uint32_t dummy3;
+    uint32_t dummy4;
+    //! @endcond
+} osiClockConstrainRegistry_t;
+
+/**
+ * \brief clock management module initialization
+ */
+void osiClockManInit(void);
+
+/**
+ * \brief clock management start
+ *
+ * At initialization, clock management will just record clock constrains. Only
+ * after this is called, clock management will start to change system clock
+ * based on clock constrains.
+ */
+void osiClockManStart(void);
+
+/**
+ * \brief register clk_sys change callback
+ *
+ * When \p cb is NULL, it is the same as \p osiUnregisterSysClkChangeCallback(r).
+ *
+ * \param [in] r        callback registry, must be valid
+ * \param [in] cb       callback function
+ */
+void osiRegisterSysClkChangeCallback(osiSysClkCallbackRegistry_t *r, osiSysClkChangeCallback_t cb);
+
+/**
+ * \brief unregister clk_sys change callback
+ *
+ * \param [in] r        callback registry, must be valid
+ */
+void osiUnregisterSysClkChangeCallback(osiSysClkCallbackRegistry_t *r);
+
+/**
+ * \brief invoke all registered clk_sys change callbacks
+ *
+ * It should **only** be called in HAL, during clk_sys change. This must be
+ * called with interrupt disabled.
+ *
+ * It shouldn't be called by application.
+ *
+ * \param [in] freq     clk_sys frequency to be changed
+ */
+void osiInvokeSysClkChangeCallbacks(uint32_t freq);
+
+/**
+ * \brief set hardware minimal clock constrain
+ *
+ * It is not needed to specify \a to be supported by hardware divider. The
+ * **closest** supported hardware divider will be chosen.
+ *
+ * When \a freq is too high to be supported by hardware, the highest
+ * supported frequency will be chosen.
+ *
+ * After this call, the actual clk_sys may be different with \a freq:
+ * - When there are higher frequency requests, the actual clk_sys frequency
+ *   may be higher than \a freq.
+ * - When the closest supported frequency is lower, the actual clk_sys
+ *   frequency may be lower than \a freq.
+ * - When \a freq is too high, clk_sys will be set to be the highest
+ *   supported frequency.
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ * \param [in] freq     minimum clk_sys frequency
+ */
+void osiRequestSysClk(osiClockConstrainRegistry_t *r, uint32_t freq);
+
+/**
+ * \brief set hardware minimal clock constrain, without specified frequency
+ *
+ * Besides it will prevent system sleep, it will prevent clk_sys related
+ * power consumption optimization.
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ */
+void osiRequestSysClkActive(osiClockConstrainRegistry_t *r);
+
+/**
+ * \brief set software minimal clock constrain
+ *
+ * It is similar to \p osiRequestSysClk. However, it won't prevent system
+ * sleep or clk_sys related power consumption optimization.
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ * \param [in] freq     minimum clk_sys frequency
+ */
+void osiRequestPerfClk(osiClockConstrainRegistry_t *r, uint32_t freq);
+
+/**
+ * \brief unset software or hardware minimal clock constrain
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ */
+void osiReleaseClk(osiClockConstrainRegistry_t *r);
+
+/**
+ * \brief whether slow down sys clock is allowed
+ *
+ * \return
+ *      - true if allowed
+ *      - false if not allowed
+ */
+bool osiIsSlowSysClkAllowed(void);
+
+/**
+ * \brief set hardware external RAM access constrain
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ */
+void osiRequestExtRamAccess(osiClockConstrainRegistry_t *r);
+
+/**
+ * \brief unset hardware external RAM access constrain
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ */
+void osiReleaseExtRamAccess(osiClockConstrainRegistry_t *r);
+
+/**
+ * \brief unset hardware external RAM access constrain
+ *
+ * \param [in] r        clock constrain registry, must be valid
+ */
+void osiReleaseAllConstrain(osiClockConstrainRegistry_t *r);
+
+/**
+ * \brief reapply clk_sys based on constrain
+ *
+ * It is possible that some constrains aren't satisfied immediately,
+ * especially to decrease clk_sys. So, it may be needed to reapply
+ * constrains. Usually, it is called in idle thread.
+ *
+ * It should be called by system only.
+ */
+void osiReapplySysClk(void);
+
+/**
+ * \brief dump clock constrain information to memory
+ *
+ * It is for debug only. The data format of timer information dump is
+ * not stable, and may change. Currently, there is 2 bytes header, and
+ * 12 bytes for each clock constrain.
+ *
+ * Caller should make sure \p mem is enough for hold clock constrain
+ * information of \p count.
+ *
+ * \param mem       memory for clock constrain information dump
+ * \param count     maximum clock constrain count to be dump
+ * \return      dump memory size
+ */
+int osiClockConstrainDump(void *mem, int count);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

+ 223 - 0
bsp/air724/sdk/components/include/osi_compiler.h

@@ -0,0 +1,223 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _OSI_COMPILER_H_
+#define _OSI_COMPILER_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+// macros for alias, either strong (global) or weak
+#define OSI_STRONG_ALIAS(alias, sym) __asm(".global " #alias "\n" #alias " = " #sym)
+#define OSI_WEAK_ALIAS(alias, sym) __asm(".weak " #alias "\n" #alias " = " #sym)
+
+// macro for nop instruction
+#define OSI_NOP asm volatile("nop")
+
+// macro for compiler memory access barrier
+#define OSI_BARRIER() asm volatile("" :: \
+                                       : "memory")
+
+// macro for alignment attribute
+#define OSI_CACHE_LINE_ALIGNED __attribute__((aligned(CONFIG_CACHE_LINE_SIZE)))
+#define OSI_ALIGNED(n) __attribute__((aligned(n)))
+
+#define OSI_ATTRIBUTE_ISR __attribute__((interrupt))
+#define OSI_ATTRIBUTE_USED __attribute__((used))
+
+// macros for "known" sections
+#define OSI_SECTION(sect) __attribute__((section(#sect)))
+#define OSI_SECTION_SRAM_BOOT_TEXT OSI_SECTION(.sramboottext)
+#define OSI_SECTION_SRAM_TEXT OSI_SECTION(.sramtext)
+#define OSI_SECTION_SRAM_DATA OSI_SECTION(.sramdata)
+#define OSI_SECTION_SRAM_BSS OSI_SECTION(.srambss)
+#define OSI_SECTION_SRAM_UNINIT OSI_SECTION(.sramuninit)
+#define OSI_SECTION_SRAM_UC_DATA OSI_SECTION(.sramucdata)
+#define OSI_SECTION_SRAM_UC_BSS OSI_SECTION(.sramucbss)
+#define OSI_SECTION_SRAM_UC_UNINIT OSI_SECTION(.sramucuninit)
+#define OSI_SECTION_RAM_TEXT OSI_SECTION(.ramtext)
+#define OSI_SECTION_RAM_DATA OSI_SECTION(.ramdata)
+#define OSI_SECTION_RAM_BSS OSI_SECTION(.rambss)
+#define OSI_SECTION_RAM_UNINIT OSI_SECTION(.ramuninit)
+#define OSI_SECTION_RAM_UC_DATA OSI_SECTION(.ramucdata)
+#define OSI_SECTION_RAM_UC_BSS OSI_SECTION(.ramucbss)
+#define OSI_SECTION_RAM_UC_UNINIT OSI_SECTION(.ramucuninit)
+#define OSI_SECTION_BOOT_TEXT OSI_SECTION(.boottext)
+#define OSI_SECTION_RO_KEEP __attribute__((used, section(".rokeep")))
+#define OSI_SECTION_RW_KEEP __attribute__((used, section(".rwkeep")))
+
+// macros for attributes
+#define OSI_WEAK __attribute__((weak))
+#define OSI_USED __attribute__((used))
+#define OSI_UNUSED __attribute__((unused))
+#define OSI_NO_RETURN __attribute__((__noreturn__))
+#define OSI_NO_INLINE __attribute__((noinline))
+#define OSI_FORCE_INLINE __attribute__((always_inline)) inline
+#if __mips__
+#define OSI_NO_MIPS16 __attribute__((nomips16))
+#else
+#define OSI_NO_MIPS16
+#endif
+
+// macro maybe helpful for compiler optimization
+#define OSI_LIKELY(x) __builtin_expect(!!(x), 1)
+#define OSI_UNLIKELY(x) __builtin_expect(!!(x), 0)
+
+// macros for MIPS KSEG0/1
+#if __mips__
+#define OSI_KSEG0(addr) (((unsigned long)(addr)&0x1fffffff) | 0x80000000)
+#define OSI_KSEG1(addr) (((unsigned long)(addr)&0x1fffffff) | 0xa0000000)
+#define OSI_IS_KSEG0(addr) (((unsigned long)(addr)&0xe0000000) == 0x80000000)
+#define OSI_IS_KSEG1(addr) (((unsigned long)(addr)&0xe0000000) == 0xa0000000)
+#define OSI_KSEG01_PHY_ADDR(addr) ((unsigned long)(addr)&0x0FFFFFFF)
+#endif
+
+// do { ... } while (0) is common trick to avoid if/else error
+#define OSI_DO_WHILE0(expr) \
+    do                      \
+    {                       \
+        expr                \
+    } while (0)
+
+// just a dead loop
+#define OSI_DEAD_LOOP OSI_DO_WHILE0(for (;;);)
+
+// Busy loop wait until condition is true
+#define OSI_LOOP_WAIT(cond) OSI_DO_WHILE0(while (!(cond));)
+
+// wait until condition is true with timeout, use osiDelayUS(8) inside
+// return the condition
+#define OSI_LOOP_WAIT_TIMEOUT_US(cond, us) ({ unsigned _us8 = (us) / 8; bool _waited = false; for (unsigned n = 0; n < _us8; n++) if (cond) { _waited = true; break; } else { osiDelayUS(8); } _waited; })
+
+// Busy loop wait util condition is true. When polling peripherals, it is
+// needed to avoid read peripheral registers without delay, especially
+// when the peripheral is connected to a slow bus. This may cause the bus
+// is busy to react CPU register read, and other operations are affected.
+#define OSI_POLL_WAIT(cond) OSI_DO_WHILE0(while (!(cond)) { OSI_NOP; OSI_NOP; OSI_NOP; OSI_NOP; })
+
+// Wait until condition is true, and return false when cond2 becomes false
+#define OSI_LOOP_WAIT_IF(cond, cond2) ({bool _waited = false; do { if (cond) { _waited = true; break; }} while (cond2); _waited; })
+// macro for load section, symbol naming style matches linker script
+#define OSI_LOAD_SECTION(name)                 \
+    do                                         \
+    {                                          \
+        extern uint32_t __##name##_start;      \
+        extern uint32_t __##name##_end;        \
+        extern uint32_t __##name##_load_start; \
+        uint32_t *p;                           \
+        uint32_t *l;                           \
+        for (p = &__##name##_start,            \
+            l = &__##name##_load_start;        \
+             p < &__##name##_end;)             \
+            *p++ = *l++;                       \
+    } while (0)
+
+// macro for clear section, symbol naming style matches linker script
+#define OSI_CLEAR_SECTION(name)           \
+    do                                    \
+    {                                     \
+        extern uint32_t __##name##_start; \
+        extern uint32_t __##name##_end;   \
+        uint32_t *p;                      \
+        for (p = &__##name##_start;       \
+             p < &__##name##_end;)        \
+            *p++ = 0;                     \
+    } while (0)
+
+// macro for fourcc tag
+#define OSI_MAKE_TAG(a, b, c, d) ((unsigned)(a) | ((unsigned)(b) << 8) | ((unsigned)(c) << 16) | ((unsigned)(d) << 24))
+
+// macro for array dimension
+#define OSI_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
+// macros for 2^n, and 2^n alignment
+#define OSI_IS_POW2(v) (((v) & ((v)-1)) == 0)
+#define OSI_IS_ALIGNED(v, n) (((unsigned long)(v) & ((n)-1)) == 0)
+#define OSI_ALIGN_UP(v, n) (((unsigned long)(v) + (n)-1) & ~((n)-1))
+#define OSI_ALIGN_DOWN(v, n) ((unsigned long)(v) & ~((n)-1))
+#define OSI_DIV_ROUND(m, n) (((m) + ((n) >> 1)) / (n))
+#define OSI_DIV_ROUND_UP(n, m) (((n) + (m)-1) / (m))
+
+// macro for compare two chars ignoring case
+#define OSI_CHAR_CASE_EQU(a, b) (((a) | 0x20) == ((b) | 0x20))
+
+// macro to increase the pointer, and return the original pointer
+#define OSI_PTR_INCR_POST(p, n) ({uintptr_t _orig = (p); (p) += (n); _orig; })
+
+// pointer (signed) diff, either can be any pointer type
+#define OSI_PTR_DIFF(a, b) ((intptr_t)(a) - (intptr_t)(b))
+
+// Macro for variadic argument count
+#define OSI_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, N, ...) N
+#define OSI_VA_NARGS(...) OSI_VA_NARGS_IMPL(0, ##__VA_ARGS__, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+
+// macros for declaration and definition
+#define OSI_DEF_CONST_VAR(decl, ...) static const decl = __VA_ARGS__
+#define OSI_DEF_GLOBAL_VAR(decl, ...) decl = __VA_ARGS__
+#define OSI_DECL_GLOBAL_VAR(decl, ...) extern decl
+
+// macros to convert CPU endian to little/big endian
+#define OSI_TO_LE16(v) (v)
+#define OSI_TO_LE32(v) (v)
+#define OSI_TO_BE16(v) __builtin_bswap16(v)
+#define OSI_TO_BE32(v) __builtin_bswap32(v)
+
+// macros to convert CPU endian from little/big endian
+#define OSI_FROM_LE16(v) (v)
+#define OSI_FROM_LE32(v) (v)
+#define OSI_FROM_BE16(v) __builtin_bswap16(v)
+#define OSI_FROM_BE32(v) __builtin_bswap32(v)
+
+// macro for 32bits register read and write
+#define OSI_REG32_WRITE(address, value) *(volatile uint32_t *)(address) = (value)
+#define OSI_REG32_READ(address) (*(volatile uint32_t *)(address))
+
+// macros for easier writing
+#define OSI_KB(n) ((unsigned)(n) * (unsigned)(1024))
+#define OSI_MB(n) ((unsigned)(n) * (unsigned)(1024 * 1024))
+#define OSI_GB(n) ((unsigned)(n) * (unsigned)(1024 * 1024 * 1024))
+#define OSI_MHZ(n) ((unsigned)(n) * (unsigned)(1000 * 1000))
+
+// macros for min, max. the variable will be accessed only once
+#define OSI_MIN(type, a, b) ({ type _a = (type)(a); type _b = (type)(b); _a < _b? _a : _b; })
+#define OSI_MAX(type, a, b) ({ type _a = (type)(a); type _b = (type)(b); _a > _b? _a : _b; })
+#define OSI_IS_IN_RANGE(type, a, start, end) ({type _a = (type)(a); type _start = (type)(start); type _end = (type)(end); _a >= _start && _a < _end; })
+#define OSI_IS_IN_REGION(type, a, start, size) ({type _a = (type)(a); type _start = (type)(start); type _end = _start + (type)(size); _a >= _start && _a < _end; })
+#define OSI_RANGE_INSIDE(type, start1, end1, start2, end2) ({type _s1 = (type)(start1), _e1 = (type)(end1), _s2 = (type)(start2), _e2 = (type)(end2);  _s1 >= _s2 && _e1 <= _e2; })
+#define OSI_REGION_INSIDE(type, start1, size1, start2, size2) ({type _s1 = (type)(start1), _e1 = _s1 + (type)(size1), _s2 = (type)(start2), _e2 = _s2 + (type)(size2);  _s1 >= _s2 && _e1 <= _e2; })
+
+// macro to swap 2 variables
+#define OSI_SWAP(type, a, b) ({ type _t = (a); (a) = (b); (b) = _t; })
+
+// macro for offsetof and container_of
+#define OSI_OFFSETOF(type, member) __builtin_offsetof(type, member)
+#define OSI_CONTAINER_OF(ptr, type, member) ((type *)((char *)(ptr)-OSI_OFFSETOF(type, member)))
+
+// assert not enabled by default, and shall not configured globally
+#if defined(OSI_LOCAL_DEBUG_ASSERT_ENABLED) && !defined(OSI_DEBUG_ASSERT_DISABLED)
+#define OSI_DEBUG_ASSERT(expr) OSI_DO_WHILE0(if (!(expr)) osiPanic();)
+#else
+#define OSI_DEBUG_ASSERT(expr)
+#endif
+
+#ifdef __cplusplus
+#define OSI_EXTERN_C extern "C"
+#define OSI_EXTERN_C_BEGIN extern "C" {
+#define OSI_EXTERN_C_END }
+#else
+#define OSI_EXTERN_C
+#define OSI_EXTERN_C_BEGIN
+#define OSI_EXTERN_C_END
+#endif
+
+#endif

+ 183 - 0
bsp/air724/sdk/components/include/osi_log.h

@@ -0,0 +1,183 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+* All rights reserved.
+*
+* This software is supplied "AS IS" without any warranties.
+* RDA assumes no responsibility or liability for the use of the software,
+* conveys no license or title under any patent, copyright, or mask work
+* right to the product. RDA reserves the right to make changes in the
+* software without notification.  RDA also make no representation or
+* warranty that such application will be suitable for the specified use
+* without further testing or modification.
+*/
+
+#ifndef _OSI_LOG_H_
+#define _OSI_LOG_H_
+
+#include <stdarg.h>
+#include "kernel_config.h"
+#include "osi_compiler.h"
+
+OSI_EXTERN_C_BEGIN
+
+#ifndef DOXYGEN
+#ifndef OSI_LOCAL_LOG_LEVEL
+#define OSI_LOCAL_LOG_LEVEL OSI_LOG_LEVEL_INFO
+#endif
+
+#ifdef OSI_LOG_DISABLED
+#undef OSI_LOCAL_LOG_LEVEL
+#define OSI_LOCAL_LOG_LEVEL OSI_LOG_LEVEL_NEVER
+#endif
+
+#ifndef OSI_LOCAL_LOG_TAG
+#ifdef OSI_LOG_TAG
+#define OSI_LOCAL_LOG_TAG OSI_LOG_TAG
+#else
+#define OSI_LOCAL_LOG_TAG LOG_TAG_NONE
+#endif
+#endif
+#endif
+
+/**
+ * trace level, larger value is less important
+ */
+enum
+{
+    OSI_LOG_LEVEL_NEVER,  ///< only used in control, for not to output trace
+    OSI_LOG_LEVEL_ERROR,  ///< error
+    OSI_LOG_LEVEL_WARN,   ///< warning
+    OSI_LOG_LEVEL_INFO,   ///< information
+    OSI_LOG_LEVEL_DEBUG,  ///< for debug
+    OSI_LOG_LEVEL_VERBOSE ///< verbose
+};
+
+/**
+ * macro for trace tag
+ */
+#define OSI_MAKE_LOG_TAG(a, b, c, d) ((unsigned)(a) | ((unsigned)(b) << 7) | ((unsigned)(c) << 14) | ((unsigned)(d) << 21))
+
+/**
+ * macro for extended trace argument types
+ */
+#define OSI_LOGPAR(...) __OSI_LOGPAR(__VA_ARGS__)
+
+/**
+ * macros for trace level condition
+ *
+ * \code{.cpp}
+ * if (OSI_LOGD_EN) {
+ *     ......
+ * }
+ * \endcode
+ *
+ * When DEBUG trace is not enabled, the above codes will be expanded as empty.
+ */
+#define OSI_LOGE_EN (OSI_LOCAL_LOG_LEVEL >= OSI_LOG_LEVEL_ERROR)
+#define OSI_LOGW_EN (OSI_LOCAL_LOG_LEVEL >= OSI_LOG_LEVEL_WARN)
+#define OSI_LOGI_EN (OSI_LOCAL_LOG_LEVEL >= OSI_LOG_LEVEL_INFO)
+#define OSI_LOGD_EN (OSI_LOCAL_LOG_LEVEL >= OSI_LOG_LEVEL_DEBUG)
+#define OSI_LOGV_EN (OSI_LOCAL_LOG_LEVEL >= OSI_LOG_LEVEL_VERBOSE)
+
+/**
+ * macros for basic trace
+ *
+ * When the trace level is not enabled, the macro will be expanded as empty.
+ *
+ * At most 16 arguments are supported.
+ *
+ * @param trcid     trace ID, 0 for not use trace ID
+ * @param fmt       format string, only used when trace ID is 0
+ */
+#define OSI_LOGE(trcid, fmt, ...) __OSI_LOGB(OSI_LOG_LEVEL_ERROR, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGW(trcid, fmt, ...) __OSI_LOGB(OSI_LOG_LEVEL_WARN, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGI(trcid, fmt, ...) __OSI_LOGB(OSI_LOG_LEVEL_INFO, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGD(trcid, fmt, ...) __OSI_LOGB(OSI_LOG_LEVEL_DEBUG, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGV(trcid, fmt, ...) __OSI_LOGB(OSI_LOG_LEVEL_VERBOSE, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for extended trace
+ *
+ * When the trace level is not enabled, the macro will be expanded as empty.
+ *
+ * At most 16 arguments are supported.
+ *
+ * @param partype   arguments types
+ * @param trcid     trace ID, 0 for not use trace ID
+ * @param fmt       format string, only used when trace ID is 0
+ */
+#define OSI_LOGXE(partype, trcid, fmt, ...) __OSI_LOGX(OSI_LOG_LEVEL_ERROR, partype, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGXW(partype, trcid, fmt, ...) __OSI_LOGX(OSI_LOG_LEVEL_WARN, partype, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGXI(partype, trcid, fmt, ...) __OSI_LOGX(OSI_LOG_LEVEL_INFO, partype, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGXD(partype, trcid, fmt, ...) __OSI_LOGX(OSI_LOG_LEVEL_DEBUG, partype, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LOGXV(partype, trcid, fmt, ...) __OSI_LOGX(OSI_LOG_LEVEL_VERBOSE, partype, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for trace with format string parsing
+ *
+ * When the trace level is not enabled, the macro will be expanded as empty.
+ *
+ * At most 16 arguments are supported.
+ *
+ * @param fmt       format string, only used when trace ID is 0
+ */
+#define OSI_PRINTFE(fmt, ...) __OSI_PRINTF(OSI_LOG_LEVEL_ERROR, fmt, ##__VA_ARGS__)
+#define OSI_PRINTFW(fmt, ...) __OSI_PRINTF(OSI_LOG_LEVEL_WARN, fmt, ##__VA_ARGS__)
+#define OSI_PRINTFI(fmt, ...) __OSI_PRINTF(OSI_LOG_LEVEL_INFO, fmt, ##__VA_ARGS__)
+#define OSI_PRINTFD(fmt, ...) __OSI_PRINTF(OSI_LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
+#define OSI_PRINTFV(fmt, ...) __OSI_PRINTF(OSI_LOG_LEVEL_VERBOSE, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for SX style trace and dump
+ *
+ * \p id is a complex bit fields. The definition follows SX definition.
+ */
+#define OSI_SXPRINTF(id, fmt, ...) __OSI_SXPRINTF(id, fmt, ##__VA_ARGS__)
+#define OSI_SXDUMP(id, fmt, data, size) __OSI_SXDUMP(id, fmt, data, size)
+
+/**
+ * macros for new SX style trace
+ *
+ * Only module level in \p id will be used. When SX style trace is wanted to
+ * be kept, it is suggested to migrate to these 2 macros.
+ */
+#define OSI_SX_TRACE(id, trcid, fmt, ...) __OSI_SX_TRACE(id, trcid, fmt, ##__VA_ARGS__)
+#define OSI_SX_TRACEX(id, partype, trcid, fmt, ...) __OSI_SX_TRACEX(id, partype, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for stack trace of pub modules
+ */
+#define OSI_PUB_TRACE(module, category, trcid, fmt, ...) __OSI_PUB_TRACE(module, category, trcid, fmt, ##__VA_ARGS__)
+#define OSI_PUB_TRACEX(module, category, partype, trcid, fmt, ...) __OSI_PUB_TRACEX(module, category, partype, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for stack trace of lte modules
+ */
+#define OSI_LTE_TRACE(module, category, trcid, fmt, ...) __OSI_LTE_TRACE(module, category, trcid, fmt, ##__VA_ARGS__)
+#define OSI_LTE_TRACEX(module, category, partype, trcid, fmt, ...) __OSI_LTE_TRACEX(module, category, partype, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * macros for stack trace without module and category control
+ *
+ * It is suggested to use these 2 for quick debug only. The above macros
+ * with module and category control should be used.
+ */
+#define OSI_TRACE(trcid, fmt, ...) __OSI_TRACE(trcid, fmt, ##__VA_ARGS__)
+#define OSI_TRACEX(partype, trcid, fmt, ...) __OSI_TRACEX(partype, trcid, fmt, ##__VA_ARGS__)
+
+/**
+ * \brief trace vprintf by parsing format string
+ *
+ * This can be used to implement trace functions in third party library.
+ * When there are chances to modify source codes, the appropriate macros
+ * from above should be used.
+ *
+ * @param tag   packed trace tag and trace level
+ * @param fmt   format string
+ * @param ap    variadic argument list
+ */
+void osiTraceVprintf(unsigned tag, const char *fmt, va_list ap);
+
+#include "osi_log_imp.h"
+
+OSI_EXTERN_C_END
+#endif

+ 1053 - 0
bsp/air724/sdk/components/include/osi_log_imp.h

@@ -0,0 +1,1053 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+* All rights reserved.
+*
+* This software is supplied "AS IS" without any warranties.
+* RDA assumes no responsibility or liability for the use of the software,
+* conveys no license or title under any patent, copyright, or mask work
+* right to the product. RDA reserves the right to make changes in the
+* software without notification.  RDA also make no representation or
+* warranty that such application will be suitable for the specified use
+* without further testing or modification.
+*/
+
+#ifndef _OSI_LOG_H_
+#error "osi_log_imp.h can only be included by osi_log.h"
+#endif
+
+// pre-defined trace tags
+#define LOG_TAG_NONE OSI_MAKE_LOG_TAG(' ', ' ', ' ', ' ')
+#define LOG_TAG_HAL OSI_MAKE_LOG_TAG('H', 'A', 'L', ' ')
+#define LOG_TAG_DRV OSI_MAKE_LOG_TAG('D', 'R', 'V', ' ')
+#define LOG_TAG_USB_SVC OSI_MAKE_LOG_TAG('S', 'U', 'S', 'B')
+#define LOG_TAG_FILE_SYSTEM OSI_MAKE_LOG_TAG('F', 'S', 'Y', 'S')
+#define LOG_TAG_ATE OSI_MAKE_LOG_TAG('A', 'T', 'E', 'N')
+#define LOG_TAG_MMI OSI_MAKE_LOG_TAG('M', 'M', 'I', ' ')
+#define LOG_TAG_KERNEL OSI_MAKE_LOG_TAG('K', 'E', 'R', 'N')
+#define LOG_TAG_APPSTART OSI_MAKE_LOG_TAG('A', 'P', 'P', 'S')
+#define LOG_TAG_DRIVER OSI_MAKE_LOG_TAG('D', 'R', 'V', 'R')
+#define LOG_TAG_FS OSI_MAKE_LOG_TAG('F', 'S', 'Y', 'S')
+#define LOG_TAG_ML OSI_MAKE_LOG_TAG('M', 'L', 'A', 'N')
+#define LOG_TAG_BOOT OSI_MAKE_LOG_TAG('B', 'O', 'O', 'T')
+#define LOG_TAG_UNITY OSI_MAKE_LOG_TAG('U', 'N', 'I', 'T')
+#define LOG_TAG_NET OSI_MAKE_LOG_TAG('N', 'E', 'T', ' ')
+#define LOG_TAG_CFW OSI_MAKE_LOG_TAG('C', 'F', 'W', ' ')
+#define LOG_TAG_UNIT_TEST OSI_MAKE_LOG_TAG('U', 'T', 'S', 'T')
+#define LOG_TAG_AUDIO OSI_MAKE_LOG_TAG('A', 'U', 'D', 'I')
+/*+NEW\2020.1.15\lijiaodi\Ìí¼Óopenat´òÓ¡*/
+#define LOG_TAG_OPENAT OSI_MAKE_LOG_TAG('O', 'P', 'E', 'N')
+/*-NEW\2020.1.15\lijiaodi\Ìí¼Óopenat´òÓ¡*/
+
+void osiTracePrintf(unsigned tag, const char *fmt, ...);
+
+void osiTraceBasic(unsigned tag, unsigned nargs, const char *fmt, ...);
+void osiTraceEx(unsigned tag, unsigned partype, const char *fmt, ...);
+void osiTraceIdBasic(unsigned tag, unsigned nargs, unsigned trcid, ...);
+void osiTraceIdEx(unsigned tag, unsigned partype, unsigned trcid, ...);
+
+void osiTraceTraBasic(unsigned nargs, const char *fmt, ...);
+void osiTraceTraEx(unsigned partype, const char *fmt, ...);
+void osiTraceTraIdBasic(unsigned nargs, unsigned trcid, ...);
+void osiTraceTraIdEx(unsigned partype, unsigned trcid, ...);
+
+void osiTraceSxIdBasic(unsigned id, unsigned nargs, unsigned fmt, ...);
+void osiTraceSxIdEx(unsigned id, unsigned partype, unsigned fmt, ...);
+void osiTraceSxBasic(unsigned id, unsigned nargs, const char *fmt, ...);
+void osiTraceSxEx(unsigned id, unsigned partype, const char *fmt, ...);
+void osiTraceSxOutput(unsigned id, const char *fmt, va_list ap);
+
+void osiTracePubIdBasic(unsigned module, unsigned category, unsigned nargs, unsigned fmt, ...);
+void osiTracePubIdEx(unsigned module, unsigned category, unsigned partype, unsigned fmt, ...);
+void osiTracePubBasic(unsigned module, unsigned category, unsigned nargs, const char *fmt, ...);
+void osiTracePubEx(unsigned module, unsigned category, unsigned partype, const char *fmt, ...);
+
+void osiTraceLteIdBasic(unsigned module, unsigned category, unsigned nargs, unsigned fmt, ...);
+void osiTraceLteIdEx(unsigned module, unsigned category, unsigned partype, unsigned fmt, ...);
+void osiTraceLteBasic(unsigned module, unsigned category, unsigned nargs, const char *fmt, ...);
+void osiTraceLteEx(unsigned module, unsigned category, unsigned partype, const char *fmt, ...);
+
+#ifdef OSI_LOG_USE_PRINTF
+extern int printf(const char *format, ...);
+#define __OSI_LOGB(level, fmtid, fmt, ...) printf(fmt, ##__VA_ARGS__)
+#define __OSI_LOGX(level, partype, fmtid, fmt, ...) printf(fmt, ##__VA_ARGS__)
+#define __OSI_PRINTF(level, fmt, ...) printf(fmt, ##__VA_ARGS__)
+#else
+#ifdef CONFIG_KERNEL_DISABLE_TRACEID
+#define __OSI_LOG_DISABLE_ID 1
+#else
+#define __OSI_LOG_DISABLE_ID 0
+#endif
+#define __OSI_LOGB(level, fmtid, fmt, ...)                                                                             \
+    do                                                                                                                 \
+    {                                                                                                                  \
+        if (OSI_LOCAL_LOG_LEVEL >= level)                                                                              \
+        {                                                                                                              \
+            if ((fmtid) == 0 || __OSI_LOG_DISABLE_ID)                                                                  \
+                __OSI_LOGB_IMP((level << 28) | (OSI_LOCAL_LOG_TAG), OSI_VA_NARGS(__VA_ARGS__), fmt, ##__VA_ARGS__);    \
+            else                                                                                                       \
+                __OSI_DLOGB_IMP((level << 28) | (OSI_LOCAL_LOG_TAG), OSI_VA_NARGS(__VA_ARGS__), fmtid, ##__VA_ARGS__); \
+        }                                                                                                              \
+    } while (0)
+
+#define __OSI_LOGX(level, partype, fmtid, fmt, ...)                                                  \
+    do                                                                                               \
+    {                                                                                                \
+        if (OSI_LOCAL_LOG_LEVEL >= level)                                                            \
+        {                                                                                            \
+            if ((fmtid) == 0 || __OSI_LOG_DISABLE_ID)                                                \
+                __OSI_LOGX_IMP((level << 28) | (OSI_LOCAL_LOG_TAG), partype, fmt, ##__VA_ARGS__);    \
+            else                                                                                     \
+                __OSI_DLOGX_IMP((level << 28) | (OSI_LOCAL_LOG_TAG), partype, fmtid, ##__VA_ARGS__); \
+        }                                                                                            \
+    } while (0)
+#define __OSI_PRINTF(level, fmt, ...)                                                \
+    do                                                                               \
+    {                                                                                \
+        if (OSI_LOCAL_LOG_LEVEL >= level)                                            \
+            osiTracePrintf((level << 28) | (OSI_LOCAL_LOG_TAG), fmt, ##__VA_ARGS__); \
+    } while (0)
+
+#define __OSI_LOGB_IMP(tag, nargs, fmt, ...) osiTraceBasic(tag, nargs, fmt, ##__VA_ARGS__)
+#define __OSI_LOGX_IMP(tag, partype, fmt, ...) osiTraceEx(tag, partype, fmt, ##__VA_ARGS__)
+#define __OSI_DLOGB_IMP(tag, nargs, fmtid, ...) osiTraceIdBasic(tag, nargs, fmtid, ##__VA_ARGS__)
+#define __OSI_DLOGX_IMP(tag, partype, fmtid, ...) osiTraceIdEx(tag, partype, fmtid, ##__VA_ARGS__)
+#endif
+
+enum
+{
+    __OSI_LOGPAR_I = 1,
+    __OSI_LOGPAR_D = 2,
+    __OSI_LOGPAR_F = 3,
+    __OSI_LOGPAR_S = 4,
+    __OSI_LOGPAR_M = 5
+};
+
+static inline unsigned OSI_TSMAP_PARTYPE(unsigned n, unsigned tsmap)
+{
+    unsigned partype = 0;
+    if ((n) >= 1)
+        partype |= (((tsmap)&0x01) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 0;
+    if ((n) >= 2)
+        partype |= (((tsmap)&0x02) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 4;
+    if ((n) >= 3)
+        partype |= (((tsmap)&0x04) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 8;
+    if ((n) >= 4)
+        partype |= (((tsmap)&0x08) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 12;
+    if ((n) >= 5)
+        partype |= (((tsmap)&0x10) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 16;
+    if ((n) >= 6)
+        partype |= (((tsmap)&0x20) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 20;
+    if ((n) >= 7)
+        partype |= (((tsmap)&0x40) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 24;
+    if ((n) >= 8)
+        partype |= (((tsmap)&0x80) ? __OSI_LOGPAR_S : __OSI_LOGPAR_I) << 28;
+    return partype;
+}
+
+#define __OSI_SXPRINTF(id, fmt, ...)                                        \
+    do                                                                      \
+    {                                                                       \
+        unsigned tdb = (id) & (1 << 12);                                    \
+        unsigned tsmap = ((id) >> 15) & 0x3f;                               \
+        unsigned nargs = OSI_VA_NARGS(__VA_ARGS__);                         \
+        unsigned partype = OSI_TSMAP_PARTYPE(nargs, tsmap);                 \
+        if (tdb && tsmap == 0)                                              \
+            osiTraceSxIdBasic(id, nargs, (unsigned)(fmt), ##__VA_ARGS__);   \
+        else if (tdb && tsmap != 0)                                         \
+            osiTraceSxIdEx(id, partype, (unsigned)(fmt), ##__VA_ARGS__);    \
+        else if (tsmap == 0)                                                \
+            osiTraceSxBasic(id, nargs, (const char *)(fmt), ##__VA_ARGS__); \
+        else                                                                \
+            osiTraceSxEx(id, partype, (const char *)(fmt), ##__VA_ARGS__);  \
+    } while (0)
+
+#define __OSI_SXDUMP(id, fmt, data, size) osiTraceSxIdEx(id, OSI_LOGPAR_M, 0x10005236, size, data)
+
+#define __OSI_SX_TRACE(id, trcid, fmt, ...)                                         \
+    do                                                                              \
+    {                                                                               \
+        if (trcid == 0)                                                             \
+            osiTraceSxBasic(id, OSI_VA_NARGS(__VA_ARGS__), fmt, ##__VA_ARGS__);     \
+        else                                                                        \
+            osiTraceSxIdBasic(id, OSI_VA_NARGS(__VA_ARGS__), trcid, ##__VA_ARGS__); \
+    } while (0)
+#define __OSI_SX_TRACEX(id, partype, trcid, fmt, ...)          \
+    do                                                         \
+    {                                                          \
+        if (trcid == 0)                                        \
+            osiTraceSxEx(id, partype, fmt, ##__VA_ARGS__);     \
+        else                                                   \
+            osiTraceSxIdEx(id, partype, trcid, ##__VA_ARGS__); \
+    } while (0)
+
+#define OSI_TRACE_CATEGORY_CONTROL (0xffffffff)
+#define OSI_TRACE_PUB_MODULE_CTRL (0xffffffff)
+#define OSI_TRACE_LTE_MODULE_CTRL (0xffffffff)
+
+#define __OSI_PUB_TRACE(module, category, trcid, fmt, ...)                                             \
+    do                                                                                                 \
+    {                                                                                                  \
+        if ((OSI_TRACE_PUB_MODULE_CTRL & (module)) && (OSI_TRACE_CATEGORY_CONTROL & (category)))       \
+        {                                                                                              \
+            if (trcid == 0)                                                                            \
+                osiTracePubBasic(module, category, OSI_VA_NARGS(__VA_ARGS__), fmt, ##__VA_ARGS__);     \
+            else                                                                                       \
+                osiTracePubIdBasic(module, category, OSI_VA_NARGS(__VA_ARGS__), trcid, ##__VA_ARGS__); \
+        }                                                                                              \
+    } while (0)
+#define __OSI_PUB_TRACEX(module, category, partype, trcid, fmt, ...)                             \
+    do                                                                                           \
+    {                                                                                            \
+        if ((OSI_TRACE_PUB_MODULE_CTRL & (module)) && (OSI_TRACE_CATEGORY_CONTROL & (category))) \
+        {                                                                                        \
+            if (trcid == 0)                                                                      \
+                osiTracePubEx(module, category, partype, fmt, ##__VA_ARGS__);                    \
+            else                                                                                 \
+                osiTracePubIdEx(module, category, partype, trcid, ##__VA_ARGS__);                \
+        }                                                                                        \
+    } while (0)
+#define __OSI_LTE_TRACE(module, category, trcid, fmt, ...)                                             \
+    do                                                                                                 \
+    {                                                                                                  \
+        if ((OSI_TRACE_PUB_MODULE_CTRL & (module)) && (OSI_TRACE_CATEGORY_CONTROL & (category)))       \
+        {                                                                                              \
+            if (trcid == 0)                                                                            \
+                osiTraceLteBasic(module, category, OSI_VA_NARGS(__VA_ARGS__), fmt, ##__VA_ARGS__);     \
+            else                                                                                       \
+                osiTraceLteIdBasic(module, category, OSI_VA_NARGS(__VA_ARGS__), trcid, ##__VA_ARGS__); \
+        }                                                                                              \
+    } while (0)
+#define __OSI_LTE_TRACEX(module, category, partype, trcid, fmt, ...)                             \
+    do                                                                                           \
+    {                                                                                            \
+        if ((OSI_TRACE_LTE_MODULE_CTRL & (module)) && (OSI_TRACE_CATEGORY_CONTROL & (category))) \
+        {                                                                                        \
+            if (trcid == 0)                                                                      \
+                osiTraceLteEx(module, category, partype, fmt, ##__VA_ARGS__);                    \
+            else                                                                                 \
+                osiTraceLteIdEx(module, category, partype, trcid, ##__VA_ARGS__);                \
+        }                                                                                        \
+    } while (0)
+#define __OSI_TRACE(trcid, fmt, ...)                                             \
+    do                                                                           \
+    {                                                                            \
+        if (trcid == 0)                                                          \
+            osiTraceTraBasic(OSI_VA_NARGS(__VA_ARGS__), fmt, ##__VA_ARGS__);     \
+        else                                                                     \
+            osiTraceTraIdBasic(OSI_VA_NARGS(__VA_ARGS__), trcid, ##__VA_ARGS__); \
+    } while (0)
+#define __OSI_TRACEX(partype, trcid, fmt, ...)              \
+    do                                                      \
+    {                                                       \
+        if (trcid == 0)                                     \
+            osiTraceTraEx(partype, fmt, ##__VA_ARGS__);     \
+        else                                                \
+            osiTraceTraIdEx(partype, trcid, ##__VA_ARGS__); \
+    } while (0)
+
+#define __OSI_LOGPAR_IMP2(count, ...) __OSI_LOGPAR_X##count(__VA_ARGS__)
+#define __OSI_LOGPAR_IMP1(count, ...) __OSI_LOGPAR_IMP2(count, __VA_ARGS__)
+#define __OSI_LOGPAR(...) __OSI_LOGPAR_IMP1(OSI_VA_NARGS(__VA_ARGS__), __VA_ARGS__)
+
+#define __OSI_LOGPAR_POS(n, p) (__OSI_LOGPAR_##p << (n * 4))
+#define __OSI_LOGPAR_X1(a) (__OSI_LOGPAR_POS(0, a))
+#define __OSI_LOGPAR_X2(a, b) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b))
+#define __OSI_LOGPAR_X3(a, b, c) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b) | __OSI_LOGPAR_POS(2, c))
+#define __OSI_LOGPAR_X4(a, b, c, d) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b) | __OSI_LOGPAR_POS(2, c) | __OSI_LOGPAR_POS(3, d))
+#define __OSI_LOGPAR_X5(a, b, c, d, e) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b) | __OSI_LOGPAR_POS(2, c) | __OSI_LOGPAR_POS(3, d) | __OSI_LOGPAR_POS(4, e))
+#define __OSI_LOGPAR_X6(a, b, c, d, e, f) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b) | __OSI_LOGPAR_POS(2, c) | __OSI_LOGPAR_POS(3, d) | __OSI_LOGPAR_POS(4, e) | __OSI_LOGPAR_POS(5, f))
+#define __OSI_LOGPAR_X7(a, b, c, d, e, f, g) (__OSI_LOGPAR_POS(0, a) | __OSI_LOGPAR_POS(1, b) | __OSI_LOGPAR_POS(2, c) | __OSI_LOGPAR_POS(3, d) | __OSI_LOGPAR_POS(4, e) | __OSI_LOGPAR_POS(5, f) | __OSI_LOGPAR_POS(6, g))
+
+/*
+for a in I D F S M; do
+    echo "#define OSI_LOGPAR_${a} __OSI_LOGPAR_X1($a)"
+    for b in I D F S M; do
+        echo "#define OSI_LOGPAR_${a}${b} __OSI_LOGPAR_X2($a, $b)"
+        for c in I D F S M; do
+            echo "#define OSI_LOGPAR_${a}${b}${c} __OSI_LOGPAR_X3($a, $b, $c)"
+            for d in I D F S M; do
+                echo "#define OSI_LOGPAR_${a}${b}${c}${d} __OSI_LOGPAR_X4($a, $b, $c, $d)"
+            done
+        done
+    done
+done
+*/
+#define OSI_LOGPAR_I __OSI_LOGPAR_X1(I)
+#define OSI_LOGPAR_II __OSI_LOGPAR_X2(I, I)
+#define OSI_LOGPAR_III __OSI_LOGPAR_X3(I, I, I)
+#define OSI_LOGPAR_IIII __OSI_LOGPAR_X4(I, I, I, I)
+#define OSI_LOGPAR_IIID __OSI_LOGPAR_X4(I, I, I, D)
+#define OSI_LOGPAR_IIIF __OSI_LOGPAR_X4(I, I, I, F)
+#define OSI_LOGPAR_IIIS __OSI_LOGPAR_X4(I, I, I, S)
+#define OSI_LOGPAR_IIIM __OSI_LOGPAR_X4(I, I, I, M)
+#define OSI_LOGPAR_IID __OSI_LOGPAR_X3(I, I, D)
+#define OSI_LOGPAR_IIDI __OSI_LOGPAR_X4(I, I, D, I)
+#define OSI_LOGPAR_IIDD __OSI_LOGPAR_X4(I, I, D, D)
+#define OSI_LOGPAR_IIDF __OSI_LOGPAR_X4(I, I, D, F)
+#define OSI_LOGPAR_IIDS __OSI_LOGPAR_X4(I, I, D, S)
+#define OSI_LOGPAR_IIDM __OSI_LOGPAR_X4(I, I, D, M)
+#define OSI_LOGPAR_IIF __OSI_LOGPAR_X3(I, I, F)
+#define OSI_LOGPAR_IIFI __OSI_LOGPAR_X4(I, I, F, I)
+#define OSI_LOGPAR_IIFD __OSI_LOGPAR_X4(I, I, F, D)
+#define OSI_LOGPAR_IIFF __OSI_LOGPAR_X4(I, I, F, F)
+#define OSI_LOGPAR_IIFS __OSI_LOGPAR_X4(I, I, F, S)
+#define OSI_LOGPAR_IIFM __OSI_LOGPAR_X4(I, I, F, M)
+#define OSI_LOGPAR_IIS __OSI_LOGPAR_X3(I, I, S)
+#define OSI_LOGPAR_IISI __OSI_LOGPAR_X4(I, I, S, I)
+#define OSI_LOGPAR_IISD __OSI_LOGPAR_X4(I, I, S, D)
+#define OSI_LOGPAR_IISF __OSI_LOGPAR_X4(I, I, S, F)
+#define OSI_LOGPAR_IISS __OSI_LOGPAR_X4(I, I, S, S)
+#define OSI_LOGPAR_IISM __OSI_LOGPAR_X4(I, I, S, M)
+#define OSI_LOGPAR_IIM __OSI_LOGPAR_X3(I, I, M)
+#define OSI_LOGPAR_IIMI __OSI_LOGPAR_X4(I, I, M, I)
+#define OSI_LOGPAR_IIMD __OSI_LOGPAR_X4(I, I, M, D)
+#define OSI_LOGPAR_IIMF __OSI_LOGPAR_X4(I, I, M, F)
+#define OSI_LOGPAR_IIMS __OSI_LOGPAR_X4(I, I, M, S)
+#define OSI_LOGPAR_IIMM __OSI_LOGPAR_X4(I, I, M, M)
+#define OSI_LOGPAR_ID __OSI_LOGPAR_X2(I, D)
+#define OSI_LOGPAR_IDI __OSI_LOGPAR_X3(I, D, I)
+#define OSI_LOGPAR_IDII __OSI_LOGPAR_X4(I, D, I, I)
+#define OSI_LOGPAR_IDID __OSI_LOGPAR_X4(I, D, I, D)
+#define OSI_LOGPAR_IDIF __OSI_LOGPAR_X4(I, D, I, F)
+#define OSI_LOGPAR_IDIS __OSI_LOGPAR_X4(I, D, I, S)
+#define OSI_LOGPAR_IDIM __OSI_LOGPAR_X4(I, D, I, M)
+#define OSI_LOGPAR_IDD __OSI_LOGPAR_X3(I, D, D)
+#define OSI_LOGPAR_IDDI __OSI_LOGPAR_X4(I, D, D, I)
+#define OSI_LOGPAR_IDDD __OSI_LOGPAR_X4(I, D, D, D)
+#define OSI_LOGPAR_IDDF __OSI_LOGPAR_X4(I, D, D, F)
+#define OSI_LOGPAR_IDDS __OSI_LOGPAR_X4(I, D, D, S)
+#define OSI_LOGPAR_IDDM __OSI_LOGPAR_X4(I, D, D, M)
+#define OSI_LOGPAR_IDF __OSI_LOGPAR_X3(I, D, F)
+#define OSI_LOGPAR_IDFI __OSI_LOGPAR_X4(I, D, F, I)
+#define OSI_LOGPAR_IDFD __OSI_LOGPAR_X4(I, D, F, D)
+#define OSI_LOGPAR_IDFF __OSI_LOGPAR_X4(I, D, F, F)
+#define OSI_LOGPAR_IDFS __OSI_LOGPAR_X4(I, D, F, S)
+#define OSI_LOGPAR_IDFM __OSI_LOGPAR_X4(I, D, F, M)
+#define OSI_LOGPAR_IDS __OSI_LOGPAR_X3(I, D, S)
+#define OSI_LOGPAR_IDSI __OSI_LOGPAR_X4(I, D, S, I)
+#define OSI_LOGPAR_IDSD __OSI_LOGPAR_X4(I, D, S, D)
+#define OSI_LOGPAR_IDSF __OSI_LOGPAR_X4(I, D, S, F)
+#define OSI_LOGPAR_IDSS __OSI_LOGPAR_X4(I, D, S, S)
+#define OSI_LOGPAR_IDSM __OSI_LOGPAR_X4(I, D, S, M)
+#define OSI_LOGPAR_IDM __OSI_LOGPAR_X3(I, D, M)
+#define OSI_LOGPAR_IDMI __OSI_LOGPAR_X4(I, D, M, I)
+#define OSI_LOGPAR_IDMD __OSI_LOGPAR_X4(I, D, M, D)
+#define OSI_LOGPAR_IDMF __OSI_LOGPAR_X4(I, D, M, F)
+#define OSI_LOGPAR_IDMS __OSI_LOGPAR_X4(I, D, M, S)
+#define OSI_LOGPAR_IDMM __OSI_LOGPAR_X4(I, D, M, M)
+#define OSI_LOGPAR_IF __OSI_LOGPAR_X2(I, F)
+#define OSI_LOGPAR_IFI __OSI_LOGPAR_X3(I, F, I)
+#define OSI_LOGPAR_IFII __OSI_LOGPAR_X4(I, F, I, I)
+#define OSI_LOGPAR_IFID __OSI_LOGPAR_X4(I, F, I, D)
+#define OSI_LOGPAR_IFIF __OSI_LOGPAR_X4(I, F, I, F)
+#define OSI_LOGPAR_IFIS __OSI_LOGPAR_X4(I, F, I, S)
+#define OSI_LOGPAR_IFIM __OSI_LOGPAR_X4(I, F, I, M)
+#define OSI_LOGPAR_IFD __OSI_LOGPAR_X3(I, F, D)
+#define OSI_LOGPAR_IFDI __OSI_LOGPAR_X4(I, F, D, I)
+#define OSI_LOGPAR_IFDD __OSI_LOGPAR_X4(I, F, D, D)
+#define OSI_LOGPAR_IFDF __OSI_LOGPAR_X4(I, F, D, F)
+#define OSI_LOGPAR_IFDS __OSI_LOGPAR_X4(I, F, D, S)
+#define OSI_LOGPAR_IFDM __OSI_LOGPAR_X4(I, F, D, M)
+#define OSI_LOGPAR_IFF __OSI_LOGPAR_X3(I, F, F)
+#define OSI_LOGPAR_IFFI __OSI_LOGPAR_X4(I, F, F, I)
+#define OSI_LOGPAR_IFFD __OSI_LOGPAR_X4(I, F, F, D)
+#define OSI_LOGPAR_IFFF __OSI_LOGPAR_X4(I, F, F, F)
+#define OSI_LOGPAR_IFFS __OSI_LOGPAR_X4(I, F, F, S)
+#define OSI_LOGPAR_IFFM __OSI_LOGPAR_X4(I, F, F, M)
+#define OSI_LOGPAR_IFS __OSI_LOGPAR_X3(I, F, S)
+#define OSI_LOGPAR_IFSI __OSI_LOGPAR_X4(I, F, S, I)
+#define OSI_LOGPAR_IFSD __OSI_LOGPAR_X4(I, F, S, D)
+#define OSI_LOGPAR_IFSF __OSI_LOGPAR_X4(I, F, S, F)
+#define OSI_LOGPAR_IFSS __OSI_LOGPAR_X4(I, F, S, S)
+#define OSI_LOGPAR_IFSM __OSI_LOGPAR_X4(I, F, S, M)
+#define OSI_LOGPAR_IFM __OSI_LOGPAR_X3(I, F, M)
+#define OSI_LOGPAR_IFMI __OSI_LOGPAR_X4(I, F, M, I)
+#define OSI_LOGPAR_IFMD __OSI_LOGPAR_X4(I, F, M, D)
+#define OSI_LOGPAR_IFMF __OSI_LOGPAR_X4(I, F, M, F)
+#define OSI_LOGPAR_IFMS __OSI_LOGPAR_X4(I, F, M, S)
+#define OSI_LOGPAR_IFMM __OSI_LOGPAR_X4(I, F, M, M)
+#define OSI_LOGPAR_IS __OSI_LOGPAR_X2(I, S)
+#define OSI_LOGPAR_ISI __OSI_LOGPAR_X3(I, S, I)
+#define OSI_LOGPAR_ISII __OSI_LOGPAR_X4(I, S, I, I)
+#define OSI_LOGPAR_ISID __OSI_LOGPAR_X4(I, S, I, D)
+#define OSI_LOGPAR_ISIF __OSI_LOGPAR_X4(I, S, I, F)
+#define OSI_LOGPAR_ISIS __OSI_LOGPAR_X4(I, S, I, S)
+#define OSI_LOGPAR_ISIM __OSI_LOGPAR_X4(I, S, I, M)
+#define OSI_LOGPAR_ISD __OSI_LOGPAR_X3(I, S, D)
+#define OSI_LOGPAR_ISDI __OSI_LOGPAR_X4(I, S, D, I)
+#define OSI_LOGPAR_ISDD __OSI_LOGPAR_X4(I, S, D, D)
+#define OSI_LOGPAR_ISDF __OSI_LOGPAR_X4(I, S, D, F)
+#define OSI_LOGPAR_ISDS __OSI_LOGPAR_X4(I, S, D, S)
+#define OSI_LOGPAR_ISDM __OSI_LOGPAR_X4(I, S, D, M)
+#define OSI_LOGPAR_ISF __OSI_LOGPAR_X3(I, S, F)
+#define OSI_LOGPAR_ISFI __OSI_LOGPAR_X4(I, S, F, I)
+#define OSI_LOGPAR_ISFD __OSI_LOGPAR_X4(I, S, F, D)
+#define OSI_LOGPAR_ISFF __OSI_LOGPAR_X4(I, S, F, F)
+#define OSI_LOGPAR_ISFS __OSI_LOGPAR_X4(I, S, F, S)
+#define OSI_LOGPAR_ISFM __OSI_LOGPAR_X4(I, S, F, M)
+#define OSI_LOGPAR_ISS __OSI_LOGPAR_X3(I, S, S)
+#define OSI_LOGPAR_ISSI __OSI_LOGPAR_X4(I, S, S, I)
+#define OSI_LOGPAR_ISSD __OSI_LOGPAR_X4(I, S, S, D)
+#define OSI_LOGPAR_ISSF __OSI_LOGPAR_X4(I, S, S, F)
+#define OSI_LOGPAR_ISSS __OSI_LOGPAR_X4(I, S, S, S)
+#define OSI_LOGPAR_ISSM __OSI_LOGPAR_X4(I, S, S, M)
+#define OSI_LOGPAR_ISM __OSI_LOGPAR_X3(I, S, M)
+#define OSI_LOGPAR_ISMI __OSI_LOGPAR_X4(I, S, M, I)
+#define OSI_LOGPAR_ISMD __OSI_LOGPAR_X4(I, S, M, D)
+#define OSI_LOGPAR_ISMF __OSI_LOGPAR_X4(I, S, M, F)
+#define OSI_LOGPAR_ISMS __OSI_LOGPAR_X4(I, S, M, S)
+#define OSI_LOGPAR_ISMM __OSI_LOGPAR_X4(I, S, M, M)
+#define OSI_LOGPAR_IM __OSI_LOGPAR_X2(I, M)
+#define OSI_LOGPAR_IMI __OSI_LOGPAR_X3(I, M, I)
+#define OSI_LOGPAR_IMII __OSI_LOGPAR_X4(I, M, I, I)
+#define OSI_LOGPAR_IMID __OSI_LOGPAR_X4(I, M, I, D)
+#define OSI_LOGPAR_IMIF __OSI_LOGPAR_X4(I, M, I, F)
+#define OSI_LOGPAR_IMIS __OSI_LOGPAR_X4(I, M, I, S)
+#define OSI_LOGPAR_IMIM __OSI_LOGPAR_X4(I, M, I, M)
+#define OSI_LOGPAR_IMD __OSI_LOGPAR_X3(I, M, D)
+#define OSI_LOGPAR_IMDI __OSI_LOGPAR_X4(I, M, D, I)
+#define OSI_LOGPAR_IMDD __OSI_LOGPAR_X4(I, M, D, D)
+#define OSI_LOGPAR_IMDF __OSI_LOGPAR_X4(I, M, D, F)
+#define OSI_LOGPAR_IMDS __OSI_LOGPAR_X4(I, M, D, S)
+#define OSI_LOGPAR_IMDM __OSI_LOGPAR_X4(I, M, D, M)
+#define OSI_LOGPAR_IMF __OSI_LOGPAR_X3(I, M, F)
+#define OSI_LOGPAR_IMFI __OSI_LOGPAR_X4(I, M, F, I)
+#define OSI_LOGPAR_IMFD __OSI_LOGPAR_X4(I, M, F, D)
+#define OSI_LOGPAR_IMFF __OSI_LOGPAR_X4(I, M, F, F)
+#define OSI_LOGPAR_IMFS __OSI_LOGPAR_X4(I, M, F, S)
+#define OSI_LOGPAR_IMFM __OSI_LOGPAR_X4(I, M, F, M)
+#define OSI_LOGPAR_IMS __OSI_LOGPAR_X3(I, M, S)
+#define OSI_LOGPAR_IMSI __OSI_LOGPAR_X4(I, M, S, I)
+#define OSI_LOGPAR_IMSD __OSI_LOGPAR_X4(I, M, S, D)
+#define OSI_LOGPAR_IMSF __OSI_LOGPAR_X4(I, M, S, F)
+#define OSI_LOGPAR_IMSS __OSI_LOGPAR_X4(I, M, S, S)
+#define OSI_LOGPAR_IMSM __OSI_LOGPAR_X4(I, M, S, M)
+#define OSI_LOGPAR_IMM __OSI_LOGPAR_X3(I, M, M)
+#define OSI_LOGPAR_IMMI __OSI_LOGPAR_X4(I, M, M, I)
+#define OSI_LOGPAR_IMMD __OSI_LOGPAR_X4(I, M, M, D)
+#define OSI_LOGPAR_IMMF __OSI_LOGPAR_X4(I, M, M, F)
+#define OSI_LOGPAR_IMMS __OSI_LOGPAR_X4(I, M, M, S)
+#define OSI_LOGPAR_IMMM __OSI_LOGPAR_X4(I, M, M, M)
+#define OSI_LOGPAR_D __OSI_LOGPAR_X1(D)
+#define OSI_LOGPAR_DI __OSI_LOGPAR_X2(D, I)
+#define OSI_LOGPAR_DII __OSI_LOGPAR_X3(D, I, I)
+#define OSI_LOGPAR_DIII __OSI_LOGPAR_X4(D, I, I, I)
+#define OSI_LOGPAR_DIID __OSI_LOGPAR_X4(D, I, I, D)
+#define OSI_LOGPAR_DIIF __OSI_LOGPAR_X4(D, I, I, F)
+#define OSI_LOGPAR_DIIS __OSI_LOGPAR_X4(D, I, I, S)
+#define OSI_LOGPAR_DIIM __OSI_LOGPAR_X4(D, I, I, M)
+#define OSI_LOGPAR_DID __OSI_LOGPAR_X3(D, I, D)
+#define OSI_LOGPAR_DIDI __OSI_LOGPAR_X4(D, I, D, I)
+#define OSI_LOGPAR_DIDD __OSI_LOGPAR_X4(D, I, D, D)
+#define OSI_LOGPAR_DIDF __OSI_LOGPAR_X4(D, I, D, F)
+#define OSI_LOGPAR_DIDS __OSI_LOGPAR_X4(D, I, D, S)
+#define OSI_LOGPAR_DIDM __OSI_LOGPAR_X4(D, I, D, M)
+#define OSI_LOGPAR_DIF __OSI_LOGPAR_X3(D, I, F)
+#define OSI_LOGPAR_DIFI __OSI_LOGPAR_X4(D, I, F, I)
+#define OSI_LOGPAR_DIFD __OSI_LOGPAR_X4(D, I, F, D)
+#define OSI_LOGPAR_DIFF __OSI_LOGPAR_X4(D, I, F, F)
+#define OSI_LOGPAR_DIFS __OSI_LOGPAR_X4(D, I, F, S)
+#define OSI_LOGPAR_DIFM __OSI_LOGPAR_X4(D, I, F, M)
+#define OSI_LOGPAR_DIS __OSI_LOGPAR_X3(D, I, S)
+#define OSI_LOGPAR_DISI __OSI_LOGPAR_X4(D, I, S, I)
+#define OSI_LOGPAR_DISD __OSI_LOGPAR_X4(D, I, S, D)
+#define OSI_LOGPAR_DISF __OSI_LOGPAR_X4(D, I, S, F)
+#define OSI_LOGPAR_DISS __OSI_LOGPAR_X4(D, I, S, S)
+#define OSI_LOGPAR_DISM __OSI_LOGPAR_X4(D, I, S, M)
+#define OSI_LOGPAR_DIM __OSI_LOGPAR_X3(D, I, M)
+#define OSI_LOGPAR_DIMI __OSI_LOGPAR_X4(D, I, M, I)
+#define OSI_LOGPAR_DIMD __OSI_LOGPAR_X4(D, I, M, D)
+#define OSI_LOGPAR_DIMF __OSI_LOGPAR_X4(D, I, M, F)
+#define OSI_LOGPAR_DIMS __OSI_LOGPAR_X4(D, I, M, S)
+#define OSI_LOGPAR_DIMM __OSI_LOGPAR_X4(D, I, M, M)
+#define OSI_LOGPAR_DD __OSI_LOGPAR_X2(D, D)
+#define OSI_LOGPAR_DDI __OSI_LOGPAR_X3(D, D, I)
+#define OSI_LOGPAR_DDII __OSI_LOGPAR_X4(D, D, I, I)
+#define OSI_LOGPAR_DDID __OSI_LOGPAR_X4(D, D, I, D)
+#define OSI_LOGPAR_DDIF __OSI_LOGPAR_X4(D, D, I, F)
+#define OSI_LOGPAR_DDIS __OSI_LOGPAR_X4(D, D, I, S)
+#define OSI_LOGPAR_DDIM __OSI_LOGPAR_X4(D, D, I, M)
+#define OSI_LOGPAR_DDD __OSI_LOGPAR_X3(D, D, D)
+#define OSI_LOGPAR_DDDI __OSI_LOGPAR_X4(D, D, D, I)
+#define OSI_LOGPAR_DDDD __OSI_LOGPAR_X4(D, D, D, D)
+#define OSI_LOGPAR_DDDF __OSI_LOGPAR_X4(D, D, D, F)
+#define OSI_LOGPAR_DDDS __OSI_LOGPAR_X4(D, D, D, S)
+#define OSI_LOGPAR_DDDM __OSI_LOGPAR_X4(D, D, D, M)
+#define OSI_LOGPAR_DDF __OSI_LOGPAR_X3(D, D, F)
+#define OSI_LOGPAR_DDFI __OSI_LOGPAR_X4(D, D, F, I)
+#define OSI_LOGPAR_DDFD __OSI_LOGPAR_X4(D, D, F, D)
+#define OSI_LOGPAR_DDFF __OSI_LOGPAR_X4(D, D, F, F)
+#define OSI_LOGPAR_DDFS __OSI_LOGPAR_X4(D, D, F, S)
+#define OSI_LOGPAR_DDFM __OSI_LOGPAR_X4(D, D, F, M)
+#define OSI_LOGPAR_DDS __OSI_LOGPAR_X3(D, D, S)
+#define OSI_LOGPAR_DDSI __OSI_LOGPAR_X4(D, D, S, I)
+#define OSI_LOGPAR_DDSD __OSI_LOGPAR_X4(D, D, S, D)
+#define OSI_LOGPAR_DDSF __OSI_LOGPAR_X4(D, D, S, F)
+#define OSI_LOGPAR_DDSS __OSI_LOGPAR_X4(D, D, S, S)
+#define OSI_LOGPAR_DDSM __OSI_LOGPAR_X4(D, D, S, M)
+#define OSI_LOGPAR_DDM __OSI_LOGPAR_X3(D, D, M)
+#define OSI_LOGPAR_DDMI __OSI_LOGPAR_X4(D, D, M, I)
+#define OSI_LOGPAR_DDMD __OSI_LOGPAR_X4(D, D, M, D)
+#define OSI_LOGPAR_DDMF __OSI_LOGPAR_X4(D, D, M, F)
+#define OSI_LOGPAR_DDMS __OSI_LOGPAR_X4(D, D, M, S)
+#define OSI_LOGPAR_DDMM __OSI_LOGPAR_X4(D, D, M, M)
+#define OSI_LOGPAR_DF __OSI_LOGPAR_X2(D, F)
+#define OSI_LOGPAR_DFI __OSI_LOGPAR_X3(D, F, I)
+#define OSI_LOGPAR_DFII __OSI_LOGPAR_X4(D, F, I, I)
+#define OSI_LOGPAR_DFID __OSI_LOGPAR_X4(D, F, I, D)
+#define OSI_LOGPAR_DFIF __OSI_LOGPAR_X4(D, F, I, F)
+#define OSI_LOGPAR_DFIS __OSI_LOGPAR_X4(D, F, I, S)
+#define OSI_LOGPAR_DFIM __OSI_LOGPAR_X4(D, F, I, M)
+#define OSI_LOGPAR_DFD __OSI_LOGPAR_X3(D, F, D)
+#define OSI_LOGPAR_DFDI __OSI_LOGPAR_X4(D, F, D, I)
+#define OSI_LOGPAR_DFDD __OSI_LOGPAR_X4(D, F, D, D)
+#define OSI_LOGPAR_DFDF __OSI_LOGPAR_X4(D, F, D, F)
+#define OSI_LOGPAR_DFDS __OSI_LOGPAR_X4(D, F, D, S)
+#define OSI_LOGPAR_DFDM __OSI_LOGPAR_X4(D, F, D, M)
+#define OSI_LOGPAR_DFF __OSI_LOGPAR_X3(D, F, F)
+#define OSI_LOGPAR_DFFI __OSI_LOGPAR_X4(D, F, F, I)
+#define OSI_LOGPAR_DFFD __OSI_LOGPAR_X4(D, F, F, D)
+#define OSI_LOGPAR_DFFF __OSI_LOGPAR_X4(D, F, F, F)
+#define OSI_LOGPAR_DFFS __OSI_LOGPAR_X4(D, F, F, S)
+#define OSI_LOGPAR_DFFM __OSI_LOGPAR_X4(D, F, F, M)
+#define OSI_LOGPAR_DFS __OSI_LOGPAR_X3(D, F, S)
+#define OSI_LOGPAR_DFSI __OSI_LOGPAR_X4(D, F, S, I)
+#define OSI_LOGPAR_DFSD __OSI_LOGPAR_X4(D, F, S, D)
+#define OSI_LOGPAR_DFSF __OSI_LOGPAR_X4(D, F, S, F)
+#define OSI_LOGPAR_DFSS __OSI_LOGPAR_X4(D, F, S, S)
+#define OSI_LOGPAR_DFSM __OSI_LOGPAR_X4(D, F, S, M)
+#define OSI_LOGPAR_DFM __OSI_LOGPAR_X3(D, F, M)
+#define OSI_LOGPAR_DFMI __OSI_LOGPAR_X4(D, F, M, I)
+#define OSI_LOGPAR_DFMD __OSI_LOGPAR_X4(D, F, M, D)
+#define OSI_LOGPAR_DFMF __OSI_LOGPAR_X4(D, F, M, F)
+#define OSI_LOGPAR_DFMS __OSI_LOGPAR_X4(D, F, M, S)
+#define OSI_LOGPAR_DFMM __OSI_LOGPAR_X4(D, F, M, M)
+#define OSI_LOGPAR_DS __OSI_LOGPAR_X2(D, S)
+#define OSI_LOGPAR_DSI __OSI_LOGPAR_X3(D, S, I)
+#define OSI_LOGPAR_DSII __OSI_LOGPAR_X4(D, S, I, I)
+#define OSI_LOGPAR_DSID __OSI_LOGPAR_X4(D, S, I, D)
+#define OSI_LOGPAR_DSIF __OSI_LOGPAR_X4(D, S, I, F)
+#define OSI_LOGPAR_DSIS __OSI_LOGPAR_X4(D, S, I, S)
+#define OSI_LOGPAR_DSIM __OSI_LOGPAR_X4(D, S, I, M)
+#define OSI_LOGPAR_DSD __OSI_LOGPAR_X3(D, S, D)
+#define OSI_LOGPAR_DSDI __OSI_LOGPAR_X4(D, S, D, I)
+#define OSI_LOGPAR_DSDD __OSI_LOGPAR_X4(D, S, D, D)
+#define OSI_LOGPAR_DSDF __OSI_LOGPAR_X4(D, S, D, F)
+#define OSI_LOGPAR_DSDS __OSI_LOGPAR_X4(D, S, D, S)
+#define OSI_LOGPAR_DSDM __OSI_LOGPAR_X4(D, S, D, M)
+#define OSI_LOGPAR_DSF __OSI_LOGPAR_X3(D, S, F)
+#define OSI_LOGPAR_DSFI __OSI_LOGPAR_X4(D, S, F, I)
+#define OSI_LOGPAR_DSFD __OSI_LOGPAR_X4(D, S, F, D)
+#define OSI_LOGPAR_DSFF __OSI_LOGPAR_X4(D, S, F, F)
+#define OSI_LOGPAR_DSFS __OSI_LOGPAR_X4(D, S, F, S)
+#define OSI_LOGPAR_DSFM __OSI_LOGPAR_X4(D, S, F, M)
+#define OSI_LOGPAR_DSS __OSI_LOGPAR_X3(D, S, S)
+#define OSI_LOGPAR_DSSI __OSI_LOGPAR_X4(D, S, S, I)
+#define OSI_LOGPAR_DSSD __OSI_LOGPAR_X4(D, S, S, D)
+#define OSI_LOGPAR_DSSF __OSI_LOGPAR_X4(D, S, S, F)
+#define OSI_LOGPAR_DSSS __OSI_LOGPAR_X4(D, S, S, S)
+#define OSI_LOGPAR_DSSM __OSI_LOGPAR_X4(D, S, S, M)
+#define OSI_LOGPAR_DSM __OSI_LOGPAR_X3(D, S, M)
+#define OSI_LOGPAR_DSMI __OSI_LOGPAR_X4(D, S, M, I)
+#define OSI_LOGPAR_DSMD __OSI_LOGPAR_X4(D, S, M, D)
+#define OSI_LOGPAR_DSMF __OSI_LOGPAR_X4(D, S, M, F)
+#define OSI_LOGPAR_DSMS __OSI_LOGPAR_X4(D, S, M, S)
+#define OSI_LOGPAR_DSMM __OSI_LOGPAR_X4(D, S, M, M)
+#define OSI_LOGPAR_DM __OSI_LOGPAR_X2(D, M)
+#define OSI_LOGPAR_DMI __OSI_LOGPAR_X3(D, M, I)
+#define OSI_LOGPAR_DMII __OSI_LOGPAR_X4(D, M, I, I)
+#define OSI_LOGPAR_DMID __OSI_LOGPAR_X4(D, M, I, D)
+#define OSI_LOGPAR_DMIF __OSI_LOGPAR_X4(D, M, I, F)
+#define OSI_LOGPAR_DMIS __OSI_LOGPAR_X4(D, M, I, S)
+#define OSI_LOGPAR_DMIM __OSI_LOGPAR_X4(D, M, I, M)
+#define OSI_LOGPAR_DMD __OSI_LOGPAR_X3(D, M, D)
+#define OSI_LOGPAR_DMDI __OSI_LOGPAR_X4(D, M, D, I)
+#define OSI_LOGPAR_DMDD __OSI_LOGPAR_X4(D, M, D, D)
+#define OSI_LOGPAR_DMDF __OSI_LOGPAR_X4(D, M, D, F)
+#define OSI_LOGPAR_DMDS __OSI_LOGPAR_X4(D, M, D, S)
+#define OSI_LOGPAR_DMDM __OSI_LOGPAR_X4(D, M, D, M)
+#define OSI_LOGPAR_DMF __OSI_LOGPAR_X3(D, M, F)
+#define OSI_LOGPAR_DMFI __OSI_LOGPAR_X4(D, M, F, I)
+#define OSI_LOGPAR_DMFD __OSI_LOGPAR_X4(D, M, F, D)
+#define OSI_LOGPAR_DMFF __OSI_LOGPAR_X4(D, M, F, F)
+#define OSI_LOGPAR_DMFS __OSI_LOGPAR_X4(D, M, F, S)
+#define OSI_LOGPAR_DMFM __OSI_LOGPAR_X4(D, M, F, M)
+#define OSI_LOGPAR_DMS __OSI_LOGPAR_X3(D, M, S)
+#define OSI_LOGPAR_DMSI __OSI_LOGPAR_X4(D, M, S, I)
+#define OSI_LOGPAR_DMSD __OSI_LOGPAR_X4(D, M, S, D)
+#define OSI_LOGPAR_DMSF __OSI_LOGPAR_X4(D, M, S, F)
+#define OSI_LOGPAR_DMSS __OSI_LOGPAR_X4(D, M, S, S)
+#define OSI_LOGPAR_DMSM __OSI_LOGPAR_X4(D, M, S, M)
+#define OSI_LOGPAR_DMM __OSI_LOGPAR_X3(D, M, M)
+#define OSI_LOGPAR_DMMI __OSI_LOGPAR_X4(D, M, M, I)
+#define OSI_LOGPAR_DMMD __OSI_LOGPAR_X4(D, M, M, D)
+#define OSI_LOGPAR_DMMF __OSI_LOGPAR_X4(D, M, M, F)
+#define OSI_LOGPAR_DMMS __OSI_LOGPAR_X4(D, M, M, S)
+#define OSI_LOGPAR_DMMM __OSI_LOGPAR_X4(D, M, M, M)
+#define OSI_LOGPAR_F __OSI_LOGPAR_X1(F)
+#define OSI_LOGPAR_FI __OSI_LOGPAR_X2(F, I)
+#define OSI_LOGPAR_FII __OSI_LOGPAR_X3(F, I, I)
+#define OSI_LOGPAR_FIII __OSI_LOGPAR_X4(F, I, I, I)
+#define OSI_LOGPAR_FIID __OSI_LOGPAR_X4(F, I, I, D)
+#define OSI_LOGPAR_FIIF __OSI_LOGPAR_X4(F, I, I, F)
+#define OSI_LOGPAR_FIIS __OSI_LOGPAR_X4(F, I, I, S)
+#define OSI_LOGPAR_FIIM __OSI_LOGPAR_X4(F, I, I, M)
+#define OSI_LOGPAR_FID __OSI_LOGPAR_X3(F, I, D)
+#define OSI_LOGPAR_FIDI __OSI_LOGPAR_X4(F, I, D, I)
+#define OSI_LOGPAR_FIDD __OSI_LOGPAR_X4(F, I, D, D)
+#define OSI_LOGPAR_FIDF __OSI_LOGPAR_X4(F, I, D, F)
+#define OSI_LOGPAR_FIDS __OSI_LOGPAR_X4(F, I, D, S)
+#define OSI_LOGPAR_FIDM __OSI_LOGPAR_X4(F, I, D, M)
+#define OSI_LOGPAR_FIF __OSI_LOGPAR_X3(F, I, F)
+#define OSI_LOGPAR_FIFI __OSI_LOGPAR_X4(F, I, F, I)
+#define OSI_LOGPAR_FIFD __OSI_LOGPAR_X4(F, I, F, D)
+#define OSI_LOGPAR_FIFF __OSI_LOGPAR_X4(F, I, F, F)
+#define OSI_LOGPAR_FIFS __OSI_LOGPAR_X4(F, I, F, S)
+#define OSI_LOGPAR_FIFM __OSI_LOGPAR_X4(F, I, F, M)
+#define OSI_LOGPAR_FIS __OSI_LOGPAR_X3(F, I, S)
+#define OSI_LOGPAR_FISI __OSI_LOGPAR_X4(F, I, S, I)
+#define OSI_LOGPAR_FISD __OSI_LOGPAR_X4(F, I, S, D)
+#define OSI_LOGPAR_FISF __OSI_LOGPAR_X4(F, I, S, F)
+#define OSI_LOGPAR_FISS __OSI_LOGPAR_X4(F, I, S, S)
+#define OSI_LOGPAR_FISM __OSI_LOGPAR_X4(F, I, S, M)
+#define OSI_LOGPAR_FIM __OSI_LOGPAR_X3(F, I, M)
+#define OSI_LOGPAR_FIMI __OSI_LOGPAR_X4(F, I, M, I)
+#define OSI_LOGPAR_FIMD __OSI_LOGPAR_X4(F, I, M, D)
+#define OSI_LOGPAR_FIMF __OSI_LOGPAR_X4(F, I, M, F)
+#define OSI_LOGPAR_FIMS __OSI_LOGPAR_X4(F, I, M, S)
+#define OSI_LOGPAR_FIMM __OSI_LOGPAR_X4(F, I, M, M)
+#define OSI_LOGPAR_FD __OSI_LOGPAR_X2(F, D)
+#define OSI_LOGPAR_FDI __OSI_LOGPAR_X3(F, D, I)
+#define OSI_LOGPAR_FDII __OSI_LOGPAR_X4(F, D, I, I)
+#define OSI_LOGPAR_FDID __OSI_LOGPAR_X4(F, D, I, D)
+#define OSI_LOGPAR_FDIF __OSI_LOGPAR_X4(F, D, I, F)
+#define OSI_LOGPAR_FDIS __OSI_LOGPAR_X4(F, D, I, S)
+#define OSI_LOGPAR_FDIM __OSI_LOGPAR_X4(F, D, I, M)
+#define OSI_LOGPAR_FDD __OSI_LOGPAR_X3(F, D, D)
+#define OSI_LOGPAR_FDDI __OSI_LOGPAR_X4(F, D, D, I)
+#define OSI_LOGPAR_FDDD __OSI_LOGPAR_X4(F, D, D, D)
+#define OSI_LOGPAR_FDDF __OSI_LOGPAR_X4(F, D, D, F)
+#define OSI_LOGPAR_FDDS __OSI_LOGPAR_X4(F, D, D, S)
+#define OSI_LOGPAR_FDDM __OSI_LOGPAR_X4(F, D, D, M)
+#define OSI_LOGPAR_FDF __OSI_LOGPAR_X3(F, D, F)
+#define OSI_LOGPAR_FDFI __OSI_LOGPAR_X4(F, D, F, I)
+#define OSI_LOGPAR_FDFD __OSI_LOGPAR_X4(F, D, F, D)
+#define OSI_LOGPAR_FDFF __OSI_LOGPAR_X4(F, D, F, F)
+#define OSI_LOGPAR_FDFS __OSI_LOGPAR_X4(F, D, F, S)
+#define OSI_LOGPAR_FDFM __OSI_LOGPAR_X4(F, D, F, M)
+#define OSI_LOGPAR_FDS __OSI_LOGPAR_X3(F, D, S)
+#define OSI_LOGPAR_FDSI __OSI_LOGPAR_X4(F, D, S, I)
+#define OSI_LOGPAR_FDSD __OSI_LOGPAR_X4(F, D, S, D)
+#define OSI_LOGPAR_FDSF __OSI_LOGPAR_X4(F, D, S, F)
+#define OSI_LOGPAR_FDSS __OSI_LOGPAR_X4(F, D, S, S)
+#define OSI_LOGPAR_FDSM __OSI_LOGPAR_X4(F, D, S, M)
+#define OSI_LOGPAR_FDM __OSI_LOGPAR_X3(F, D, M)
+#define OSI_LOGPAR_FDMI __OSI_LOGPAR_X4(F, D, M, I)
+#define OSI_LOGPAR_FDMD __OSI_LOGPAR_X4(F, D, M, D)
+#define OSI_LOGPAR_FDMF __OSI_LOGPAR_X4(F, D, M, F)
+#define OSI_LOGPAR_FDMS __OSI_LOGPAR_X4(F, D, M, S)
+#define OSI_LOGPAR_FDMM __OSI_LOGPAR_X4(F, D, M, M)
+#define OSI_LOGPAR_FF __OSI_LOGPAR_X2(F, F)
+#define OSI_LOGPAR_FFI __OSI_LOGPAR_X3(F, F, I)
+#define OSI_LOGPAR_FFII __OSI_LOGPAR_X4(F, F, I, I)
+#define OSI_LOGPAR_FFID __OSI_LOGPAR_X4(F, F, I, D)
+#define OSI_LOGPAR_FFIF __OSI_LOGPAR_X4(F, F, I, F)
+#define OSI_LOGPAR_FFIS __OSI_LOGPAR_X4(F, F, I, S)
+#define OSI_LOGPAR_FFIM __OSI_LOGPAR_X4(F, F, I, M)
+#define OSI_LOGPAR_FFD __OSI_LOGPAR_X3(F, F, D)
+#define OSI_LOGPAR_FFDI __OSI_LOGPAR_X4(F, F, D, I)
+#define OSI_LOGPAR_FFDD __OSI_LOGPAR_X4(F, F, D, D)
+#define OSI_LOGPAR_FFDF __OSI_LOGPAR_X4(F, F, D, F)
+#define OSI_LOGPAR_FFDS __OSI_LOGPAR_X4(F, F, D, S)
+#define OSI_LOGPAR_FFDM __OSI_LOGPAR_X4(F, F, D, M)
+#define OSI_LOGPAR_FFF __OSI_LOGPAR_X3(F, F, F)
+#define OSI_LOGPAR_FFFI __OSI_LOGPAR_X4(F, F, F, I)
+#define OSI_LOGPAR_FFFD __OSI_LOGPAR_X4(F, F, F, D)
+#define OSI_LOGPAR_FFFF __OSI_LOGPAR_X4(F, F, F, F)
+#define OSI_LOGPAR_FFFS __OSI_LOGPAR_X4(F, F, F, S)
+#define OSI_LOGPAR_FFFM __OSI_LOGPAR_X4(F, F, F, M)
+#define OSI_LOGPAR_FFS __OSI_LOGPAR_X3(F, F, S)
+#define OSI_LOGPAR_FFSI __OSI_LOGPAR_X4(F, F, S, I)
+#define OSI_LOGPAR_FFSD __OSI_LOGPAR_X4(F, F, S, D)
+#define OSI_LOGPAR_FFSF __OSI_LOGPAR_X4(F, F, S, F)
+#define OSI_LOGPAR_FFSS __OSI_LOGPAR_X4(F, F, S, S)
+#define OSI_LOGPAR_FFSM __OSI_LOGPAR_X4(F, F, S, M)
+#define OSI_LOGPAR_FFM __OSI_LOGPAR_X3(F, F, M)
+#define OSI_LOGPAR_FFMI __OSI_LOGPAR_X4(F, F, M, I)
+#define OSI_LOGPAR_FFMD __OSI_LOGPAR_X4(F, F, M, D)
+#define OSI_LOGPAR_FFMF __OSI_LOGPAR_X4(F, F, M, F)
+#define OSI_LOGPAR_FFMS __OSI_LOGPAR_X4(F, F, M, S)
+#define OSI_LOGPAR_FFMM __OSI_LOGPAR_X4(F, F, M, M)
+#define OSI_LOGPAR_FS __OSI_LOGPAR_X2(F, S)
+#define OSI_LOGPAR_FSI __OSI_LOGPAR_X3(F, S, I)
+#define OSI_LOGPAR_FSII __OSI_LOGPAR_X4(F, S, I, I)
+#define OSI_LOGPAR_FSID __OSI_LOGPAR_X4(F, S, I, D)
+#define OSI_LOGPAR_FSIF __OSI_LOGPAR_X4(F, S, I, F)
+#define OSI_LOGPAR_FSIS __OSI_LOGPAR_X4(F, S, I, S)
+#define OSI_LOGPAR_FSIM __OSI_LOGPAR_X4(F, S, I, M)
+#define OSI_LOGPAR_FSD __OSI_LOGPAR_X3(F, S, D)
+#define OSI_LOGPAR_FSDI __OSI_LOGPAR_X4(F, S, D, I)
+#define OSI_LOGPAR_FSDD __OSI_LOGPAR_X4(F, S, D, D)
+#define OSI_LOGPAR_FSDF __OSI_LOGPAR_X4(F, S, D, F)
+#define OSI_LOGPAR_FSDS __OSI_LOGPAR_X4(F, S, D, S)
+#define OSI_LOGPAR_FSDM __OSI_LOGPAR_X4(F, S, D, M)
+#define OSI_LOGPAR_FSF __OSI_LOGPAR_X3(F, S, F)
+#define OSI_LOGPAR_FSFI __OSI_LOGPAR_X4(F, S, F, I)
+#define OSI_LOGPAR_FSFD __OSI_LOGPAR_X4(F, S, F, D)
+#define OSI_LOGPAR_FSFF __OSI_LOGPAR_X4(F, S, F, F)
+#define OSI_LOGPAR_FSFS __OSI_LOGPAR_X4(F, S, F, S)
+#define OSI_LOGPAR_FSFM __OSI_LOGPAR_X4(F, S, F, M)
+#define OSI_LOGPAR_FSS __OSI_LOGPAR_X3(F, S, S)
+#define OSI_LOGPAR_FSSI __OSI_LOGPAR_X4(F, S, S, I)
+#define OSI_LOGPAR_FSSD __OSI_LOGPAR_X4(F, S, S, D)
+#define OSI_LOGPAR_FSSF __OSI_LOGPAR_X4(F, S, S, F)
+#define OSI_LOGPAR_FSSS __OSI_LOGPAR_X4(F, S, S, S)
+#define OSI_LOGPAR_FSSM __OSI_LOGPAR_X4(F, S, S, M)
+#define OSI_LOGPAR_FSM __OSI_LOGPAR_X3(F, S, M)
+#define OSI_LOGPAR_FSMI __OSI_LOGPAR_X4(F, S, M, I)
+#define OSI_LOGPAR_FSMD __OSI_LOGPAR_X4(F, S, M, D)
+#define OSI_LOGPAR_FSMF __OSI_LOGPAR_X4(F, S, M, F)
+#define OSI_LOGPAR_FSMS __OSI_LOGPAR_X4(F, S, M, S)
+#define OSI_LOGPAR_FSMM __OSI_LOGPAR_X4(F, S, M, M)
+#define OSI_LOGPAR_FM __OSI_LOGPAR_X2(F, M)
+#define OSI_LOGPAR_FMI __OSI_LOGPAR_X3(F, M, I)
+#define OSI_LOGPAR_FMII __OSI_LOGPAR_X4(F, M, I, I)
+#define OSI_LOGPAR_FMID __OSI_LOGPAR_X4(F, M, I, D)
+#define OSI_LOGPAR_FMIF __OSI_LOGPAR_X4(F, M, I, F)
+#define OSI_LOGPAR_FMIS __OSI_LOGPAR_X4(F, M, I, S)
+#define OSI_LOGPAR_FMIM __OSI_LOGPAR_X4(F, M, I, M)
+#define OSI_LOGPAR_FMD __OSI_LOGPAR_X3(F, M, D)
+#define OSI_LOGPAR_FMDI __OSI_LOGPAR_X4(F, M, D, I)
+#define OSI_LOGPAR_FMDD __OSI_LOGPAR_X4(F, M, D, D)
+#define OSI_LOGPAR_FMDF __OSI_LOGPAR_X4(F, M, D, F)
+#define OSI_LOGPAR_FMDS __OSI_LOGPAR_X4(F, M, D, S)
+#define OSI_LOGPAR_FMDM __OSI_LOGPAR_X4(F, M, D, M)
+#define OSI_LOGPAR_FMF __OSI_LOGPAR_X3(F, M, F)
+#define OSI_LOGPAR_FMFI __OSI_LOGPAR_X4(F, M, F, I)
+#define OSI_LOGPAR_FMFD __OSI_LOGPAR_X4(F, M, F, D)
+#define OSI_LOGPAR_FMFF __OSI_LOGPAR_X4(F, M, F, F)
+#define OSI_LOGPAR_FMFS __OSI_LOGPAR_X4(F, M, F, S)
+#define OSI_LOGPAR_FMFM __OSI_LOGPAR_X4(F, M, F, M)
+#define OSI_LOGPAR_FMS __OSI_LOGPAR_X3(F, M, S)
+#define OSI_LOGPAR_FMSI __OSI_LOGPAR_X4(F, M, S, I)
+#define OSI_LOGPAR_FMSD __OSI_LOGPAR_X4(F, M, S, D)
+#define OSI_LOGPAR_FMSF __OSI_LOGPAR_X4(F, M, S, F)
+#define OSI_LOGPAR_FMSS __OSI_LOGPAR_X4(F, M, S, S)
+#define OSI_LOGPAR_FMSM __OSI_LOGPAR_X4(F, M, S, M)
+#define OSI_LOGPAR_FMM __OSI_LOGPAR_X3(F, M, M)
+#define OSI_LOGPAR_FMMI __OSI_LOGPAR_X4(F, M, M, I)
+#define OSI_LOGPAR_FMMD __OSI_LOGPAR_X4(F, M, M, D)
+#define OSI_LOGPAR_FMMF __OSI_LOGPAR_X4(F, M, M, F)
+#define OSI_LOGPAR_FMMS __OSI_LOGPAR_X4(F, M, M, S)
+#define OSI_LOGPAR_FMMM __OSI_LOGPAR_X4(F, M, M, M)
+#define OSI_LOGPAR_S __OSI_LOGPAR_X1(S)
+#define OSI_LOGPAR_SI __OSI_LOGPAR_X2(S, I)
+#define OSI_LOGPAR_SII __OSI_LOGPAR_X3(S, I, I)
+#define OSI_LOGPAR_SIII __OSI_LOGPAR_X4(S, I, I, I)
+#define OSI_LOGPAR_SIID __OSI_LOGPAR_X4(S, I, I, D)
+#define OSI_LOGPAR_SIIF __OSI_LOGPAR_X4(S, I, I, F)
+#define OSI_LOGPAR_SIIS __OSI_LOGPAR_X4(S, I, I, S)
+#define OSI_LOGPAR_SIIM __OSI_LOGPAR_X4(S, I, I, M)
+#define OSI_LOGPAR_SID __OSI_LOGPAR_X3(S, I, D)
+#define OSI_LOGPAR_SIDI __OSI_LOGPAR_X4(S, I, D, I)
+#define OSI_LOGPAR_SIDD __OSI_LOGPAR_X4(S, I, D, D)
+#define OSI_LOGPAR_SIDF __OSI_LOGPAR_X4(S, I, D, F)
+#define OSI_LOGPAR_SIDS __OSI_LOGPAR_X4(S, I, D, S)
+#define OSI_LOGPAR_SIDM __OSI_LOGPAR_X4(S, I, D, M)
+#define OSI_LOGPAR_SIF __OSI_LOGPAR_X3(S, I, F)
+#define OSI_LOGPAR_SIFI __OSI_LOGPAR_X4(S, I, F, I)
+#define OSI_LOGPAR_SIFD __OSI_LOGPAR_X4(S, I, F, D)
+#define OSI_LOGPAR_SIFF __OSI_LOGPAR_X4(S, I, F, F)
+#define OSI_LOGPAR_SIFS __OSI_LOGPAR_X4(S, I, F, S)
+#define OSI_LOGPAR_SIFM __OSI_LOGPAR_X4(S, I, F, M)
+#define OSI_LOGPAR_SIS __OSI_LOGPAR_X3(S, I, S)
+#define OSI_LOGPAR_SISI __OSI_LOGPAR_X4(S, I, S, I)
+#define OSI_LOGPAR_SISD __OSI_LOGPAR_X4(S, I, S, D)
+#define OSI_LOGPAR_SISF __OSI_LOGPAR_X4(S, I, S, F)
+#define OSI_LOGPAR_SISS __OSI_LOGPAR_X4(S, I, S, S)
+#define OSI_LOGPAR_SISM __OSI_LOGPAR_X4(S, I, S, M)
+#define OSI_LOGPAR_SIM __OSI_LOGPAR_X3(S, I, M)
+#define OSI_LOGPAR_SIMI __OSI_LOGPAR_X4(S, I, M, I)
+#define OSI_LOGPAR_SIMD __OSI_LOGPAR_X4(S, I, M, D)
+#define OSI_LOGPAR_SIMF __OSI_LOGPAR_X4(S, I, M, F)
+#define OSI_LOGPAR_SIMS __OSI_LOGPAR_X4(S, I, M, S)
+#define OSI_LOGPAR_SIMM __OSI_LOGPAR_X4(S, I, M, M)
+#define OSI_LOGPAR_SD __OSI_LOGPAR_X2(S, D)
+#define OSI_LOGPAR_SDI __OSI_LOGPAR_X3(S, D, I)
+#define OSI_LOGPAR_SDII __OSI_LOGPAR_X4(S, D, I, I)
+#define OSI_LOGPAR_SDID __OSI_LOGPAR_X4(S, D, I, D)
+#define OSI_LOGPAR_SDIF __OSI_LOGPAR_X4(S, D, I, F)
+#define OSI_LOGPAR_SDIS __OSI_LOGPAR_X4(S, D, I, S)
+#define OSI_LOGPAR_SDIM __OSI_LOGPAR_X4(S, D, I, M)
+#define OSI_LOGPAR_SDD __OSI_LOGPAR_X3(S, D, D)
+#define OSI_LOGPAR_SDDI __OSI_LOGPAR_X4(S, D, D, I)
+#define OSI_LOGPAR_SDDD __OSI_LOGPAR_X4(S, D, D, D)
+#define OSI_LOGPAR_SDDF __OSI_LOGPAR_X4(S, D, D, F)
+#define OSI_LOGPAR_SDDS __OSI_LOGPAR_X4(S, D, D, S)
+#define OSI_LOGPAR_SDDM __OSI_LOGPAR_X4(S, D, D, M)
+#define OSI_LOGPAR_SDF __OSI_LOGPAR_X3(S, D, F)
+#define OSI_LOGPAR_SDFI __OSI_LOGPAR_X4(S, D, F, I)
+#define OSI_LOGPAR_SDFD __OSI_LOGPAR_X4(S, D, F, D)
+#define OSI_LOGPAR_SDFF __OSI_LOGPAR_X4(S, D, F, F)
+#define OSI_LOGPAR_SDFS __OSI_LOGPAR_X4(S, D, F, S)
+#define OSI_LOGPAR_SDFM __OSI_LOGPAR_X4(S, D, F, M)
+#define OSI_LOGPAR_SDS __OSI_LOGPAR_X3(S, D, S)
+#define OSI_LOGPAR_SDSI __OSI_LOGPAR_X4(S, D, S, I)
+#define OSI_LOGPAR_SDSD __OSI_LOGPAR_X4(S, D, S, D)
+#define OSI_LOGPAR_SDSF __OSI_LOGPAR_X4(S, D, S, F)
+#define OSI_LOGPAR_SDSS __OSI_LOGPAR_X4(S, D, S, S)
+#define OSI_LOGPAR_SDSM __OSI_LOGPAR_X4(S, D, S, M)
+#define OSI_LOGPAR_SDM __OSI_LOGPAR_X3(S, D, M)
+#define OSI_LOGPAR_SDMI __OSI_LOGPAR_X4(S, D, M, I)
+#define OSI_LOGPAR_SDMD __OSI_LOGPAR_X4(S, D, M, D)
+#define OSI_LOGPAR_SDMF __OSI_LOGPAR_X4(S, D, M, F)
+#define OSI_LOGPAR_SDMS __OSI_LOGPAR_X4(S, D, M, S)
+#define OSI_LOGPAR_SDMM __OSI_LOGPAR_X4(S, D, M, M)
+#define OSI_LOGPAR_SF __OSI_LOGPAR_X2(S, F)
+#define OSI_LOGPAR_SFI __OSI_LOGPAR_X3(S, F, I)
+#define OSI_LOGPAR_SFII __OSI_LOGPAR_X4(S, F, I, I)
+#define OSI_LOGPAR_SFID __OSI_LOGPAR_X4(S, F, I, D)
+#define OSI_LOGPAR_SFIF __OSI_LOGPAR_X4(S, F, I, F)
+#define OSI_LOGPAR_SFIS __OSI_LOGPAR_X4(S, F, I, S)
+#define OSI_LOGPAR_SFIM __OSI_LOGPAR_X4(S, F, I, M)
+#define OSI_LOGPAR_SFD __OSI_LOGPAR_X3(S, F, D)
+#define OSI_LOGPAR_SFDI __OSI_LOGPAR_X4(S, F, D, I)
+#define OSI_LOGPAR_SFDD __OSI_LOGPAR_X4(S, F, D, D)
+#define OSI_LOGPAR_SFDF __OSI_LOGPAR_X4(S, F, D, F)
+#define OSI_LOGPAR_SFDS __OSI_LOGPAR_X4(S, F, D, S)
+#define OSI_LOGPAR_SFDM __OSI_LOGPAR_X4(S, F, D, M)
+#define OSI_LOGPAR_SFF __OSI_LOGPAR_X3(S, F, F)
+#define OSI_LOGPAR_SFFI __OSI_LOGPAR_X4(S, F, F, I)
+#define OSI_LOGPAR_SFFD __OSI_LOGPAR_X4(S, F, F, D)
+#define OSI_LOGPAR_SFFF __OSI_LOGPAR_X4(S, F, F, F)
+#define OSI_LOGPAR_SFFS __OSI_LOGPAR_X4(S, F, F, S)
+#define OSI_LOGPAR_SFFM __OSI_LOGPAR_X4(S, F, F, M)
+#define OSI_LOGPAR_SFS __OSI_LOGPAR_X3(S, F, S)
+#define OSI_LOGPAR_SFSI __OSI_LOGPAR_X4(S, F, S, I)
+#define OSI_LOGPAR_SFSD __OSI_LOGPAR_X4(S, F, S, D)
+#define OSI_LOGPAR_SFSF __OSI_LOGPAR_X4(S, F, S, F)
+#define OSI_LOGPAR_SFSS __OSI_LOGPAR_X4(S, F, S, S)
+#define OSI_LOGPAR_SFSM __OSI_LOGPAR_X4(S, F, S, M)
+#define OSI_LOGPAR_SFM __OSI_LOGPAR_X3(S, F, M)
+#define OSI_LOGPAR_SFMI __OSI_LOGPAR_X4(S, F, M, I)
+#define OSI_LOGPAR_SFMD __OSI_LOGPAR_X4(S, F, M, D)
+#define OSI_LOGPAR_SFMF __OSI_LOGPAR_X4(S, F, M, F)
+#define OSI_LOGPAR_SFMS __OSI_LOGPAR_X4(S, F, M, S)
+#define OSI_LOGPAR_SFMM __OSI_LOGPAR_X4(S, F, M, M)
+#define OSI_LOGPAR_SS __OSI_LOGPAR_X2(S, S)
+#define OSI_LOGPAR_SSI __OSI_LOGPAR_X3(S, S, I)
+#define OSI_LOGPAR_SSII __OSI_LOGPAR_X4(S, S, I, I)
+#define OSI_LOGPAR_SSID __OSI_LOGPAR_X4(S, S, I, D)
+#define OSI_LOGPAR_SSIF __OSI_LOGPAR_X4(S, S, I, F)
+#define OSI_LOGPAR_SSIS __OSI_LOGPAR_X4(S, S, I, S)
+#define OSI_LOGPAR_SSIM __OSI_LOGPAR_X4(S, S, I, M)
+#define OSI_LOGPAR_SSD __OSI_LOGPAR_X3(S, S, D)
+#define OSI_LOGPAR_SSDI __OSI_LOGPAR_X4(S, S, D, I)
+#define OSI_LOGPAR_SSDD __OSI_LOGPAR_X4(S, S, D, D)
+#define OSI_LOGPAR_SSDF __OSI_LOGPAR_X4(S, S, D, F)
+#define OSI_LOGPAR_SSDS __OSI_LOGPAR_X4(S, S, D, S)
+#define OSI_LOGPAR_SSDM __OSI_LOGPAR_X4(S, S, D, M)
+#define OSI_LOGPAR_SSF __OSI_LOGPAR_X3(S, S, F)
+#define OSI_LOGPAR_SSFI __OSI_LOGPAR_X4(S, S, F, I)
+#define OSI_LOGPAR_SSFD __OSI_LOGPAR_X4(S, S, F, D)
+#define OSI_LOGPAR_SSFF __OSI_LOGPAR_X4(S, S, F, F)
+#define OSI_LOGPAR_SSFS __OSI_LOGPAR_X4(S, S, F, S)
+#define OSI_LOGPAR_SSFM __OSI_LOGPAR_X4(S, S, F, M)
+#define OSI_LOGPAR_SSS __OSI_LOGPAR_X3(S, S, S)
+#define OSI_LOGPAR_SSSI __OSI_LOGPAR_X4(S, S, S, I)
+#define OSI_LOGPAR_SSSD __OSI_LOGPAR_X4(S, S, S, D)
+#define OSI_LOGPAR_SSSF __OSI_LOGPAR_X4(S, S, S, F)
+#define OSI_LOGPAR_SSSS __OSI_LOGPAR_X4(S, S, S, S)
+#define OSI_LOGPAR_SSSM __OSI_LOGPAR_X4(S, S, S, M)
+#define OSI_LOGPAR_SSM __OSI_LOGPAR_X3(S, S, M)
+#define OSI_LOGPAR_SSMI __OSI_LOGPAR_X4(S, S, M, I)
+#define OSI_LOGPAR_SSMD __OSI_LOGPAR_X4(S, S, M, D)
+#define OSI_LOGPAR_SSMF __OSI_LOGPAR_X4(S, S, M, F)
+#define OSI_LOGPAR_SSMS __OSI_LOGPAR_X4(S, S, M, S)
+#define OSI_LOGPAR_SSMM __OSI_LOGPAR_X4(S, S, M, M)
+#define OSI_LOGPAR_SM __OSI_LOGPAR_X2(S, M)
+#define OSI_LOGPAR_SMI __OSI_LOGPAR_X3(S, M, I)
+#define OSI_LOGPAR_SMII __OSI_LOGPAR_X4(S, M, I, I)
+#define OSI_LOGPAR_SMID __OSI_LOGPAR_X4(S, M, I, D)
+#define OSI_LOGPAR_SMIF __OSI_LOGPAR_X4(S, M, I, F)
+#define OSI_LOGPAR_SMIS __OSI_LOGPAR_X4(S, M, I, S)
+#define OSI_LOGPAR_SMIM __OSI_LOGPAR_X4(S, M, I, M)
+#define OSI_LOGPAR_SMD __OSI_LOGPAR_X3(S, M, D)
+#define OSI_LOGPAR_SMDI __OSI_LOGPAR_X4(S, M, D, I)
+#define OSI_LOGPAR_SMDD __OSI_LOGPAR_X4(S, M, D, D)
+#define OSI_LOGPAR_SMDF __OSI_LOGPAR_X4(S, M, D, F)
+#define OSI_LOGPAR_SMDS __OSI_LOGPAR_X4(S, M, D, S)
+#define OSI_LOGPAR_SMDM __OSI_LOGPAR_X4(S, M, D, M)
+#define OSI_LOGPAR_SMF __OSI_LOGPAR_X3(S, M, F)
+#define OSI_LOGPAR_SMFI __OSI_LOGPAR_X4(S, M, F, I)
+#define OSI_LOGPAR_SMFD __OSI_LOGPAR_X4(S, M, F, D)
+#define OSI_LOGPAR_SMFF __OSI_LOGPAR_X4(S, M, F, F)
+#define OSI_LOGPAR_SMFS __OSI_LOGPAR_X4(S, M, F, S)
+#define OSI_LOGPAR_SMFM __OSI_LOGPAR_X4(S, M, F, M)
+#define OSI_LOGPAR_SMS __OSI_LOGPAR_X3(S, M, S)
+#define OSI_LOGPAR_SMSI __OSI_LOGPAR_X4(S, M, S, I)
+#define OSI_LOGPAR_SMSD __OSI_LOGPAR_X4(S, M, S, D)
+#define OSI_LOGPAR_SMSF __OSI_LOGPAR_X4(S, M, S, F)
+#define OSI_LOGPAR_SMSS __OSI_LOGPAR_X4(S, M, S, S)
+#define OSI_LOGPAR_SMSM __OSI_LOGPAR_X4(S, M, S, M)
+#define OSI_LOGPAR_SMM __OSI_LOGPAR_X3(S, M, M)
+#define OSI_LOGPAR_SMMI __OSI_LOGPAR_X4(S, M, M, I)
+#define OSI_LOGPAR_SMMD __OSI_LOGPAR_X4(S, M, M, D)
+#define OSI_LOGPAR_SMMF __OSI_LOGPAR_X4(S, M, M, F)
+#define OSI_LOGPAR_SMMS __OSI_LOGPAR_X4(S, M, M, S)
+#define OSI_LOGPAR_SMMM __OSI_LOGPAR_X4(S, M, M, M)
+#define OSI_LOGPAR_M __OSI_LOGPAR_X1(M)
+#define OSI_LOGPAR_MI __OSI_LOGPAR_X2(M, I)
+#define OSI_LOGPAR_MII __OSI_LOGPAR_X3(M, I, I)
+#define OSI_LOGPAR_MIII __OSI_LOGPAR_X4(M, I, I, I)
+#define OSI_LOGPAR_MIID __OSI_LOGPAR_X4(M, I, I, D)
+#define OSI_LOGPAR_MIIF __OSI_LOGPAR_X4(M, I, I, F)
+#define OSI_LOGPAR_MIIS __OSI_LOGPAR_X4(M, I, I, S)
+#define OSI_LOGPAR_MIIM __OSI_LOGPAR_X4(M, I, I, M)
+#define OSI_LOGPAR_MID __OSI_LOGPAR_X3(M, I, D)
+#define OSI_LOGPAR_MIDI __OSI_LOGPAR_X4(M, I, D, I)
+#define OSI_LOGPAR_MIDD __OSI_LOGPAR_X4(M, I, D, D)
+#define OSI_LOGPAR_MIDF __OSI_LOGPAR_X4(M, I, D, F)
+#define OSI_LOGPAR_MIDS __OSI_LOGPAR_X4(M, I, D, S)
+#define OSI_LOGPAR_MIDM __OSI_LOGPAR_X4(M, I, D, M)
+#define OSI_LOGPAR_MIF __OSI_LOGPAR_X3(M, I, F)
+#define OSI_LOGPAR_MIFI __OSI_LOGPAR_X4(M, I, F, I)
+#define OSI_LOGPAR_MIFD __OSI_LOGPAR_X4(M, I, F, D)
+#define OSI_LOGPAR_MIFF __OSI_LOGPAR_X4(M, I, F, F)
+#define OSI_LOGPAR_MIFS __OSI_LOGPAR_X4(M, I, F, S)
+#define OSI_LOGPAR_MIFM __OSI_LOGPAR_X4(M, I, F, M)
+#define OSI_LOGPAR_MIS __OSI_LOGPAR_X3(M, I, S)
+#define OSI_LOGPAR_MISI __OSI_LOGPAR_X4(M, I, S, I)
+#define OSI_LOGPAR_MISD __OSI_LOGPAR_X4(M, I, S, D)
+#define OSI_LOGPAR_MISF __OSI_LOGPAR_X4(M, I, S, F)
+#define OSI_LOGPAR_MISS __OSI_LOGPAR_X4(M, I, S, S)
+#define OSI_LOGPAR_MISM __OSI_LOGPAR_X4(M, I, S, M)
+#define OSI_LOGPAR_MIM __OSI_LOGPAR_X3(M, I, M)
+#define OSI_LOGPAR_MIMI __OSI_LOGPAR_X4(M, I, M, I)
+#define OSI_LOGPAR_MIMD __OSI_LOGPAR_X4(M, I, M, D)
+#define OSI_LOGPAR_MIMF __OSI_LOGPAR_X4(M, I, M, F)
+#define OSI_LOGPAR_MIMS __OSI_LOGPAR_X4(M, I, M, S)
+#define OSI_LOGPAR_MIMM __OSI_LOGPAR_X4(M, I, M, M)
+#define OSI_LOGPAR_MD __OSI_LOGPAR_X2(M, D)
+#define OSI_LOGPAR_MDI __OSI_LOGPAR_X3(M, D, I)
+#define OSI_LOGPAR_MDII __OSI_LOGPAR_X4(M, D, I, I)
+#define OSI_LOGPAR_MDID __OSI_LOGPAR_X4(M, D, I, D)
+#define OSI_LOGPAR_MDIF __OSI_LOGPAR_X4(M, D, I, F)
+#define OSI_LOGPAR_MDIS __OSI_LOGPAR_X4(M, D, I, S)
+#define OSI_LOGPAR_MDIM __OSI_LOGPAR_X4(M, D, I, M)
+#define OSI_LOGPAR_MDD __OSI_LOGPAR_X3(M, D, D)
+#define OSI_LOGPAR_MDDI __OSI_LOGPAR_X4(M, D, D, I)
+#define OSI_LOGPAR_MDDD __OSI_LOGPAR_X4(M, D, D, D)
+#define OSI_LOGPAR_MDDF __OSI_LOGPAR_X4(M, D, D, F)
+#define OSI_LOGPAR_MDDS __OSI_LOGPAR_X4(M, D, D, S)
+#define OSI_LOGPAR_MDDM __OSI_LOGPAR_X4(M, D, D, M)
+#define OSI_LOGPAR_MDF __OSI_LOGPAR_X3(M, D, F)
+#define OSI_LOGPAR_MDFI __OSI_LOGPAR_X4(M, D, F, I)
+#define OSI_LOGPAR_MDFD __OSI_LOGPAR_X4(M, D, F, D)
+#define OSI_LOGPAR_MDFF __OSI_LOGPAR_X4(M, D, F, F)
+#define OSI_LOGPAR_MDFS __OSI_LOGPAR_X4(M, D, F, S)
+#define OSI_LOGPAR_MDFM __OSI_LOGPAR_X4(M, D, F, M)
+#define OSI_LOGPAR_MDS __OSI_LOGPAR_X3(M, D, S)
+#define OSI_LOGPAR_MDSI __OSI_LOGPAR_X4(M, D, S, I)
+#define OSI_LOGPAR_MDSD __OSI_LOGPAR_X4(M, D, S, D)
+#define OSI_LOGPAR_MDSF __OSI_LOGPAR_X4(M, D, S, F)
+#define OSI_LOGPAR_MDSS __OSI_LOGPAR_X4(M, D, S, S)
+#define OSI_LOGPAR_MDSM __OSI_LOGPAR_X4(M, D, S, M)
+#define OSI_LOGPAR_MDM __OSI_LOGPAR_X3(M, D, M)
+#define OSI_LOGPAR_MDMI __OSI_LOGPAR_X4(M, D, M, I)
+#define OSI_LOGPAR_MDMD __OSI_LOGPAR_X4(M, D, M, D)
+#define OSI_LOGPAR_MDMF __OSI_LOGPAR_X4(M, D, M, F)
+#define OSI_LOGPAR_MDMS __OSI_LOGPAR_X4(M, D, M, S)
+#define OSI_LOGPAR_MDMM __OSI_LOGPAR_X4(M, D, M, M)
+#define OSI_LOGPAR_MF __OSI_LOGPAR_X2(M, F)
+#define OSI_LOGPAR_MFI __OSI_LOGPAR_X3(M, F, I)
+#define OSI_LOGPAR_MFII __OSI_LOGPAR_X4(M, F, I, I)
+#define OSI_LOGPAR_MFID __OSI_LOGPAR_X4(M, F, I, D)
+#define OSI_LOGPAR_MFIF __OSI_LOGPAR_X4(M, F, I, F)
+#define OSI_LOGPAR_MFIS __OSI_LOGPAR_X4(M, F, I, S)
+#define OSI_LOGPAR_MFIM __OSI_LOGPAR_X4(M, F, I, M)
+#define OSI_LOGPAR_MFD __OSI_LOGPAR_X3(M, F, D)
+#define OSI_LOGPAR_MFDI __OSI_LOGPAR_X4(M, F, D, I)
+#define OSI_LOGPAR_MFDD __OSI_LOGPAR_X4(M, F, D, D)
+#define OSI_LOGPAR_MFDF __OSI_LOGPAR_X4(M, F, D, F)
+#define OSI_LOGPAR_MFDS __OSI_LOGPAR_X4(M, F, D, S)
+#define OSI_LOGPAR_MFDM __OSI_LOGPAR_X4(M, F, D, M)
+#define OSI_LOGPAR_MFF __OSI_LOGPAR_X3(M, F, F)
+#define OSI_LOGPAR_MFFI __OSI_LOGPAR_X4(M, F, F, I)
+#define OSI_LOGPAR_MFFD __OSI_LOGPAR_X4(M, F, F, D)
+#define OSI_LOGPAR_MFFF __OSI_LOGPAR_X4(M, F, F, F)
+#define OSI_LOGPAR_MFFS __OSI_LOGPAR_X4(M, F, F, S)
+#define OSI_LOGPAR_MFFM __OSI_LOGPAR_X4(M, F, F, M)
+#define OSI_LOGPAR_MFS __OSI_LOGPAR_X3(M, F, S)
+#define OSI_LOGPAR_MFSI __OSI_LOGPAR_X4(M, F, S, I)
+#define OSI_LOGPAR_MFSD __OSI_LOGPAR_X4(M, F, S, D)
+#define OSI_LOGPAR_MFSF __OSI_LOGPAR_X4(M, F, S, F)
+#define OSI_LOGPAR_MFSS __OSI_LOGPAR_X4(M, F, S, S)
+#define OSI_LOGPAR_MFSM __OSI_LOGPAR_X4(M, F, S, M)
+#define OSI_LOGPAR_MFM __OSI_LOGPAR_X3(M, F, M)
+#define OSI_LOGPAR_MFMI __OSI_LOGPAR_X4(M, F, M, I)
+#define OSI_LOGPAR_MFMD __OSI_LOGPAR_X4(M, F, M, D)
+#define OSI_LOGPAR_MFMF __OSI_LOGPAR_X4(M, F, M, F)
+#define OSI_LOGPAR_MFMS __OSI_LOGPAR_X4(M, F, M, S)
+#define OSI_LOGPAR_MFMM __OSI_LOGPAR_X4(M, F, M, M)
+#define OSI_LOGPAR_MS __OSI_LOGPAR_X2(M, S)
+#define OSI_LOGPAR_MSI __OSI_LOGPAR_X3(M, S, I)
+#define OSI_LOGPAR_MSII __OSI_LOGPAR_X4(M, S, I, I)
+#define OSI_LOGPAR_MSID __OSI_LOGPAR_X4(M, S, I, D)
+#define OSI_LOGPAR_MSIF __OSI_LOGPAR_X4(M, S, I, F)
+#define OSI_LOGPAR_MSIS __OSI_LOGPAR_X4(M, S, I, S)
+#define OSI_LOGPAR_MSIM __OSI_LOGPAR_X4(M, S, I, M)
+#define OSI_LOGPAR_MSD __OSI_LOGPAR_X3(M, S, D)
+#define OSI_LOGPAR_MSDI __OSI_LOGPAR_X4(M, S, D, I)
+#define OSI_LOGPAR_MSDD __OSI_LOGPAR_X4(M, S, D, D)
+#define OSI_LOGPAR_MSDF __OSI_LOGPAR_X4(M, S, D, F)
+#define OSI_LOGPAR_MSDS __OSI_LOGPAR_X4(M, S, D, S)
+#define OSI_LOGPAR_MSDM __OSI_LOGPAR_X4(M, S, D, M)
+#define OSI_LOGPAR_MSF __OSI_LOGPAR_X3(M, S, F)
+#define OSI_LOGPAR_MSFI __OSI_LOGPAR_X4(M, S, F, I)
+#define OSI_LOGPAR_MSFD __OSI_LOGPAR_X4(M, S, F, D)
+#define OSI_LOGPAR_MSFF __OSI_LOGPAR_X4(M, S, F, F)
+#define OSI_LOGPAR_MSFS __OSI_LOGPAR_X4(M, S, F, S)
+#define OSI_LOGPAR_MSFM __OSI_LOGPAR_X4(M, S, F, M)
+#define OSI_LOGPAR_MSS __OSI_LOGPAR_X3(M, S, S)
+#define OSI_LOGPAR_MSSI __OSI_LOGPAR_X4(M, S, S, I)
+#define OSI_LOGPAR_MSSD __OSI_LOGPAR_X4(M, S, S, D)
+#define OSI_LOGPAR_MSSF __OSI_LOGPAR_X4(M, S, S, F)
+#define OSI_LOGPAR_MSSS __OSI_LOGPAR_X4(M, S, S, S)
+#define OSI_LOGPAR_MSSM __OSI_LOGPAR_X4(M, S, S, M)
+#define OSI_LOGPAR_MSM __OSI_LOGPAR_X3(M, S, M)
+#define OSI_LOGPAR_MSMI __OSI_LOGPAR_X4(M, S, M, I)
+#define OSI_LOGPAR_MSMD __OSI_LOGPAR_X4(M, S, M, D)
+#define OSI_LOGPAR_MSMF __OSI_LOGPAR_X4(M, S, M, F)
+#define OSI_LOGPAR_MSMS __OSI_LOGPAR_X4(M, S, M, S)
+#define OSI_LOGPAR_MSMM __OSI_LOGPAR_X4(M, S, M, M)
+#define OSI_LOGPAR_MM __OSI_LOGPAR_X2(M, M)
+#define OSI_LOGPAR_MMI __OSI_LOGPAR_X3(M, M, I)
+#define OSI_LOGPAR_MMII __OSI_LOGPAR_X4(M, M, I, I)
+#define OSI_LOGPAR_MMID __OSI_LOGPAR_X4(M, M, I, D)
+#define OSI_LOGPAR_MMIF __OSI_LOGPAR_X4(M, M, I, F)
+#define OSI_LOGPAR_MMIS __OSI_LOGPAR_X4(M, M, I, S)
+#define OSI_LOGPAR_MMIM __OSI_LOGPAR_X4(M, M, I, M)
+#define OSI_LOGPAR_MMD __OSI_LOGPAR_X3(M, M, D)
+#define OSI_LOGPAR_MMDI __OSI_LOGPAR_X4(M, M, D, I)
+#define OSI_LOGPAR_MMDD __OSI_LOGPAR_X4(M, M, D, D)
+#define OSI_LOGPAR_MMDF __OSI_LOGPAR_X4(M, M, D, F)
+#define OSI_LOGPAR_MMDS __OSI_LOGPAR_X4(M, M, D, S)
+#define OSI_LOGPAR_MMDM __OSI_LOGPAR_X4(M, M, D, M)
+#define OSI_LOGPAR_MMF __OSI_LOGPAR_X3(M, M, F)
+#define OSI_LOGPAR_MMFI __OSI_LOGPAR_X4(M, M, F, I)
+#define OSI_LOGPAR_MMFD __OSI_LOGPAR_X4(M, M, F, D)
+#define OSI_LOGPAR_MMFF __OSI_LOGPAR_X4(M, M, F, F)
+#define OSI_LOGPAR_MMFS __OSI_LOGPAR_X4(M, M, F, S)
+#define OSI_LOGPAR_MMFM __OSI_LOGPAR_X4(M, M, F, M)
+#define OSI_LOGPAR_MMS __OSI_LOGPAR_X3(M, M, S)
+#define OSI_LOGPAR_MMSI __OSI_LOGPAR_X4(M, M, S, I)
+#define OSI_LOGPAR_MMSD __OSI_LOGPAR_X4(M, M, S, D)
+#define OSI_LOGPAR_MMSF __OSI_LOGPAR_X4(M, M, S, F)
+#define OSI_LOGPAR_MMSS __OSI_LOGPAR_X4(M, M, S, S)
+#define OSI_LOGPAR_MMSM __OSI_LOGPAR_X4(M, M, S, M)
+#define OSI_LOGPAR_MMM __OSI_LOGPAR_X3(M, M, M)
+#define OSI_LOGPAR_MMMI __OSI_LOGPAR_X4(M, M, M, I)
+#define OSI_LOGPAR_MMMD __OSI_LOGPAR_X4(M, M, M, D)
+#define OSI_LOGPAR_MMMF __OSI_LOGPAR_X4(M, M, M, F)
+#define OSI_LOGPAR_MMMS __OSI_LOGPAR_X4(M, M, M, S)
+#define OSI_LOGPAR_MMMM __OSI_LOGPAR_X4(M, M, M, M)

+ 312 - 0
bsp/air724/sdk/components/include/osi_mem.h

@@ -0,0 +1,312 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef __OSI_MEM_H__
+#define __OSI_MEM_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * opaque data structure for memory pool
+ */
+typedef struct osiMemPool osiMemPool_t;
+
+/**
+ * memory pool information
+ */
+typedef struct
+{
+    void *start;             ///< memory pool start pointer
+    uint32_t size;           ///< memory pool total size
+    uint32_t index;          ///< memory pool internal index
+    uint32_t avail_size;     ///< available size. The actual allocatable size may be less than this
+    uint32_t max_block_size; ///< maximum allocatable block size
+} osiMemPoolStat_t;
+
+/**
+ * initialize a fixed pool
+ *
+ * Initialize and register a fixed size block pool. The pool management data
+ * structure will be located inside the provided memory, Due to alignment
+ * it may exist an offset.
+ *
+ * @note Due to there are management overhead, the available block count is
+ * not `pool_size/block_size`.
+ *
+ * @param ptr   starting pointer of the memory
+ * @param size  memory total size
+ * @param block_size    block size
+ * @return
+ *      - the pool pointer on success
+ *      - NULL on failure
+ */
+osiMemPool_t *osiFixedPoolInit(void *ptr, size_t size, size_t block_size);
+
+/**
+ * initialize a block pool
+ *
+ * Initialize and register a block pool pool. The variadic parameters should
+ * be ended with a zero. Each pair of (size_t count, size_t size) indicates
+ * to create a fixed pool child for the block pool. When allocating from
+ * the block pool, fixed pool children will be checked automatically. It
+ * may be helpful to reduce memory fragmentation.
+ *
+ * The management data structure of block pool and all children will be
+ * located inside the provided memory.
+ *
+ * @note The feature of fixed block pool inside is experimental.
+ *
+ * @param ptr   starting pointer of the memory pool.
+ * @param size  memory pool size
+ * @return
+ *      - the pool pointer on success
+ *      - NULL on failure
+ */
+osiMemPool_t *osiBlockPoolInit(void *ptr, size_t size, ...);
+
+/**
+ * set the default pool
+ *
+ * Default pool will be used by malloc/calloc, and it must be block pool.
+ * The first created block pool will be set to default automatically.
+ * And this API will change default pool.
+ *
+ * When \a pool is NULL or invalid, it will return silently.
+ *
+ * @param pool  pool to be set as default.
+ */
+void osiPoolSetDefault(osiMemPool_t *pool);
+
+/**
+ * allocate from specified pool
+ *
+ * When \a pool is NULL or invalid, or \a size is zero, NULL will be
+ * returned.
+ *
+ * Refer to malloc(3).
+ *
+ * @param pool  the pool
+ * @param size  size to be allocated
+ * @return
+ *      - allocated memory pointer on success
+ *      - NULL at failure
+ */
+void *osiPoolMalloc(osiMemPool_t *pool, size_t size);
+
+/**
+ * allocate from specified pool, which is unlikely to be freed
+ *
+ * Comparing to \a osiPoolMalloc, allocator will try to allocate
+ * from location with less fragmentation impact.
+ *
+ * Usually, it only be called at system initialization. It is a replacement
+ * of global variable (either DATA or BSS).
+ *
+ * @param pool  the pool
+ * @param size  size to be allocated
+ * @return
+ *      - allocated memory pointer on success
+ *      - NULL at failure
+ */
+void *osiPoolMallocUnlikelyFree(osiMemPool_t *pool, size_t size);
+
+/**
+ * allocate from specified pool, and clear to zero
+ *
+ * It is the exact same as `osiPoolMalloc(pool, nmemb*size)` and clear
+ * memory to zero.
+ *
+ * Refer to calloc(3).
+ *
+ * @param pool  the pool.
+ * @param nmemb member count to be allocated.
+ * @param size  size of each member.
+ * @return
+ *      - allocated memory pointer on success
+ *      - NULL at failure
+ */
+void *osiPoolCalloc(osiMemPool_t *pool, size_t nmemb, size_t size);
+
+/**
+ * change size of memory block
+ *
+ * Refer to realloc(3).
+ *
+ * @param pool  the pool.
+ * @param ptr   pointer to be changed.
+ * @param size  changed size.
+ * @return
+ *      - allocated memory pointer on success
+ *      - NULL at failure
+ */
+void *osiPoolRealloc(osiMemPool_t *pool, void *ptr, size_t size);
+
+/**
+ * allocate from specified pool with specified alignment
+ *
+ * The pool must be block pool.
+ *
+ * \a alignment should be power of 2. When \a alignment is less than
+ * default alignment, it will behavior the same as `osiPoolMalloc`.
+ *
+ * Refer to memalign(3).
+ *
+ * @param[in] pool The pool
+ * @param[in] alignment Requested alignment
+ * @param[in] size Size to be allocated
+ * @return
+ *      - allocated memory pointer on success
+ *      - NULL at failure
+ */
+void *osiPoolMemalign(osiMemPool_t *pool, size_t alignment, size_t size);
+
+/**
+ * set memory block caller address
+ *
+ * Caller address is for debug only. And won't affect behavior. All APIs
+ * in this module will set caller automatically. Only for memory management
+ * wrappers, and it is wanted to set caller to the caller of wrapper,
+ * this function may be called.
+ *
+ * @param ptr       pointer of memory block.
+ * @param caller    caller address
+ */
+void osiMemSetCaller(void *ptr, void *caller);
+
+/**
+ * get the allocated size for the pointer
+ *
+ * The size is allocated by memory management. The size may be larger than
+ * the size requested, due to tail padding.
+ *
+ * @param ptr       pointer of memory block
+ * @return
+ *      - allocated memory block size
+ *      - 0 if \p ptr is NULL
+ *      - -1 if \p ptr is invalid
+ */
+int osiMemAllocSize(void *ptr);
+
+/**
+ * increase reference count of the pointer
+ *
+ * When the reference count reach the maximum allowed reference count,
+ * system will panic.
+ *
+ * When \p ptr is NULL, nothing will be done.
+ *
+ * @param ptr       pointer of memory block
+ */
+void osiMemRef(void *ptr);
+
+/**
+ * get reference count of the pointer
+ *
+ * When \p ptr is NULL, 0 will be returned.
+ *
+ * @param ptr       pointer of memory block
+ * @return  reference count of the pointer
+ */
+size_t osiMemRefCount(void *ptr);
+
+/**
+ * decrease reference if the reference count is not 1
+ *
+ * At object oriented design with refrence count, it is not enough to
+ * consider memory reference count only. Rather, it is needed to
+ * consider the object reference count. So, the *delete* function of
+ * object should be:
+ *
+ * \code{.cpp}
+ * void objectDelete(void *object)
+ * {
+ *     if (osiMemUnrefNotLast(object))
+ *         return;
+ *
+ *     objectCleanup(object);
+ *     free(object);
+ * }
+ * \endcode
+ *
+ * When the reference count of the object, which is stored inside memory
+ * management, is not 1, only decrease the reference count. Only when
+ * it is the last reference, the cleanup shall be called.
+ *
+ * When \p ptr is NULL, it will return true, and do nothing. Conceptually,
+ * NULL pointer can be regarded as reference count of 0. So, it is not
+ * the last reference.
+ *
+ * When reference count of \p ptr is greater than 1, the reference count
+ * will be decreased by 1, and it is the same as \p free.
+ *
+ * @param ptr       pointer of memory block
+ * @return
+ *      - true if it is not the last reference, or \p ptr is NULL
+ *      - false if it is the last reference
+ */
+bool osiMemUnrefNotLast(void *ptr);
+
+/**
+ * refer to malloc(3).
+ */
+void *osiMalloc(size_t size);
+
+/**
+ * refer to calloc(3).
+ */
+void *osiCalloc(size_t nmemb, size_t size);
+
+/**
+ * refer to realloc(3).
+ */
+void *osiRealloc(void *ptr, size_t size);
+
+/**
+ * refer to memalign(3).
+ */
+void *osiMemalign(size_t alignment, size_t size);
+
+/**
+ * refer to free(3).
+ */
+void osiFree(void *ptr);
+
+/**
+ * get memory pool information
+ *
+ * \a max_block_size is the maximum allocatable size. \a realloc and
+ * \a memalign will use more extra spaces, they may fail with that size.
+ *
+ * \code{.cpp}
+ * malloc(stat->max_block_size);        // will success
+ * realloc(ptr, stat->max_block_size);  // may fail
+ * memalign(32, stat->max_block_size);  // may fail
+ * \endcode
+ *
+ * @param pool      the memory pool. \a NULL for default memory pool
+ * @param stat      output memory pool information
+ * @return
+ *      - true on success
+ *      - false if there are no memory pool, or \a stat is NULL
+ */
+bool osiMemPoolStat(osiMemPool_t *pool, osiMemPoolStat_t *stat);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

+ 399 - 0
bsp/air724/sdk/components/include/osi_vsmap.h

@@ -0,0 +1,399 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _OSI_VSMAP_H_
+#define _OSI_VSMAP_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include "kernel_config.h"
+#include "osi_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * helper macro for constant map
+ *
+ * For constants by *\#define* or *enum*, the followings can be used:
+ * \code{.cpp}
+ * osiValueStrMap_t array[] = {
+ *     {OSI_VSMAP_CONST_DECL(SOME_MACRO)},
+ *     {OSI_VSMAP_CONST_DECL(SOME_ENUM)},
+ * };
+ * \endcode
+ */
+#define OSI_VSMAP_CONST_DECL(name) name, #name
+
+/**
+ * helper data structure for integer string map
+ */
+typedef struct
+{
+    uint32_t value;  ///< integer value
+    const char *str; ///< string value
+} osiValueStrMap_t;
+
+/**
+ * data structure to define an unsigned integer range
+ */
+typedef struct
+{
+    uint32_t minval; ///< minimal value, inclusive
+    uint32_t maxval; ///< maximum value, inclusive
+} osiUintRange_t;
+
+/**
+ * data structure to define a signed integer range
+ */
+typedef struct
+{
+    int minval; ///< minimal value, inclusive
+    int maxval; ///< maximum value, inclusive
+} osiIntRange_t;
+
+/**
+ * data structure to define a unsigned 64bits integer range
+ */
+typedef struct
+{
+    uint64_t minval; ///< minimal value, inclusive
+    uint64_t maxval; ///< maximum value, inclusive
+} osiUint64Range_t;
+
+/**
+ * data structure to define a signed 64bits integer range
+ */
+typedef struct
+{
+    int64_t minval; ///< minimal value, inclusive
+    int64_t maxval; ///< maximum value, inclusive
+} osiInt64Range_t;
+
+/**
+ * @brief function for comparison
+ *
+ * In bsearch(3) and qsort(3), a comparison function is needed.
+ * When the key for comparing struct is \p uint32_t and it is the
+ * first field, this helper function can be used. For example:
+ *
+ * \code{.cpp}
+ * struct {
+ *     uint32_t id;
+ *     // ......
+ * };
+ * \endcode
+ *
+ * @param key       key to be compared
+ * @param p         value to be compared
+ * @return
+ *      - -1 if key < value, though negative can conform
+ *      - 0 if key == value
+ *      - 1 if key > value, though positive can conform
+ */
+int osiUintIdCompare(const void *key, const void *p);
+
+/**
+ * @brief bsearch in value-string map
+ *
+ * The map must be sorted ascending by \p value.
+ *
+ * When \p value isn't found in the map, \p defval will be returned.
+ *
+ * @param value     value to be searched
+ * @param vs        value-string map array, must be valid and sorted
+ * @param count     value-string map count
+ * @param defval    default string when not found
+ * @return
+ *      - found mapped string
+ *      - \p defval if not found
+ */
+const char *osiVsmapBsearch(uint32_t value, const osiValueStrMap_t *vs, size_t count, const char *defval);
+
+/**
+ * @brief check whether value-string map is sorted
+ *
+ * In \p osiVsmapBsearch, value-string map must be sorted ascending
+ * by \p value. This is to check whether the map is sorted.
+ *
+ * @param vs        value-string map array, must be valid
+ * @param count     value-string map count
+ * @return
+ *      - true if the map is sorted ascending
+ *      - false if not sorted
+ */
+bool osiVsmapIsSorted(const osiValueStrMap_t *vs, size_t count);
+
+/**
+ * @brief customized bsearch in value-string map
+ *
+ * The real data structure of \p vs is not \p osiValueStrMap_t, but it is
+ * started with \p osiValueStrMap_t, with customized size.
+ *
+ * @param value     value to be searched
+ * @param vs        value-string map array, must be valid and sorted
+ * @param count     value-string map count
+ * @param size      real data structure size
+ * @param defval    default string when not found
+ * @return
+ *      - found mapped string
+ *      - \p defval if not found
+ */
+const char *osiVsmapBsearchEx(uint32_t value, const osiValueStrMap_t *vs, size_t count, size_t size, const char *defval);
+
+/**
+ * @brief check whether customized value-string map is sorted
+ *
+ * The real data structure of \p vs is not \p osiValueStrMap_t, but it is
+ * started with \p osiValueStrMap_t, with customized size.
+ *
+ * @param vs        value-string map array, must be valid
+ * @param count     value-string map count
+ * @param size      real data structure size
+ * @return
+ *      - true if the map is sorted ascending
+ *      - false if not sorted
+ */
+bool osiVsmapIsSortedEx(const osiValueStrMap_t *vs, size_t count, size_t size);
+
+/**
+ * @brief find value by string, case insensitive
+ *
+ * The map is ended by NULL of \a str
+ *
+ * @param vsmap     integer/string map
+ * @param str       string value
+ * @return
+ *      - a map item if found
+ *      - NULL if not found
+ */
+const osiValueStrMap_t *osiVsmapFindByIStr(const osiValueStrMap_t *vsmap, const char *str);
+
+/**
+ * @brief find value by string, case sensitive
+ *
+ * The map is ended by NULL of \a str
+ *
+ * @param vsmap     integer/string map
+ * @param str       string value
+ * @return
+ *      - a map item if found
+ *      - NULL if not found
+ */
+const osiValueStrMap_t *osiVsmapFindByStr(const osiValueStrMap_t *vsmap, const char *str);
+
+/**
+ * @brief find string by value
+ *
+ * The map is ended by NULL of \a str
+ *
+ * @param vsmap     integer/string map
+ * @param value     integer value
+ * @return
+ *      - a map item if found
+ *      - NULL if not found
+ */
+const osiValueStrMap_t *osiVsmapFindByVal(const osiValueStrMap_t *vsmap, uint32_t value);
+
+/**
+ * @brief find string by value, with default string
+ *
+ * The map is ended by NULL of \a str. When \p value is not found, \p defval
+ * is returned.
+ *
+ * @param vsmap     integer/string map
+ * @param value     integer value
+ * @param defval    default string at not found
+ * @return  string value
+ */
+const char *osiVsmapFindStr(const osiValueStrMap_t *vsmap, uint32_t value, const char *defval);
+
+/**
+ * @brief find value by string, with default value
+ *
+ * The map is ended by NULL of \a str. When \p str is not found, \p defval
+ * is returned.
+ *
+ * @param vsmap     integer/string map
+ * @param str       string value
+ * @param defval    default integer value at not found
+ * @return
+ *      - a map item if found
+ *      - NULL if not found
+ */
+uint32_t osiVsmalFindVal(const osiValueStrMap_t *vsmap, const char *str, uint32_t defval);
+
+/**
+ * @brief find value by case insensitive string, with default value
+ *
+ * The map is ended by NULL of \a str. When \p str is not found, \p defval
+ * is returned.
+ *
+ * @param vsmap     integer/string map
+ * @param str       string value
+ * @param defval    default integer value at not found
+ * @return
+ *      - a map item if found
+ *      - NULL if not found
+ */
+uint32_t osiVsmalFindIVal(const osiValueStrMap_t *vsmap, const char *str, uint32_t defval);
+
+/**
+ * little helper to check wether an unsigned integer in list
+ *
+ * \param value     value to be checked
+ * \param varlist   value list
+ * \param count     value list count
+ * \return
+ *      - true if value in the list
+ *      - false if value not in the list
+ */
+bool osiIsUintInList(uint32_t value, const uint32_t *varlist, unsigned count);
+
+/**
+ * little helper to check wether an unsigned integer in range
+ *
+ * \param value     value to be checked
+ * \param minval    minimal value, inclusive
+ * \param maxval    maximum value, inclusive
+ * \return
+ *      - true if value in the range
+ *      - false if value not in the range
+ */
+bool osiIsUintInRange(uint32_t value, uint32_t minval, uint32_t maxval);
+
+/**
+ * little helper to check wether an unsigned integer in range list
+ *
+ * \param value     value to be checked
+ * \param ranges    valid range list
+ * \param count     valid range list count
+ * \return
+ *      - true if value in the range list
+ *      - false if value not in the range list
+ */
+bool osiIsUintInRanges(uint32_t value, const osiUintRange_t *ranges, unsigned count);
+
+/**
+ * little helper to check wether a signed integer in list
+ *
+ * \param value     value to be checked
+ * \param varlist   value list
+ * \param count     value list count
+ * \return
+ *      - true if value in the list
+ *      - false if value not in the list
+ */
+bool osiIsIntInList(int value, const int *varlist, unsigned count);
+
+/**
+ * little helper to check wether a signed integer in range
+ *
+ * \param value     value to be checked
+ * \param minval    minimal value, inclusive
+ * \param maxval    maximum value, inclusive
+ * \return
+ *      - true if value in the range
+ *      - false if value not in the range
+ */
+bool osiIsIntInRange(int value, int minval, int maxval);
+
+/**
+ * little helper to check wether a signed integer in range list
+ *
+ * \param value     value to be checked
+ * \param ranges    valid range list
+ * \param count     valid range list count
+ * \return
+ *      - true if value in the range list
+ *      - false if value not in the range list
+ */
+bool osiIsIntInRanges(int value, const osiIntRange_t *ranges, unsigned count);
+
+/**
+ * little helper to check wether an unsigned 64bits integer in list
+ *
+ * \param value     value to be checked
+ * \param varlist   value list
+ * \param count     value list count
+ * \return
+ *      - true if value in the list
+ *      - false if value not in the list
+ */
+bool osiIsUint64InList(uint64_t value, const uint64_t *varlist, unsigned count);
+
+/**
+ * little helper to check wether an unsigned 64bits integer in range
+ *
+ * \param value     value to be checked
+ * \param minval    minimal value, inclusive
+ * \param maxval    maximum value, inclusive
+ * \return
+ *      - true if value in the range
+ *      - false if value not in the range
+ */
+bool osiIsUint64InRange(uint64_t value, uint64_t minval, uint64_t maxval);
+
+/**
+ * little helper to check wether an unsigned 64bits integer in range list
+ *
+ * \param value     value to be checked
+ * \param ranges    valid range list
+ * \param count     valid range list count
+ * \return
+ *      - true if value in the range list
+ *      - false if value not in the range list
+ */
+bool osiIsUint64InRanges(uint64_t value, const osiUint64Range_t *ranges, unsigned count);
+
+/**
+ * little helper to check wether a signed 64bits integer in list
+ *
+ * \param value     value to be checked
+ * \param varlist   value list
+ * \param count     value list count
+ * \return
+ *      - true if value in the list
+ *      - false if value not in the list
+ */
+bool osiIsInt64InList(int64_t value, const int64_t *varlist, unsigned count);
+
+/**
+ * little helper to check wether a signed 64bits integer in range
+ *
+ * \param value     value to be checked
+ * \param minval    minimal value, inclusive
+ * \param maxval    maximum value, inclusive
+ * \return
+ *      - true if value in the range
+ *      - false if value not in the range
+ */
+bool osiIsInt64InRange(int64_t value, int64_t minval, int64_t maxval);
+
+/**
+ * little helper to check wether a signed 64bits integer in range list
+ *
+ * \param value     value to be checked
+ * \param ranges    valid range list
+ * \param count     valid range list count
+ * \return
+ *      - true if value in the range list
+ *      - false if value not in the range list
+ */
+bool osiIsInt64InRanges(int64_t value, const osiInt64Range_t *ranges, unsigned count);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

+ 22 - 0
bsp/air724/sdk/components/include/rpc_config.h

@@ -0,0 +1,22 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _RPC_CONFIG_H_
+#define _RPC_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define CONFIG_RPC_SEND_STACK_ALLOCA_LIMIT 256
+#define CONFIG_RPC_PACKET_SIZE_MAX 1024
+#define CONFIG_RPC_EVENT_RANGE_COUNT 4
+
+#endif

+ 672 - 0
bsp/air724/sdk/components/include/sockets.h

@@ -0,0 +1,672 @@
+/**
+ * @file
+ * Socket API (to be used from non-TCPIP threads)
+ */
+
+/*
+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ */
+
+
+#ifndef LWIP_HDR_SOCKETS_H
+#define LWIP_HDR_SOCKETS_H
+
+#include "lwip/opt.h"
+#include <fcntl.h>
+
+#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
+
+#include "lwip/ip_addr.h"
+#include "lwip/netif.h"
+#include "lwip/err.h"
+#include "lwip/inet.h"
+#include "lwip/errno.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* If your port already typedef's sa_family_t, define SA_FAMILY_T_DEFINED
+   to prevent this code from redefining it. */
+#if !defined(sa_family_t) && !defined(SA_FAMILY_T_DEFINED)
+typedef u8_t sa_family_t;
+#endif
+/* If your port already typedef's in_port_t, define IN_PORT_T_DEFINED
+   to prevent this code from redefining it. */
+#if !defined(in_port_t) && !defined(IN_PORT_T_DEFINED)
+typedef u16_t in_port_t;
+#endif
+
+#if LWIP_IPV4
+/* members are in network byte order */
+struct sockaddr_in {
+  u8_t            sin_len;
+  sa_family_t     sin_family;
+  in_port_t       sin_port;
+  struct in_addr  sin_addr;
+#define SIN_ZERO_LEN 8
+  char            sin_zero[SIN_ZERO_LEN];
+};
+#endif /* LWIP_IPV4 */
+
+#if LWIP_IPV6
+struct sockaddr_in6 {
+  u8_t            sin6_len;      /* length of this structure    */
+  sa_family_t     sin6_family;   /* AF_INET6                    */
+  in_port_t       sin6_port;     /* Transport layer port #      */
+  u32_t           sin6_flowinfo; /* IPv6 flow information       */
+  struct in6_addr sin6_addr;     /* IPv6 address                */
+  u32_t           sin6_scope_id; /* Set of interfaces for scope */
+};
+#endif /* LWIP_IPV6 */
+
+struct sockaddr {
+  u8_t        sa_len;
+  sa_family_t sa_family;
+  char        sa_data[14];
+};
+
+struct sockaddr_storage {
+  u8_t        s2_len;
+  sa_family_t ss_family;
+  char        s2_data1[2];
+  u32_t       s2_data2[3];
+#if LWIP_IPV6
+  u32_t       s2_data3[3];
+#endif /* LWIP_IPV6 */
+};
+/** A struct sockaddr replacement that has the same alignment as sockaddr_in/
+ *  sockaddr_in6 if instantiated.
+ */
+union sockaddr_aligned {
+   struct sockaddr sa;
+#if LWIP_IPV6
+   struct sockaddr_in6 sin6;
+#endif /* LWIP_IPV6 */
+#if LWIP_IPV4
+   struct sockaddr_in sin;
+#endif /* LWIP_IPV4 */
+};
+
+/* If your port already typedef's socklen_t, define SOCKLEN_T_DEFINED
+   to prevent this code from redefining it. */
+#if !defined(socklen_t) && !defined(SOCKLEN_T_DEFINED)
+typedef u32_t socklen_t;
+#endif
+
+#if !defined IOV_MAX
+#define IOV_MAX 0xFFFF
+#elif IOV_MAX > 0xFFFF
+#error "IOV_MAX larger than supported by LwIP"
+#endif /* IOV_MAX */
+
+#if !defined(iovec)
+struct iovec {
+  void  *iov_base;
+  size_t iov_len;
+};
+#endif
+
+struct msghdr {
+  void         *msg_name;
+  socklen_t     msg_namelen;
+  struct iovec *msg_iov;
+  int           msg_iovlen;
+  void         *msg_control;
+  socklen_t     msg_controllen;
+  int           msg_flags;
+};
+
+/* struct msghdr->msg_flags bit field values */
+#define MSG_TRUNC   0x04
+#define MSG_CTRUNC  0x08
+
+/* RFC 3542, Section 20: Ancillary Data */
+struct cmsghdr {
+  socklen_t  cmsg_len;   /* number of bytes, including header */
+  int        cmsg_level; /* originating protocol */
+  int        cmsg_type;  /* protocol-specific type */
+};
+/* Data section follows header and possible padding, typically referred to as
+      unsigned char cmsg_data[]; */
+
+/* cmsg header/data alignment. NOTE: we align to native word size (double word
+size on 16-bit arch) so structures are not placed at an unaligned address.
+16-bit arch needs double word to ensure 32-bit alignment because socklen_t
+could be 32 bits. If we ever have cmsg data with a 64-bit variable, alignment
+will need to increase long long */
+#define ALIGN_H(size) (((size) + sizeof(long) - 1U) & ~(sizeof(long)-1U))
+#define ALIGN_D(size) ALIGN_H(size)
+
+#define CMSG_FIRSTHDR(mhdr) \
+          ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
+           (struct cmsghdr *)(mhdr)->msg_control : \
+           (struct cmsghdr *)NULL)
+
+#define CMSG_NXTHDR(mhdr, cmsg) \
+        (((cmsg) == NULL) ? CMSG_FIRSTHDR(mhdr) : \
+         (((u8_t *)(cmsg) + ALIGN_H((cmsg)->cmsg_len) \
+                            + ALIGN_D(sizeof(struct cmsghdr)) > \
+           (u8_t *)((mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
+          (struct cmsghdr *)NULL : \
+          (struct cmsghdr *)((void*)((u8_t *)(cmsg) + \
+                                      ALIGN_H((cmsg)->cmsg_len)))))
+
+#define CMSG_DATA(cmsg) ((void*)((u8_t *)(cmsg) + \
+                         ALIGN_D(sizeof(struct cmsghdr))))
+
+#define CMSG_SPACE(length) (ALIGN_D(sizeof(struct cmsghdr)) + \
+                            ALIGN_H(length))
+
+#define CMSG_LEN(length) (ALIGN_D(sizeof(struct cmsghdr)) + \
+                           length)
+
+/* Set socket options argument */
+#define IFNAMSIZ NETIF_NAMESIZE
+struct ifreq {
+  char ifr_name[IFNAMSIZ]; /* Interface name */
+};
+
+/* Socket protocol types (TCP/UDP/RAW) */
+#define SOCK_STREAM     1
+#define SOCK_DGRAM      2
+#define SOCK_RAW        3
+
+/*
+ * Option flags per-socket. These must match the SOF_ flags in ip.h (checked in init.c)
+ */
+#define SO_REUSEADDR   0x0004 /* Allow local address reuse */
+#define SO_KEEPALIVE   0x0008 /* keep connections alive */
+#define SO_BROADCAST   0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
+
+
+/*
+ * Additional options, not kept in so_options.
+ */
+#define SO_DEBUG        0x0001 /* Unimplemented: turn on debugging info recording */
+#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */
+#define SO_DONTROUTE    0x0010 /* Unimplemented: just use interface addresses */
+#define SO_USELOOPBACK  0x0040 /* Unimplemented: bypass hardware when possible */
+#define SO_LINGER       0x0080 /* linger on close if data present */
+#define SO_DONTLINGER   ((int)(~SO_LINGER))
+#define SO_OOBINLINE    0x0100 /* Unimplemented: leave received OOB data in line */
+#define SO_REUSEPORT    0x0200 /* Unimplemented: allow local address & port reuse */
+#define SO_SNDBUF       0x1001 /* Unimplemented: send buffer size */
+#define SO_RCVBUF       0x1002 /* receive buffer size */
+#define SO_SNDLOWAT     0x1003 /* Unimplemented: send low-water mark */
+#define SO_RCVLOWAT     0x1004 /* Unimplemented: receive low-water mark */
+#define SO_SNDTIMEO     0x1005 /* send timeout */
+#define SO_RCVTIMEO     0x1006 /* receive timeout */
+#define SO_ERROR        0x1007 /* get error status and clear */
+#define SO_TYPE         0x1008 /* get socket type */
+#define SO_CONTIMEO     0x1009 /* Unimplemented: connect timeout */
+#define SO_NO_CHECK     0x100a /* don't create UDP checksum */
+#define SO_BINDTODEVICE 0x100b /* bind to device */
+
+/*
+ * Structure used for manipulating linger option.
+ */
+struct linger {
+  int l_onoff;                /* option on/off */
+  int l_linger;               /* linger time in seconds */
+};
+
+/*
+ * Level number for (get/set)sockopt() to apply to socket itself.
+ */
+#define  SOL_SOCKET  0xfff    /* options for socket level */
+
+
+#define AF_UNSPEC       0
+#define AF_INET         2
+#if LWIP_IPV6
+#define AF_INET6        10
+#else /* LWIP_IPV6 */
+#define AF_INET6        AF_UNSPEC
+#endif /* LWIP_IPV6 */
+#define PF_INET         AF_INET
+#define PF_INET6        AF_INET6
+#define PF_UNSPEC       AF_UNSPEC
+
+#define IPPROTO_IP      0
+#define IPPROTO_ICMP    1
+#define IPPROTO_TCP     6
+#define IPPROTO_UDP     17
+#if LWIP_IPV6
+#define IPPROTO_IPV6    41
+#define IPPROTO_ICMPV6  58
+#endif /* LWIP_IPV6 */
+#define IPPROTO_UDPLITE 136
+#define IPPROTO_RAW     255
+
+/* Flags we can use with send and recv. */
+#define MSG_PEEK       0x01    /* Peeks at an incoming message */
+#define MSG_WAITALL    0x02    /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
+#define MSG_OOB        0x04    /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
+#define MSG_DONTWAIT   0x08    /* Nonblocking i/o for this operation only */
+#define MSG_MORE       0x10    /* Sender will send more */
+#define MSG_NOSIGNAL   0x20    /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */
+
+
+/*
+ * Options for level IPPROTO_IP
+ */
+#define IP_TOS             1
+#define IP_TTL             2
+#define IP_PKTINFO         8
+
+#if LWIP_TCP
+/*
+ * Options for level IPPROTO_TCP
+ */
+#define TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
+#define TCP_KEEPALIVE  0x02    /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
+#define TCP_KEEPIDLE   0x03    /* set pcb->keep_idle  - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
+#define TCP_KEEPINTVL  0x04    /* set pcb->keep_intvl - Use seconds for get/setsockopt */
+#define TCP_KEEPCNT    0x05    /* set pcb->keep_cnt   - Use number of probes sent for get/setsockopt */
+#endif /* LWIP_TCP */
+
+#if LWIP_IPV6
+/*
+ * Options for level IPPROTO_IPV6
+ */
+#define IPV6_CHECKSUM       7  /* RFC3542: calculate and insert the ICMPv6 checksum for raw sockets. */
+#define IPV6_V6ONLY         27 /* RFC3493: boolean control to restrict AF_INET6 sockets to IPv6 communications only. */
+#endif /* LWIP_IPV6 */
+
+#if LWIP_UDP && LWIP_UDPLITE
+/*
+ * Options for level IPPROTO_UDPLITE
+ */
+#define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */
+#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */
+#endif /* LWIP_UDP && LWIP_UDPLITE*/
+
+
+#if LWIP_MULTICAST_TX_OPTIONS
+/*
+ * Options and types for UDP multicast traffic handling
+ */
+#define IP_MULTICAST_TTL   5
+#define IP_MULTICAST_IF    6
+#define IP_MULTICAST_LOOP  7
+#endif /* LWIP_MULTICAST_TX_OPTIONS */
+
+#if LWIP_IGMP
+/*
+ * Options and types related to multicast membership
+ */
+#define IP_ADD_MEMBERSHIP  3
+#define IP_DROP_MEMBERSHIP 4
+
+typedef struct ip_mreq {
+    struct in_addr imr_multiaddr; /* IP multicast address of group */
+    struct in_addr imr_interface; /* local IP address of interface */
+} ip_mreq;
+#endif /* LWIP_IGMP */
+
+#if LWIP_IPV4
+struct in_pktinfo {
+  unsigned int   ipi_ifindex;  /* Interface index */
+  struct in_addr ipi_spec_dst;
+  struct in_addr ipi_addr;     /* Destination (from header) address */
+};
+#endif /* LWIP_IPV4 */
+
+/*
+ * The Type of Service provides an indication of the abstract
+ * parameters of the quality of service desired.  These parameters are
+ * to be used to guide the selection of the actual service parameters
+ * when transmitting a datagram through a particular network.  Several
+ * networks offer service precedence, which somehow treats high
+ * precedence traffic as more important than other traffic (generally
+ * by accepting only traffic above a certain precedence at time of high
+ * load).  The major choice is a three way tradeoff between low-delay,
+ * high-reliability, and high-throughput.
+ * The use of the Delay, Throughput, and Reliability indications may
+ * increase the cost (in some sense) of the service.  In many networks
+ * better performance for one of these parameters is coupled with worse
+ * performance on another.  Except for very unusual cases at most two
+ * of these three indications should be set.
+ */
+#define IPTOS_TOS_MASK          0x1E
+#define IPTOS_TOS(tos)          ((tos) & IPTOS_TOS_MASK)
+#define IPTOS_LOWDELAY          0x10
+#define IPTOS_THROUGHPUT        0x08
+#define IPTOS_RELIABILITY       0x04
+#define IPTOS_LOWCOST           0x02
+#define IPTOS_MINCOST           IPTOS_LOWCOST
+
+/*
+ * The Network Control precedence designation is intended to be used
+ * within a network only.  The actual use and control of that
+ * designation is up to each network. The Internetwork Control
+ * designation is intended for use by gateway control originators only.
+ * If the actual use of these precedence designations is of concern to
+ * a particular network, it is the responsibility of that network to
+ * control the access to, and use of, those precedence designations.
+ */
+#define IPTOS_PREC_MASK                 0xe0
+#define IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
+#define IPTOS_PREC_NETCONTROL           0xe0
+#define IPTOS_PREC_INTERNETCONTROL      0xc0
+#define IPTOS_PREC_CRITIC_ECP           0xa0
+#define IPTOS_PREC_FLASHOVERRIDE        0x80
+#define IPTOS_PREC_FLASH                0x60
+#define IPTOS_PREC_IMMEDIATE            0x40
+#define IPTOS_PREC_PRIORITY             0x20
+#define IPTOS_PREC_ROUTINE              0x00
+
+
+/*
+ * Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
+ * lwip_ioctl only supports FIONREAD and FIONBIO, for now
+ *
+ * Ioctl's have the command encoded in the lower word,
+ * and the size of any in or out parameters in the upper
+ * word.  The high 2 bits of the upper word are used
+ * to encode the in/out status of the parameter; for now
+ * we restrict parameters to at most 128 bytes.
+ */
+#if !defined(FIONREAD) || !defined(FIONBIO)
+#define IOCPARM_MASK    0x7fU           /* parameters must be < 128 bytes */
+#define IOC_VOID        0x20000000UL    /* no parameters */
+#define IOC_OUT         0x40000000UL    /* copy out parameters */
+#define IOC_IN          0x80000000UL    /* copy in parameters */
+#define IOC_INOUT       (IOC_IN|IOC_OUT)
+                                        /* 0x20000000 distinguishes new &
+                                           old ioctl's */
+#define _IO(x,y)        (IOC_VOID|((x)<<8)|(y))
+
+#define _IOR(x,y,t)     (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
+
+#define _IOW(x,y,t)     (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
+#endif /* !defined(FIONREAD) || !defined(FIONBIO) */
+
+#ifndef FIONREAD
+#define FIONREAD    _IOR('f', 127, unsigned long) /* get # bytes to read */
+#endif
+#ifndef FIONBIO
+#define FIONBIO     _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */
+#endif
+
+/* Socket I/O Controls: unimplemented */
+#ifndef SIOCSHIWAT
+#define SIOCSHIWAT  _IOW('s',  0, unsigned long)  /* set high watermark */
+#define SIOCGHIWAT  _IOR('s',  1, unsigned long)  /* get high watermark */
+#define SIOCSLOWAT  _IOW('s',  2, unsigned long)  /* set low watermark */
+#define SIOCGLOWAT  _IOR('s',  3, unsigned long)  /* get low watermark */
+#define SIOCATMARK  _IOR('s',  7, unsigned long)  /* at oob mark? */
+#endif
+
+/* commands for fnctl */
+#ifndef F_GETFL
+#define F_GETFL 3
+#endif
+#ifndef F_SETFL
+#define F_SETFL 4
+#endif
+
+/* File status flags and file access modes for fnctl,
+   these are bits in an int. */
+#ifndef O_NONBLOCK
+#define O_NONBLOCK  1 /* nonblocking I/O */
+#endif
+#ifndef O_NDELAY
+#define O_NDELAY    1 /* same as O_NONBLOCK, for compatibility */
+#endif
+#ifndef O_RDONLY
+#define O_RDONLY    2
+#endif
+#ifndef O_WRONLY
+#define O_WRONLY    4
+#endif
+#ifndef O_RDWR
+#define O_RDWR      (O_RDONLY|O_WRONLY)
+#endif
+
+#ifndef SHUT_RD
+  #define SHUT_RD   0
+  #define SHUT_WR   1
+  #define SHUT_RDWR 2
+#endif
+
+/* To avoid the conflict with socket.h in newlib
+*/
+#ifdef FD_SET
+#undef FD_SET
+#undef FD_CLR
+#undef FD_ISSET
+#undef FD_ZERO
+#undef fd_set
+#endif
+
+
+/* FD_SET used for lwip_select */
+#ifndef FD_SET
+#undef  FD_SETSIZE
+/* Make FD_SETSIZE match NUM_SOCKETS in socket.c */
+#define FD_SETSIZE    MEMP_NUM_NETCONN
+#define FDSETSAFESET(n, code) do { \
+  if (((n) - LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n) - LWIP_SOCKET_OFFSET) >= 0)) { \
+  code; }} while(0)
+#define FDSETSAFEGET(n, code) (((n) - LWIP_SOCKET_OFFSET < MEMP_NUM_NETCONN) && (((int)(n) - LWIP_SOCKET_OFFSET) >= 0) ?\
+  (code) : 0)
+#define FD_SET(n, p)  FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] |=  (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_CLR(n, p)  FDSETSAFESET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] &= ~(1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_ISSET(n,p) FDSETSAFEGET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] &   (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))
+#define FD_ZERO(p)    memset((void*)(p), 0, sizeof(*(p)))
+
+typedef struct fd_set
+{
+  unsigned char fd_bits [(FD_SETSIZE+7)/8];
+} fd_set;
+
+#elif LWIP_SOCKET_OFFSET
+#error LWIP_SOCKET_OFFSET does not work with external FD_SET!
+#elif FD_SETSIZE < MEMP_NUM_NETCONN
+#error "external FD_SETSIZE too small for number of sockets"
+#endif /* FD_SET */
+
+/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
+ * by your system, set this to 0 and include <sys/time.h> in cc.h */
+#ifndef LWIP_TIMEVAL_PRIVATE
+#define LWIP_TIMEVAL_PRIVATE 1
+#endif
+
+#if LWIP_TIMEVAL_PRIVATE
+struct timeval {
+  long    tv_sec;         /* seconds */
+  long    tv_usec;        /* and microseconds */
+};
+#endif /* LWIP_TIMEVAL_PRIVATE */
+
+#define lwip_socket_init() /* Compatibility define, no init needed. */
+void lwip_socket_thread_init(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: initialize thread-local semaphore */
+void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destroy thread-local semaphore */
+
+#if LWIP_COMPAT_SOCKETS == 2
+/* This helps code parsers/code completion by not having the COMPAT functions as defines */
+#define lwip_accept       accept
+#define lwip_bind         bind
+#define lwip_shutdown     shutdown
+#define lwip_getpeername  getpeername
+#define lwip_getsockname  getsockname
+#define lwip_setsockopt   setsockopt
+#define lwip_getsockopt   getsockopt
+#define lwip_close        closesocket
+#define lwip_connect      connect
+#define lwip_listen       listen
+#define lwip_recv         recv
+#define lwip_recvmsg      recvmsg
+#define lwip_recvfrom     recvfrom
+#define lwip_send         send
+#define lwip_sendmsg      sendmsg
+#define lwip_sendto       sendto
+#define lwip_socket       socket
+#define lwip_select       select
+#define lwip_ioctlsocket  ioctl
+
+#if LWIP_POSIX_SOCKETS_IO_NAMES
+#define lwip_read         read
+#define lwip_write        write
+#define lwip_writev       writev
+#undef lwip_close
+#define lwip_close        close
+#define closesocket(s)    close(s)
+#define lwip_fcntl        fcntl
+#define lwip_ioctl        ioctl
+#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
+#endif /* LWIP_COMPAT_SOCKETS == 2 */
+
+int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
+int lwip_shutdown(int s, int how);
+int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
+int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
+int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
+int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
+ int lwip_close(int s);
+int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen);
+int lwip_listen(int s, int backlog);
+ssize_t lwip_recv(int s, void *mem, size_t len, int flags);
+ssize_t lwip_read(int s, void *mem, size_t len);
+ssize_t lwip_recvfrom(int s, void *mem, size_t len, int flags,
+      struct sockaddr *from, socklen_t *fromlen);
+ssize_t lwip_recvmsg(int s, struct msghdr *message, int flags);
+ssize_t lwip_send(int s, const void *dataptr, size_t size, int flags);
+ssize_t lwip_sendmsg(int s, const struct msghdr *message, int flags);
+ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
+    const struct sockaddr *to, socklen_t tolen);
+int lwip_socket(int domain, int type, int protocol);
+ssize_t lwip_write(int s, const void *dataptr, size_t size);
+ssize_t lwip_writev(int s, const struct iovec *iov, int iovcnt);
+#if LWIP_SOCKET_SELECT
+int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
+                struct timeval *timeout);
+#endif
+int lwip_ioctl(int s, long cmd, void *argp);
+int lwip_fcntl(int s, int cmd, int val);
+struct netif* lwip_getDefaultNetif();
+
+/*+\NEW\zhuwangbin\2020.06.5\添加善理poc平台*/
+#ifdef CONFIG_POC_SUPPORT
+int lwip_getErrNo(void);
+#endif
+/*-\NEW\zhuwangbin\2020.06.5\添加善理poc平台*/
+
+#if LWIP_COMPAT_SOCKETS
+#if LWIP_COMPAT_SOCKETS != 2
+/** @ingroup socket */
+#define accept(s,addr,addrlen)                    lwip_accept(s,addr,addrlen)
+/** @ingroup socket */
+#define bind(s,name,namelen)                      lwip_bind(s,name,namelen)
+/** @ingroup socket */
+#define shutdown(s,how)                           lwip_shutdown(s,how)
+/** @ingroup socket */
+#define getpeername(s,name,namelen)               lwip_getpeername(s,name,namelen)
+/** @ingroup socket */
+#define getsockname(s,name,namelen)               lwip_getsockname(s,name,namelen)
+/** @ingroup socket */
+#define setsockopt(s,level,optname,opval,optlen)  lwip_setsockopt(s,level,optname,opval,optlen)
+/** @ingroup socket */
+#define getsockopt(s,level,optname,opval,optlen)  lwip_getsockopt(s,level,optname,opval,optlen)
+/** @ingroup socket */
+#define closesocket(s)                            lwip_close(s)
+/** @ingroup socket */
+#define connect(s,name,namelen)                   lwip_connect(s,name,namelen)
+/** @ingroup socket */
+#define listen(s,backlog)                         lwip_listen(s,backlog)
+/** @ingroup socket */
+#define recv(s,mem,len,flags)                     lwip_recv(s,mem,len,flags)
+/** @ingroup socket */
+#define recvmsg(s,message,flags)                  lwip_recvmsg(s,message,flags)
+/** @ingroup socket */
+#define recvfrom(s,mem,len,flags,from,fromlen)    lwip_recvfrom(s,mem,len,flags,from,fromlen)
+/** @ingroup socket */
+#define send(s,dataptr,size,flags)                lwip_send(s,dataptr,size,flags)
+/** @ingroup socket */
+#define sendmsg(s,message,flags)                  lwip_sendmsg(s,message,flags)
+/** @ingroup socket */
+#define sendto(s,dataptr,size,flags,to,tolen)     lwip_sendto(s,dataptr,size,flags,to,tolen)
+/** @ingroup socket */
+#define socket(domain,type,protocol)              lwip_socket(domain,type,protocol)
+/** @ingroup socket */
+#define select(maxfdp1,readset,writeset,exceptset,timeout)     lwip_select(maxfdp1,readset,writeset,exceptset,timeout)
+/** @ingroup socket */
+#define ioctlsocket(s,cmd,argp)                   lwip_ioctl(s,cmd,argp)
+
+#if LWIP_POSIX_SOCKETS_IO_NAMES
+/** @ingroup socket */
+#define read(s,mem,len)                           lwip_read(s,mem,len)
+/** @ingroup socket */
+#define write(s,dataptr,len)                      lwip_write(s,dataptr,len)
+/** @ingroup socket */
+#define writev(s,iov,iovcnt)                      lwip_writev(s,iov,iovcnt)
+/** @ingroup socket */
+#define close(s)                                  lwip_close(s)
+/** @ingroup socket */
+#define fcntl(s,cmd,val)                          lwip_fcntl(s,cmd,val)
+/** @ingroup socket */
+#define ioctl(s,cmd,argp)                         lwip_ioctl(s,cmd,argp)
+#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
+#endif /* LWIP_COMPAT_SOCKETS != 2 */
+
+#if LWIP_IPV4 && LWIP_IPV6
+/** @ingroup socket */
+#define inet_ntop(af,src,dst,size) \
+    (((af) == AF_INET6) ? ip6addr_ntoa_r((const ip6_addr_t*)(src),(dst),(size)) \
+     : (((af) == AF_INET) ? ip4addr_ntoa_r((const ip4_addr_t*)(src),(dst),(size)) : NULL))
+/** @ingroup socket */
+#define inet_pton(af,src,dst) \
+    (((af) == AF_INET6) ? ip6addr_aton((src),(ip6_addr_t*)(dst)) \
+     : (((af) == AF_INET) ? ip4addr_aton((src),(ip4_addr_t*)(dst)) : 0))
+#elif LWIP_IPV4 /* LWIP_IPV4 && LWIP_IPV6 */
+#define inet_ntop(af,src,dst,size) \
+    (((af) == AF_INET) ? ip4addr_ntoa_r((const ip4_addr_t*)(src),(dst),(size)) : NULL)
+#define inet_pton(af,src,dst) \
+    (((af) == AF_INET) ? ip4addr_aton((src),(ip4_addr_t*)(dst)) : 0)
+#else /* LWIP_IPV4 && LWIP_IPV6 */
+#define inet_ntop(af,src,dst,size) \
+    (((af) == AF_INET6) ? ip6addr_ntoa_r((const ip6_addr_t*)(src),(dst),(size)) : NULL)
+#define inet_pton(af,src,dst) \
+    (((af) == AF_INET6) ? ip6addr_aton((src),(ip6_addr_t*)(dst)) : 0)
+#endif /* LWIP_IPV4 && LWIP_IPV6 */
+
+#endif /* LWIP_COMPAT_SOCKETS */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LWIP_SOCKET */
+
+#endif /* LWIP_HDR_SOCKETS_H */

+ 63 - 0
bsp/air724/sdk/components/include/srv_config.h

@@ -0,0 +1,63 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _SRV_CONFIG_H_
+#define _SRV_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+/**
+ * whether to enable trace through usb serial
+ */
+#define CONFIG_USB_TRACE_ENABLE
+
+/**
+ * whether to enable 2line wakeup feature
+ */
+/* #undef CONFIG_TWOLINE_WAKEUP_ENABLE */
+
+/**
+ * input gpio number for 2line wakeup feature
+ */
+/* #undef CONFIG_TWOLINE_WAKEUP_IN_GPIO */
+
+/**
+ * output gpio number for 2line wakeup feature
+ */
+/* #undef CONFIG_TWOLINE_WAKEUP_OUT_GPIO */
+
+/**
+ * whether to enable gpio simulation for DTR
+ */
+/* #undef CONFIG_SRV_DTR_ENABLE */
+
+/**
+ * gpio number for DTR simulation
+ */
+/* #undef CONFIG_SRV_DTR_GPIO */
+
+/**
+ * whether to enable software debounce of DTR gpio simulation
+ */
+/* #undef CONFIG_SRV_DTR_DEBOUNCE_ENABLE */
+
+/**
+ * software debounce time for DTR gpio simulation
+ */
+/* #undef CONFIG_SRV_DTR_DEBOUNCE_TIME */
+
+/**
+ * log tag of service module
+ */
+#define LOG_TAG_SRV OSI_MAKE_LOG_TAG('S', 'E', 'R', 'V')
+
+#endif

+ 42 - 0
bsp/air724/sdk/components/include/tts_config.h

@@ -0,0 +1,42 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _TTS_CONFIG_H_
+#define _TTS_CONFIG_H_
+
+// Auto generated. Don't edit it manually!
+
+#define LOG_TAG_TTS OSI_MAKE_LOG_TAG('T', 'T', 'S', ' ')
+
+/**
+ * Whether TTS player is supported
+ */
+#define CONFIG_TTS_ENABLE
+
+/**
+ * Wheth the dummy TTS engine is enabled.
+ *
+ * When a real TTS engine is used, it must be disabled.
+ */
+/* #undef CONFIG_TTS_DUMMY_SUPPORT */
+
+/**
+ * TTS thread stack size in bytes
+ */
+/* #undef CONFIG_TTS_STACK_SIZE */
+
+/**
+ * TTS output PCM sample rate
+ */
+/* #undef CONFIG_TTS_PCM_SAMPLE_RATE */
+
+#endif

+ 695 - 0
bsp/air724/sdk/components/include/vfs.h

@@ -0,0 +1,695 @@
+/* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
+ * All rights reserved.
+ *
+ * This software is supplied "AS IS" without any warranties.
+ * RDA assumes no responsibility or liability for the use of the software,
+ * conveys no license or title under any patent, copyright, or mask work
+ * right to the product. RDA reserves the right to make changes in the
+ * software without notification.  RDA also make no representation or
+ * warranty that such application will be suitable for the specified use
+ * without further testing or modification.
+ */
+
+#ifndef _VFS_H_
+#define _VFS_H_
+
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * the maximum absolute file path including mount point, terminate \0
+ */
+#define VFS_PATH_MAX (192)
+
+#define DT_UNKOWN 0 ///< unknown type
+#define DT_DIR 4    ///< directory
+#define DT_REG 8    ///< regular file
+
+/**
+ * read only flag used in \p vfs_remount
+ */
+#define MS_RDONLY 1
+
+/**
+ * DIR data structure
+ */
+typedef struct
+{
+    int16_t fs_index;  ///< internal fs index
+    int16_t _reserved; ///< reserved
+} DIR;
+
+/**
+ * dirent data structure
+ */
+struct dirent
+{
+    int d_ino;            ///< inode number, file system implementation can use it for any purpose
+    unsigned char d_type; ///< type of file
+    char d_name[256];     ///< file name
+};
+
+struct statvfs
+{
+    unsigned long f_bsize;   /* file system block size */
+    unsigned long f_frsize;  /* fragment size */
+    unsigned long f_blocks;  /* size of fs in f_frsize units */
+    unsigned long f_bfree;   /* free blocks in fs */
+    unsigned long f_bavail;  /* free blocks avail to non-superuser */
+    unsigned long f_files;   /* total file nodes in file system */
+    unsigned long f_ffree;   /* free file nodes in fs */
+    unsigned long f_favail;  /* avail file nodes in fs */
+    unsigned long f_fsid;    /* file system id */
+    unsigned long f_flag;    /* mount flags */
+    unsigned long f_namemax; /* maximum length of filenames */
+};
+
+/**
+ * unmount file system by file path
+ *
+ * \p path must be absolute path, starting with '/'. It can be mount point
+ * or arbitrary file or directory under the mount point.
+ *
+ * \param [in] path     file path
+ * \return
+ *      - 0 on success
+ *      - -1 on error
+ *          - EINVAL: invalid parameter
+ *          - ENOENT: there are no mount points
+ */
+int vfs_umount(const char *path);
+
+/**
+ * remount file system with flags
+ *
+ * The only supported flags are \p MS_READONLY.
+ *
+ * \p path must be a mount point.
+ *
+ * \param [in] path     mount point path
+ * \param [in] flags    file system mount flags
+ * \return
+ *      - 0 on success
+ *      - -1 on error
+ *          - ENOENT: \p path is not a mount point
+ *          - ENOSYS: the file system doesn't support remount
+ *          - others: refer to file system implementation
+ */
+int vfs_remount(const char *path, unsigned flags);
+
+/**
+ * open and possibly create a file
+ *
+ * It is the same as open a file with O_WRONLY, O_CREAT, O_TRUNC.
+ *
+ * Refer to man (2) creat.
+ *
+ * \param [in] path     file path
+ * \param [in] mode     file mode, may be ignored by file system
+ *                      implementation
+ * \return
+ *      - file descriptor on success on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_creat(const char *path, mode_t mode);
+
+/**
+ * open and possibly create a file
+ *
+ * Refer to man (2) open
+ *
+ * \param [in] path     file path
+ * \param [in] flags    O_CREAT, O_ACCMODE, O_TRUNC
+ * \param [in] mode     file mode, may be ignored by file system
+ *                      implementation
+ * \return
+ *      - file descriptor on success on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_open(const char *path, int flags, ...);
+
+/**
+ * close a file descriptor
+ *
+ * Refer to man (2) close
+ *
+ * \param [in] fd       file descriptor
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_close(int fd);
+
+/**
+ * read from a file descriptor
+ *
+ * Refer to man (2) read
+ *
+ * \param [in] fd       file descriptor
+ * \param [out] buf     buf for read
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes read on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+ssize_t vfs_read(int fd, void *buf, size_t count);
+
+/**
+ * write to a file descriptor
+ *
+ * Refer to man (2) write
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] buf      buf for write
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes written on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+ssize_t vfs_write(int fd, const void *buf, size_t count);
+
+/**
+ * reposition read/write file offset
+ *
+ * Refer to man (2) lseek
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] offset   offset according to the directive whence
+ * \param [in] whence   SEEK_SET, SEEK_CUR, SEEK_END
+ * \return
+ *      - offset location as measured in bytes from the beginning of
+ *        the file on success.
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+long vfs_lseek(int fd, long offset, int whence);
+
+/**
+ * get file status
+ *
+ * Refer to man (2) fstat
+ *
+ * \param [in] fd       file descriptor
+ * \param [out] st      file status
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_fstat(int fd, struct stat *st);
+
+/**
+ * get file status
+ *
+ * Refer to man (2) stat
+ *
+ * \param [in] path     file path
+ * \param [out] st      file status
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_stat(const char *path, struct stat *st);
+
+/**
+ * truncate a file to a specified length
+ *
+ * Refer to man (2) truncate
+ *
+ * \param [in] path     file path
+ * \param [in] length   file length
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_truncate(const char *path, long length);
+
+/**
+ * truncate a file to a specified length
+ *
+ * Refer to man (2) ftruncate
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] length   file length
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_ftruncate(int fd, long length);
+
+/**
+ * truncate a file to a specified length
+ *
+ * Refer to man (2) link. It is just a placeholder, and no file systems
+ * support it now.
+ *
+ * \param [in] oldpath  old file path
+ * \param [in] newpath  new file path
+ * \return
+ *      - -1 on error, errno is ENOSYS
+ */
+int vfs_link(const char *oldpath, const char *newpath);
+
+/**
+ * delete a name and possibly the file it refers to
+ *
+ * Refer to man (2) unlink
+ *
+ * \param [in] pathname file path name
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_unlink(const char *pathname);
+
+/**
+ * change the name or location of a file
+ *
+ * Refer to man (2) rename
+ *
+ * \p oldpath and \p newpath must be on the same mounted file system.
+ *
+ * \param [in] oldpath  old file path
+ * \param [in] newpath  new file path
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ *          - EXDEV: oldpath and newpath are not on the same mounted
+ *            file system.
+ */
+int vfs_rename(const char *oldpath, const char *newpath);
+
+/**
+ * synchronize a file's in-core state with storage device
+ *
+ * Refer to man (2) fsync
+ *
+ * \param [in] fd       file descriptor
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_fsync(int fd);
+
+/**
+ * manipulate file descriptor
+ *
+ * Refer to man (2) fcntl. It is just a placeholder, and no file systems
+ * support it now.
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] cmd      command
+ * \return
+ *      - -1 on error, errno is ENOSYS
+ */
+int vfs_fcntl(int fd, int cmd, ...);
+
+/**
+ * control device
+ *
+ * Refer to man (2) ioctl. It is just a placeholder, and no file systems
+ * support it now.
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] cmd      command
+ * \return
+ *      - -1 on error, errno is ENOSYS
+ */
+int vfs_ioctl(int fd, unsigned long request, ...);
+
+/**
+ * open a directory
+ *
+ * Refer to man (3) opendir
+ *
+ * \param [in] name     directory name
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+DIR *vfs_opendir(const char *name);
+
+/**
+ * read a directory
+ *
+ * Refer to man (3) readdir
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+struct dirent *vfs_readdir(DIR *dirp);
+
+/**
+ * read a directory
+ *
+ * Refer to man (3) readdir_r
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \param [out] entry   dirent buffer
+ * \param [out] result  pointer to dirent buffer
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
+
+/**
+ * return current location in directory stream
+ *
+ * Refer to man (3) telldir
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+long vfs_telldir(DIR *pdir);
+
+/**
+ * set the position of the next readdir() call in the directory stream
+ *
+ * Refer to man (3) seekdir
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \param [in] loc      location returned by \p vfs_telldir
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+void vfs_seekdir(DIR *pdir, long loc);
+
+/**
+ * reset directory stream
+ *
+ * Refer to man (3) rewinddir
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+void vfs_rewinddir(DIR *pdir);
+
+/**
+ * close a directory
+ *
+ * Refer to man (3) closedir
+ *
+ * \param [in] dirp     directory pointer returned by \p vfs_opendir
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_closedir(DIR *pdir);
+
+/**
+ * create a directory
+ *
+ * Refer to man (2) mkdir
+ *
+ * \param [in] pathname directory path name
+ * \param [in] mode     create mode
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_mkdir(const char *pathname, mode_t mode);
+
+/**
+ * delete a directory
+ *
+ * Refer to man (2) rmdir
+ *
+ * \param [in] pathname directory path name
+ * \return
+ *      - 0 on success
+ *      - -1 on error. Refer to file system implementation for errno.
+ */
+int vfs_rmdir(const char *pathname);
+
+/**
+ * change working directory
+ *
+ * Refer to man (2) chdir
+ *
+ * NOTE: in RTOS system, working directory is a global concept. It is
+ * dangerous to change working directory. Don't call \p vfs_chdir
+ * unless it is absolutely needed, and you really know what you are
+ * doing.
+ *
+ * \param [in] path     directory path name
+ * \return
+ *      - 0 on success
+ *      - -1 on error
+ */
+int vfs_chdir(const char *path);
+
+/**
+ * get current working directory
+ *
+ * Refer to man (3) getcwd
+ *
+ * \param [out] buf     buffer for result
+ * \param [in] size     buffer size
+ * \return
+ *      - current working directory on success
+ *      - NULL on error
+ */
+char *vfs_getcwd(char *buf, size_t size);
+
+/**
+ * return the canonicalized absolute pathname
+ *
+ * Refer to man (3) realpath
+ *
+ * \param [in] path     file path
+ * \param [in] resolved_path    buffer for canonicalized absolute pathname
+ * \return
+ *      - \p resolved_path on success
+ *      - NULL on error
+ */
+char *vfs_realpath(const char *path, char *resolved_path);
+
+/**
+ * get filesystem statistics
+ *
+ * Refer to man (3) statvfs
+ *
+ * \param [in] path     file path
+ * \param [in] buf      filesystem statistics
+ * \return
+ *      - 0 on success
+ *      - -1 on error
+ */
+int vfs_statvfs(const char *path, struct statvfs *buf);
+
+/**
+ * get filesystem statistics
+ *
+ * Refer to man (3) fstatvfs
+ *
+ * \param [in] fd       file descriptor
+ * \param [in] buf      filesystem statistics
+ * \return
+ *      - 0 on success
+ *      - -1 on error
+ */
+int vfs_fstatvfs(int fd, struct statvfs *buf);
+
+/**
+ * get mounted file system count
+ *
+ * \return  mounted file system count
+ */
+int vfs_mount_count(void);
+
+/**
+ * get mounted file system mount points
+ *
+ * \param [in] mp       buffer for mount points
+ * \param [in] count    buffer count
+ * \return  count of get mount points
+ */
+int vfs_mount_points(char **mp, size_t count);
+
+/**
+ * helper to get canonicalized absolute pathname
+ *
+ * It is similar to \p vfs_realpath, just with specified base path name.
+ *
+ * \param [in] base_path    base path name
+ * \param [in] path         path related to base_path
+ * \param [in] resolved_path    buffer for canonicalized absolute pathname
+ * \return
+ *      - \p resolved_path on success
+ *      - NULL on error
+ */
+char *vfs_resolve_path(const char *base_path, const char *path, char *resolved_path);
+
+/**
+ * create directory with all parents
+ *
+ * \param [in] path         path of directory to be created
+ * \param [in] mode     create mode
+ * \return
+ *      - 0 on succes
+ *      - -1 on error
+ */
+int vfs_mkpath(const char *path, mode_t mode);
+
+/**
+ * create directory with all parents of a file
+ *
+ * \param [in] path         path of file
+ * \param [in] mode     create mode
+ * \return
+ *      - 0 on succes
+ *      - -1 on error
+ */
+int vfs_mkfilepath(const char *path, mode_t mode);
+
+/**
+ * helper to get file size
+ *
+ * It calls \p vfs_stat to get file status, and return file size only.
+ *
+ * \param [in] path     file path
+ * \return
+ *      - file size on success
+ *      - -1 on error
+ */
+ssize_t vfs_file_size(const char *path);
+
+/**
+ * helper to read file
+ *
+ * It calls \p vfs_open, \p vfs_read and \p vfs_close to read bytes from file.
+ *
+ * \param [in] path     file path
+ * \param [in] buf      buf for read
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes read on success
+ *      - -1 on error
+ */
+ssize_t vfs_file_read(const char *path, void *buf, size_t count);
+
+/**
+ * helper to write file
+ *
+ * It calls \p vfs_open, \p vfs_write and \p vfs_close to write bytes to file.
+ *
+ * \param [in] path     file path
+ * \param [in] buf      buf for write
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes written on success
+ *      - -1 on error
+ */
+ssize_t vfs_file_write(const char *path, const void *buf, size_t count);
+
+/**
+ * initial check for safe file
+ *
+ * *safe file* is just a normal file, just write is special designed for power
+ * failure safe write. That is, when there is power failure during file write,
+ * the file on file system will either be the original content, or the new
+ * content.
+ *
+ * It is needed to write the whole content in one call. Partial write is not
+ * supported.
+ *
+ * When there is power failure during write, there may exist garbages on file
+ * system. \p vfs_sfile_init will clean up the garbages.
+ *
+ * \param [in] path     safe file path
+ * \return
+ *      - 0 on success
+ *      - -1 if the safe file isn't exist or invalid
+ */
+int vfs_sfile_init(const char *path);
+
+/**
+ * get safe file size
+ *
+ * It is the same as \p vfs_file_size.
+ *
+ * \param [in] path     file path
+ * \return
+ *      - file size on success
+ *      - -1 on error
+ */
+ssize_t vfs_sfile_size(const char *path);
+
+/**
+ * read safe file
+ *
+ * \param [in] path     file path
+ * \param [in] buf      buf for read
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes read on success
+ *      - -1 on error
+ */
+ssize_t vfs_sfile_read(const char *path, void *buf, size_t count);
+
+/**
+ * write safe file
+ *
+ * \param [in] path     file path
+ * \param [in] buf      buf for write
+ * \param [in] count    byte count
+ * \return
+ *      - the number of bytes written on success
+ *      - -1 on error
+ */
+ssize_t vfs_sfile_write(const char *path, const void *buf, size_t count);
+
+/**
+ * delete files and subdirectories under a directory
+ *
+ * \param [in] path     directory path
+ * \return
+ *      - the number of bytes read on success
+ *      - -1 on error
+ */
+int vfs_rmchildren(const char *path);
+
+/**
+ * delete directory and children under the directory
+ *
+ * \param [in] path     directory path
+ * \return
+ *      - the number of bytes read on success
+ *      - -1 on error
+ */
+int vfs_rmdir_recursive(const char *path);
+
+/**
+ * umount all mounted file system
+ *
+ * It should only be called in FDL now. And in application, the
+ * implementation is empty.
+ */
+void vfs_umount_all(void);
+
+/**
+ * fs handle of a path
+ *
+ * It is for debug only, get the file system implementation handler.
+ *
+ * \param [in] path     file path
+ * \return
+ *      - the file system implementation handler
+ */
+void *vfs_fs_handle(const char *path);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // H

BIN=BIN
bsp/air724/sdk/components/lib/lua.img


+ 155 - 0
bsp/air724/sdk/components/net_inc/aes.h

@@ -0,0 +1,155 @@
+/**
+ * \file aes.h
+ *
+ * \brief AES block cipher
+ *
+ *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of mbed TLS (https://tls.mbed.org)
+ */
+#ifndef MBEDTLS_AES_H
+#define MBEDTLS_AES_H
+
+
+#include <stddef.h>
+#include <stdint.h>
+
+
+/* padlock.c and aesni.c rely on these values! */
+#define MBEDTLS_AES_ENCRYPT     1
+#define MBEDTLS_AES_DECRYPT     0
+
+
+#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH                -0x0020  /**< Invalid key length. */
+#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH              -0x0022  /**< Invalid data input length. */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief          AES context structure
+ *
+ * \note           buf is able to hold 32 extra bytes, which can be used:
+ *                 - for alignment purposes if VIA padlock is used, and/or
+ *                 - to simplify key expansion in the 256-bit case by
+ *                 generating an extra round key
+ */
+typedef struct
+{
+    int nr;                     /*!<  number of rounds  */
+    uint32_t *rk;               /*!<  AES round keys    */
+    uint32_t buf[68];           /*!<  unaligned data    */
+}
+mbedtls_aes_context;
+
+/**
+ * \brief          Initialize AES context
+ *
+ * \param ctx      AES context to be initialized
+ */
+void dm_mbedtls_aes_init( mbedtls_aes_context *ctx );
+
+/**
+ * \brief          Clear AES context
+ *
+ * \param ctx      AES context to be cleared
+ */
+void dm_mbedtls_aes_free( mbedtls_aes_context *ctx );
+
+/**
+ * \brief          AES key schedule (encryption)
+ *
+ * \param ctx      AES context to be initialized
+ * \param key      encryption key
+ * \param keybits  must be 128, 192 or 256
+ *
+ * \return         0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
+ */
+int dm_mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const  unsigned char *key,
+                    unsigned int keybits );
+
+/**
+ * \brief          AES key schedule (decryption)
+ *
+ * \param ctx      AES context to be initialized
+ * \param key      decryption key
+ * \param keybits  must be 128, 192 or 256
+ *
+ * \return         0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
+ */
+int dm_mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
+                    unsigned int keybits );
+
+/**
+ * \brief          AES-ECB block encryption/decryption
+ *
+ * \param ctx      AES context
+ * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
+ * \param input    16-byte input block
+ * \param output   16-byte output block
+ *
+ * \return         0 if successful
+ */
+	/*
+	 * AES-CBC buffer encryption/decryption
+	 */
+int dm_mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
+						int mode,
+						size_t length,
+						unsigned char iv[16],
+						const unsigned char *input,
+						unsigned char *output );
+
+
+int dm_mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
+                    int mode,
+                    const unsigned char input[16],
+                    unsigned char output[16] );
+
+/**
+ * \brief           Internal AES block encryption function
+ *                  (Only exposed to allow overriding it,
+ *                  see MBEDTLS_AES_ENCRYPT_ALT)
+ *
+ * \param ctx       AES context
+ * \param input     Plaintext block
+ * \param output    Output (ciphertext) block
+ */
+void dm_mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
+                          const unsigned char input[16],
+                          unsigned char output[16] );
+
+/**
+ * \brief           Internal AES block decryption function
+ *                  (Only exposed to allow overriding it,
+ *                  see MBEDTLS_AES_DECRYPT_ALT)
+ *
+ * \param ctx       AES context
+ * \param input     Ciphertext block
+ * \param output    Output (plaintext) block
+ */
+void dm_mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
+                          const unsigned char input[16],
+                          unsigned char output[16] );
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* aes.h */

+ 693 - 0
bsp/air724/sdk/components/net_inc/check_config.h

@@ -0,0 +1,693 @@
+/**
+ * \file check_config.h
+ *
+ * \brief Consistency checks for configuration options
+ */
+/*
+ *  Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of mbed TLS (https://tls.mbed.org)
+ */
+
+/*
+ * It is recommended to include this file from your config.h
+ * in order to catch dependency issues early.
+ */
+
+#ifndef MBEDTLS_CHECK_CONFIG_H
+#define MBEDTLS_CHECK_CONFIG_H
+
+/*
+ * We assume CHAR_BIT is 8 in many places. In practice, this is true on our
+ * target platforms, so not an issue, but let's just be extra sure.
+ */
+#include <limits.h>
+#if CHAR_BIT != 8
+#error "mbed TLS requires a platform with 8-bit chars"
+#endif
+
+#if defined(_WIN32)
+#if !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_C is required on Windows"
+#endif
+
+/* Fix the config here. Not convenient to put an #ifdef _WIN32 in config.h as
+ * it would confuse config.pl. */
+#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
+    !defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
+#define MBEDTLS_PLATFORM_SNPRINTF_ALT
+#endif
+#endif /* _WIN32 */
+
+#if defined(TARGET_LIKE_MBED) && \
+    ( defined(MBEDTLS_NET_C) || defined(MBEDTLS_TIMING_C) )
+#error "The NET and TIMING modules are not available for mbed OS - please use the network and timing functions provided by mbed OS"
+#endif
+
+#if defined(MBEDTLS_DEPRECATED_WARNING) && \
+    !defined(__GNUC__) && !defined(__clang__)
+#error "MBEDTLS_DEPRECATED_WARNING only works with GCC and Clang"
+#endif
+
+#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_HAVE_TIME)
+#error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense"
+#endif
+
+#if defined(MBEDTLS_AESNI_C) && !defined(MBEDTLS_HAVE_ASM)
+#error "MBEDTLS_AESNI_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
+#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_DHM_C) && !defined(MBEDTLS_BIGNUM_C)
+#error "MBEDTLS_DHM_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
+#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_CMAC_C) && \
+    !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
+#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_NIST_KW_C) && \
+    ( !defined(MBEDTLS_AES_C) || !defined(MBEDTLS_CIPHER_C) )
+#error "MBEDTLS_NIST_KW_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECDH_C) && !defined(MBEDTLS_ECP_C)
+#error "MBEDTLS_ECDH_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECDSA_C) &&            \
+    ( !defined(MBEDTLS_ECP_C) ||           \
+      !defined(MBEDTLS_ASN1_PARSE_C) ||    \
+      !defined(MBEDTLS_ASN1_WRITE_C) )
+#error "MBEDTLS_ECDSA_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECJPAKE_C) &&           \
+    ( !defined(MBEDTLS_ECP_C) || !defined(MBEDTLS_MD_C) )
+#error "MBEDTLS_ECJPAKE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_RESTARTABLE)           && \
+    ( defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT) || \
+      defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)     || \
+      defined(MBEDTLS_ECDSA_SIGN_ALT)          || \
+      defined(MBEDTLS_ECDSA_VERIFY_ALT)        || \
+      defined(MBEDTLS_ECDSA_GENKEY_ALT)        || \
+      defined(MBEDTLS_ECP_ALT) )
+#error "MBEDTLS_ECP_RESTARTABLE defined, but it cannot coexist with an alternative ECP implementation"
+#endif
+
+#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
+#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || (   \
+    !defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)   &&                  \
+    !defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)   &&                  \
+    !defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)   &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) &&                  \
+    !defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) )
+#error "MBEDTLS_ECP_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ENTROPY_C) && (!defined(MBEDTLS_SHA512_C) &&      \
+                                    !defined(MBEDTLS_SHA256_C))
+#error "MBEDTLS_ENTROPY_C defined, but not all prerequisites"
+#endif
+#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_SHA512_C) &&         \
+    defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 64)
+#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
+#endif
+#if defined(MBEDTLS_ENTROPY_C) &&                                            \
+    ( !defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_ENTROPY_FORCE_SHA256) ) \
+    && defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) && (MBEDTLS_CTR_DRBG_ENTROPY_LEN > 32)
+#error "MBEDTLS_CTR_DRBG_ENTROPY_LEN value too high"
+#endif
+#if defined(MBEDTLS_ENTROPY_C) && \
+    defined(MBEDTLS_ENTROPY_FORCE_SHA256) && !defined(MBEDTLS_SHA256_C)
+#error "MBEDTLS_ENTROPY_FORCE_SHA256 defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
+    ( !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) )
+#error "MBEDTLS_TEST_NULL_ENTROPY defined, but not all prerequisites"
+#endif
+#if defined(MBEDTLS_TEST_NULL_ENTROPY) && \
+     ( defined(MBEDTLS_ENTROPY_NV_SEED) || defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
+    defined(MBEDTLS_HAVEGE_C) )
+#error "MBEDTLS_TEST_NULL_ENTROPY defined, but entropy sources too"
+#endif
+
+#if defined(MBEDTLS_GCM_C) && (                                        \
+        !defined(MBEDTLS_AES_C) && !defined(MBEDTLS_CAMELLIA_C) )
+#error "MBEDTLS_GCM_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_RANDOMIZE_JAC_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_ADD_MIXED_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_ADD_MIXED_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_DOUBLE_JAC_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_NORMALIZE_JAC_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_NORMALIZE_JAC_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_RANDOMIZE_MXZ_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ECP_NORMALIZE_MXZ_ALT) && !defined(MBEDTLS_ECP_INTERNAL_ALT)
+#error "MBEDTLS_ECP_NORMALIZE_MXZ_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_HAVEGE_C) && !defined(MBEDTLS_TIMING_C)
+#error "MBEDTLS_HAVEGE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_HKDF_C) && !defined(MBEDTLS_MD_C)
+#error "MBEDTLS_HKDF_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_HMAC_DRBG_C) && !defined(MBEDTLS_MD_C)
+#error "MBEDTLS_HMAC_DRBG_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) &&                 \
+    ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
+#error "MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) &&                 \
+    ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) )
+#error "MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) && !defined(MBEDTLS_DHM_C)
+#error "MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) &&                     \
+    !defined(MBEDTLS_ECDH_C)
+#error "MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) &&                   \
+    ( !defined(MBEDTLS_DHM_C) || !defined(MBEDTLS_RSA_C) ||           \
+      !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
+#error "MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) &&                 \
+    ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_RSA_C) ||          \
+      !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PKCS1_V15) )
+#error "MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) &&                 \
+    ( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) ||          \
+      !defined(MBEDTLS_X509_CRT_PARSE_C) )
+#error "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) &&                   \
+    ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
+      !defined(MBEDTLS_PKCS1_V15) )
+#error "MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) &&                       \
+    ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
+      !defined(MBEDTLS_PKCS1_V15) )
+#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) &&                    \
+    ( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) ||      \
+      !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
+#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) &&                          \
+    ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
+#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PADLOCK_C) && !defined(MBEDTLS_HAVE_ASM)
+#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PEM_PARSE_C) && !defined(MBEDTLS_BASE64_C)
+#error "MBEDTLS_PEM_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PEM_WRITE_C) && !defined(MBEDTLS_BASE64_C)
+#error "MBEDTLS_PEM_WRITE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PK_C) && \
+    ( !defined(MBEDTLS_RSA_C) && !defined(MBEDTLS_ECP_C) )
+#error "MBEDTLS_PK_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C)
+#error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C)
+#error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PKCS11_C) && !defined(MBEDTLS_PK_C)
+#error "MBEDTLS_PKCS11_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_EXIT_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_EXIT) ||\
+        defined(MBEDTLS_PLATFORM_EXIT_ALT) )
+#error "MBEDTLS_PLATFORM_EXIT_MACRO and MBEDTLS_PLATFORM_STD_EXIT/MBEDTLS_PLATFORM_EXIT_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_TIME_ALT) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) ||\
+        !defined(MBEDTLS_HAVE_TIME) )
+#error "MBEDTLS_PLATFORM_TIME_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) ||\
+        !defined(MBEDTLS_HAVE_TIME) )
+#error "MBEDTLS_PLATFORM_TIME_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) ||\
+        !defined(MBEDTLS_HAVE_TIME) )
+#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_TIME_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
+        defined(MBEDTLS_PLATFORM_TIME_ALT) )
+#error "MBEDTLS_PLATFORM_TIME_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_TIME_TYPE_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_TIME) ||\
+        defined(MBEDTLS_PLATFORM_TIME_ALT) )
+#error "MBEDTLS_PLATFORM_TIME_TYPE_MACRO and MBEDTLS_PLATFORM_STD_TIME/MBEDTLS_PLATFORM_TIME_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_FPRINTF) ||\
+        defined(MBEDTLS_PLATFORM_FPRINTF_ALT) )
+#error "MBEDTLS_PLATFORM_FPRINTF_MACRO and MBEDTLS_PLATFORM_STD_FPRINTF/MBEDTLS_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
+#error "MBEDTLS_PLATFORM_FREE_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FREE_MACRO) &&\
+    defined(MBEDTLS_PLATFORM_STD_FREE)
+#error "MBEDTLS_PLATFORM_FREE_MACRO and MBEDTLS_PLATFORM_STD_FREE cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && !defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
+#error "MBEDTLS_PLATFORM_CALLOC_MACRO must be defined if MBEDTLS_PLATFORM_FREE_MACRO is"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
+#error "MBEDTLS_PLATFORM_CALLOC_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) &&\
+    defined(MBEDTLS_PLATFORM_STD_CALLOC)
+#error "MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_STD_CALLOC cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_CALLOC_MACRO) && !defined(MBEDTLS_PLATFORM_FREE_MACRO)
+#error "MBEDTLS_PLATFORM_FREE_MACRO must be defined if MBEDTLS_PLATFORM_CALLOC_MACRO is"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_MEMORY) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_MEMORY defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_PRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_PRINTF) ||\
+        defined(MBEDTLS_PLATFORM_PRINTF_ALT) )
+#error "MBEDTLS_PLATFORM_PRINTF_MACRO and MBEDTLS_PLATFORM_STD_PRINTF/MBEDTLS_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) && !defined(MBEDTLS_PLATFORM_C)
+#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_SNPRINTF) ||\
+        defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) )
+#error "MBEDTLS_PLATFORM_SNPRINTF_MACRO and MBEDTLS_PLATFORM_STD_SNPRINTF/MBEDTLS_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_MEM_HDR) &&\
+    !defined(MBEDTLS_PLATFORM_NO_STD_FUNCTIONS)
+#error "MBEDTLS_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
+#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_CALLOC) && !defined(MBEDTLS_PLATFORM_MEMORY)
+#error "MBEDTLS_PLATFORM_STD_CALLOC defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_FREE) && !defined(MBEDTLS_PLATFORM_MEMORY)
+#error "MBEDTLS_PLATFORM_STD_FREE defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_EXIT) &&\
+    !defined(MBEDTLS_PLATFORM_EXIT_ALT)
+#error "MBEDTLS_PLATFORM_STD_EXIT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_TIME) &&\
+    ( !defined(MBEDTLS_PLATFORM_TIME_ALT) ||\
+        !defined(MBEDTLS_HAVE_TIME) )
+#error "MBEDTLS_PLATFORM_STD_TIME defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_FPRINTF) &&\
+    !defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
+#error "MBEDTLS_PLATFORM_STD_FPRINTF defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_PRINTF) &&\
+    !defined(MBEDTLS_PLATFORM_PRINTF_ALT)
+#error "MBEDTLS_PLATFORM_STD_PRINTF defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_SNPRINTF) &&\
+    !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT)
+#error "MBEDTLS_PLATFORM_STD_SNPRINTF defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_ENTROPY_NV_SEED) &&\
+    ( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_ENTROPY_C) )
+#error "MBEDTLS_ENTROPY_NV_SEED defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_NV_SEED_ALT) &&\
+    !defined(MBEDTLS_ENTROPY_NV_SEED)
+#error "MBEDTLS_PLATFORM_NV_SEED_ALT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) &&\
+    !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
+#error "MBEDTLS_PLATFORM_STD_NV_SEED_READ defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) &&\
+    !defined(MBEDTLS_PLATFORM_NV_SEED_ALT)
+#error "MBEDTLS_PLATFORM_STD_NV_SEED_WRITE defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_READ) ||\
+      defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
+#error "MBEDTLS_PLATFORM_NV_SEED_READ_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_READ cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) &&\
+    ( defined(MBEDTLS_PLATFORM_STD_NV_SEED_WRITE) ||\
+      defined(MBEDTLS_PLATFORM_NV_SEED_ALT) )
+#error "MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_STD_NV_SEED_WRITE cannot be defined simultaneously"
+#endif
+
+#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) ||         \
+    !defined(MBEDTLS_OID_C) )
+#error "MBEDTLS_RSA_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_PKCS1_V21) &&         \
+    !defined(MBEDTLS_PKCS1_V15) )
+#error "MBEDTLS_RSA_C defined, but none of the PKCS1 versions enabled"
+#endif
+
+#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT) &&                        \
+    ( !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_PKCS1_V21) )
+#error "MBEDTLS_X509_RSASSA_PSS_SUPPORT defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_PROTO_SSL3) && ( !defined(MBEDTLS_MD5_C) ||     \
+    !defined(MBEDTLS_SHA1_C) )
+#error "MBEDTLS_SSL_PROTO_SSL3 defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_PROTO_TLS1) && ( !defined(MBEDTLS_MD5_C) ||     \
+    !defined(MBEDTLS_SHA1_C) )
+#error "MBEDTLS_SSL_PROTO_TLS1 defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_PROTO_TLS1_1) && ( !defined(MBEDTLS_MD5_C) ||     \
+    !defined(MBEDTLS_SHA1_C) )
+#error "MBEDTLS_SSL_PROTO_TLS1_1 defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && ( !defined(MBEDTLS_SHA1_C) &&     \
+    !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA512_C) )
+#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_PROTO_DTLS)     && \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_1)  && \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_2)
+#error "MBEDTLS_SSL_PROTO_DTLS defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_CLI_C) && !defined(MBEDTLS_SSL_TLS_C)
+#error "MBEDTLS_SSL_CLI_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_TLS_C) && ( !defined(MBEDTLS_CIPHER_C) ||     \
+    !defined(MBEDTLS_MD_C) )
+#error "MBEDTLS_SSL_TLS_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_SRV_C) && !defined(MBEDTLS_SSL_TLS_C)
+#error "MBEDTLS_SSL_SRV_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_TLS_C) && (!defined(MBEDTLS_SSL_PROTO_SSL3) && \
+    !defined(MBEDTLS_SSL_PROTO_TLS1) && !defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_2))
+#error "MBEDTLS_SSL_TLS_C defined, but no protocols are active"
+#endif
+
+#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
+    defined(MBEDTLS_SSL_PROTO_TLS1_1) && !defined(MBEDTLS_SSL_PROTO_TLS1))
+#error "Illegal protocol selection"
+#endif
+
+#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_TLS1) && \
+    defined(MBEDTLS_SSL_PROTO_TLS1_2) && !defined(MBEDTLS_SSL_PROTO_TLS1_1))
+#error "Illegal protocol selection"
+#endif
+
+#if defined(MBEDTLS_SSL_TLS_C) && (defined(MBEDTLS_SSL_PROTO_SSL3) && \
+    defined(MBEDTLS_SSL_PROTO_TLS1_2) && (!defined(MBEDTLS_SSL_PROTO_TLS1) || \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_1)))
+#error "Illegal protocol selection"
+#endif
+
+#if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) && !defined(MBEDTLS_SSL_PROTO_DTLS)
+#error "MBEDTLS_SSL_DTLS_HELLO_VERIFY  defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) && \
+    !defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY)
+#error "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE  defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) &&                              \
+    ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
+#error "MBEDTLS_SSL_DTLS_ANTI_REPLAY  defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_DTLS_BADMAC_LIMIT) &&                              \
+    ( !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) )
+#error "MBEDTLS_SSL_DTLS_BADMAC_LIMIT  defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) &&   \
+    !defined(MBEDTLS_SSL_PROTO_TLS1)   &&      \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_1) &&      \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_2)
+#error "MBEDTLS_SSL_ENCRYPT_THEN_MAC defined, but not all prerequsites"
+#endif
+
+#if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) && \
+    !defined(MBEDTLS_SSL_PROTO_TLS1)   &&          \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_1) &&          \
+    !defined(MBEDTLS_SSL_PROTO_TLS1_2)
+#error "MBEDTLS_SSL_EXTENDED_MASTER_SECRET defined, but not all prerequsites"
+#endif
+
+#if defined(MBEDTLS_SSL_TICKET_C) && !defined(MBEDTLS_CIPHER_C)
+#error "MBEDTLS_SSL_TICKET_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_CBC_RECORD_SPLITTING) && \
+    !defined(MBEDTLS_SSL_PROTO_SSL3) && !defined(MBEDTLS_SSL_PROTO_TLS1)
+#error "MBEDTLS_SSL_CBC_RECORD_SPLITTING defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) && \
+        !defined(MBEDTLS_X509_CRT_PARSE_C)
+#error "MBEDTLS_SSL_SERVER_NAME_INDICATION defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_THREADING_PTHREAD)
+#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
+#error "MBEDTLS_THREADING_PTHREAD defined, but not all prerequisites"
+#endif
+#define MBEDTLS_THREADING_IMPL
+#endif
+
+#if defined(MBEDTLS_THREADING_ALT)
+#if !defined(MBEDTLS_THREADING_C) || defined(MBEDTLS_THREADING_IMPL)
+#error "MBEDTLS_THREADING_ALT defined, but not all prerequisites"
+#endif
+#define MBEDTLS_THREADING_IMPL
+#endif
+
+#if defined(MBEDTLS_THREADING_C) && !defined(MBEDTLS_THREADING_IMPL)
+#error "MBEDTLS_THREADING_C defined, single threading implementation required"
+#endif
+#undef MBEDTLS_THREADING_IMPL
+
+#if defined(MBEDTLS_VERSION_FEATURES) && !defined(MBEDTLS_VERSION_C)
+#error "MBEDTLS_VERSION_FEATURES defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_USE_C) && ( !defined(MBEDTLS_BIGNUM_C) ||  \
+    !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_PARSE_C) ||      \
+    !defined(MBEDTLS_PK_PARSE_C) )
+#error "MBEDTLS_X509_USE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CREATE_C) && ( !defined(MBEDTLS_BIGNUM_C) ||  \
+    !defined(MBEDTLS_OID_C) || !defined(MBEDTLS_ASN1_WRITE_C) ||       \
+    !defined(MBEDTLS_PK_WRITE_C) )
+#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
+#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CRL_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
+#error "MBEDTLS_X509_CRL_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CSR_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
+#error "MBEDTLS_X509_CSR_PARSE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CRT_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
+#error "MBEDTLS_X509_CRT_WRITE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_X509_CSR_WRITE_C) && ( !defined(MBEDTLS_X509_CREATE_C) )
+#error "MBEDTLS_X509_CSR_WRITE_C defined, but not all prerequisites"
+#endif
+
+#if defined(MBEDTLS_HAVE_INT32) && defined(MBEDTLS_HAVE_INT64)
+#error "MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 cannot be defined simultaneously"
+#endif /* MBEDTLS_HAVE_INT32 && MBEDTLS_HAVE_INT64 */
+
+#if ( defined(MBEDTLS_HAVE_INT32) || defined(MBEDTLS_HAVE_INT64) ) && \
+    defined(MBEDTLS_HAVE_ASM)
+#error "MBEDTLS_HAVE_INT32/MBEDTLS_HAVE_INT64 and MBEDTLS_HAVE_ASM cannot be defined simultaneously"
+#endif /* (MBEDTLS_HAVE_INT32 || MBEDTLS_HAVE_INT64) && MBEDTLS_HAVE_ASM */
+
+/*
+ * Avoid warning from -pedantic. This is a convenient place for this
+ * workaround since this is included by every single file before the
+ * #if defined(MBEDTLS_xxx_C) that results in emtpy translation units.
+ */
+typedef int mbedtls_iso_c_forbids_empty_translation_units;
+
+#endif /* MBEDTLS_CHECK_CONFIG_H */

+ 2529 - 0
bsp/air724/sdk/components/net_inc/compat-1.3.h

@@ -0,0 +1,2529 @@
+/**
+ * \file compat-1.3.h
+ *
+ * \brief Compatibility definitions for using mbed TLS with client code written
+ *  for the PolarSSL naming conventions.
+ *
+ * \deprecated Use the new names directly instead
+ */
+/*
+ *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of mbed TLS (https://tls.mbed.org)
+ */
+
+#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
+
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#warning "Including compat-1.3.h is deprecated"
+#endif
+
+#ifndef MBEDTLS_COMPAT13_H
+#define MBEDTLS_COMPAT13_H
+
+/*
+ * config.h options
+ */
+#if defined MBEDTLS_AESNI_C
+#define POLARSSL_AESNI_C MBEDTLS_AESNI_C
+#endif
+#if defined MBEDTLS_AES_ALT
+#define POLARSSL_AES_ALT MBEDTLS_AES_ALT
+#endif
+#if defined MBEDTLS_AES_C
+#define POLARSSL_AES_C MBEDTLS_AES_C
+#endif
+#if defined MBEDTLS_AES_ROM_TABLES
+#define POLARSSL_AES_ROM_TABLES MBEDTLS_AES_ROM_TABLES
+#endif
+#if defined MBEDTLS_ARC4_ALT
+#define POLARSSL_ARC4_ALT MBEDTLS_ARC4_ALT
+#endif
+#if defined MBEDTLS_ARC4_C
+#define POLARSSL_ARC4_C MBEDTLS_ARC4_C
+#endif
+#if defined MBEDTLS_ASN1_PARSE_C
+#define POLARSSL_ASN1_PARSE_C MBEDTLS_ASN1_PARSE_C
+#endif
+#if defined MBEDTLS_ASN1_WRITE_C
+#define POLARSSL_ASN1_WRITE_C MBEDTLS_ASN1_WRITE_C
+#endif
+#if defined MBEDTLS_BASE64_C
+#define POLARSSL_BASE64_C MBEDTLS_BASE64_C
+#endif
+#if defined MBEDTLS_BIGNUM_C
+#define POLARSSL_BIGNUM_C MBEDTLS_BIGNUM_C
+#endif
+#if defined MBEDTLS_BLOWFISH_ALT
+#define POLARSSL_BLOWFISH_ALT MBEDTLS_BLOWFISH_ALT
+#endif
+#if defined MBEDTLS_BLOWFISH_C
+#define POLARSSL_BLOWFISH_C MBEDTLS_BLOWFISH_C
+#endif
+#if defined MBEDTLS_CAMELLIA_ALT
+#define POLARSSL_CAMELLIA_ALT MBEDTLS_CAMELLIA_ALT
+#endif
+#if defined MBEDTLS_CAMELLIA_C
+#define POLARSSL_CAMELLIA_C MBEDTLS_CAMELLIA_C
+#endif
+#if defined MBEDTLS_CAMELLIA_SMALL_MEMORY
+#define POLARSSL_CAMELLIA_SMALL_MEMORY MBEDTLS_CAMELLIA_SMALL_MEMORY
+#endif
+#if defined MBEDTLS_CCM_C
+#define POLARSSL_CCM_C MBEDTLS_CCM_C
+#endif
+#if defined MBEDTLS_CERTS_C
+#define POLARSSL_CERTS_C MBEDTLS_CERTS_C
+#endif
+#if defined MBEDTLS_CIPHER_C
+#define POLARSSL_CIPHER_C MBEDTLS_CIPHER_C
+#endif
+#if defined MBEDTLS_CIPHER_MODE_CBC
+#define POLARSSL_CIPHER_MODE_CBC MBEDTLS_CIPHER_MODE_CBC
+#endif
+#if defined MBEDTLS_CIPHER_MODE_CFB
+#define POLARSSL_CIPHER_MODE_CFB MBEDTLS_CIPHER_MODE_CFB
+#endif
+#if defined MBEDTLS_CIPHER_MODE_CTR
+#define POLARSSL_CIPHER_MODE_CTR MBEDTLS_CIPHER_MODE_CTR
+#endif
+#if defined MBEDTLS_CIPHER_NULL_CIPHER
+#define POLARSSL_CIPHER_NULL_CIPHER MBEDTLS_CIPHER_NULL_CIPHER
+#endif
+#if defined MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
+#define POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
+#endif
+#if defined MBEDTLS_CIPHER_PADDING_PKCS7
+#define POLARSSL_CIPHER_PADDING_PKCS7 MBEDTLS_CIPHER_PADDING_PKCS7
+#endif
+#if defined MBEDTLS_CIPHER_PADDING_ZEROS
+#define POLARSSL_CIPHER_PADDING_ZEROS MBEDTLS_CIPHER_PADDING_ZEROS
+#endif
+#if defined MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
+#define POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
+#endif
+#if defined MBEDTLS_CTR_DRBG_C
+#define POLARSSL_CTR_DRBG_C MBEDTLS_CTR_DRBG_C
+#endif
+#if defined MBEDTLS_DEBUG_C
+#define POLARSSL_DEBUG_C MBEDTLS_DEBUG_C
+#endif
+#if defined MBEDTLS_DEPRECATED_REMOVED
+#define POLARSSL_DEPRECATED_REMOVED MBEDTLS_DEPRECATED_REMOVED
+#endif
+#if defined MBEDTLS_DEPRECATED_WARNING
+#define POLARSSL_DEPRECATED_WARNING MBEDTLS_DEPRECATED_WARNING
+#endif
+#if defined MBEDTLS_DES_ALT
+#define POLARSSL_DES_ALT MBEDTLS_DES_ALT
+#endif
+#if defined MBEDTLS_DES_C
+#define POLARSSL_DES_C MBEDTLS_DES_C
+#endif
+#if defined MBEDTLS_DHM_C
+#define POLARSSL_DHM_C MBEDTLS_DHM_C
+#endif
+#if defined MBEDTLS_ECDH_C
+#define POLARSSL_ECDH_C MBEDTLS_ECDH_C
+#endif
+#if defined MBEDTLS_ECDSA_C
+#define POLARSSL_ECDSA_C MBEDTLS_ECDSA_C
+#endif
+#if defined MBEDTLS_ECDSA_DETERMINISTIC
+#define POLARSSL_ECDSA_DETERMINISTIC MBEDTLS_ECDSA_DETERMINISTIC
+#endif
+#if defined MBEDTLS_ECP_C
+#define POLARSSL_ECP_C MBEDTLS_ECP_C
+#endif
+#if defined MBEDTLS_ECP_DP_BP256R1_ENABLED
+#define POLARSSL_ECP_DP_BP256R1_ENABLED MBEDTLS_ECP_DP_BP256R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_BP384R1_ENABLED
+#define POLARSSL_ECP_DP_BP384R1_ENABLED MBEDTLS_ECP_DP_BP384R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_BP512R1_ENABLED
+#define POLARSSL_ECP_DP_BP512R1_ENABLED MBEDTLS_ECP_DP_BP512R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_CURVE25519_ENABLED
+#define POLARSSL_ECP_DP_M255_ENABLED MBEDTLS_ECP_DP_CURVE25519_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP192K1_ENABLED
+#define POLARSSL_ECP_DP_SECP192K1_ENABLED MBEDTLS_ECP_DP_SECP192K1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP192R1_ENABLED
+#define POLARSSL_ECP_DP_SECP192R1_ENABLED MBEDTLS_ECP_DP_SECP192R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP224K1_ENABLED
+#define POLARSSL_ECP_DP_SECP224K1_ENABLED MBEDTLS_ECP_DP_SECP224K1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP224R1_ENABLED
+#define POLARSSL_ECP_DP_SECP224R1_ENABLED MBEDTLS_ECP_DP_SECP224R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP256K1_ENABLED
+#define POLARSSL_ECP_DP_SECP256K1_ENABLED MBEDTLS_ECP_DP_SECP256K1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP256R1_ENABLED
+#define POLARSSL_ECP_DP_SECP256R1_ENABLED MBEDTLS_ECP_DP_SECP256R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP384R1_ENABLED
+#define POLARSSL_ECP_DP_SECP384R1_ENABLED MBEDTLS_ECP_DP_SECP384R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_DP_SECP521R1_ENABLED
+#define POLARSSL_ECP_DP_SECP521R1_ENABLED MBEDTLS_ECP_DP_SECP521R1_ENABLED
+#endif
+#if defined MBEDTLS_ECP_FIXED_POINT_OPTIM
+#define POLARSSL_ECP_FIXED_POINT_OPTIM MBEDTLS_ECP_FIXED_POINT_OPTIM
+#endif
+#if defined MBEDTLS_ECP_MAX_BITS
+#define POLARSSL_ECP_MAX_BITS MBEDTLS_ECP_MAX_BITS
+#endif
+#if defined MBEDTLS_ECP_NIST_OPTIM
+#define POLARSSL_ECP_NIST_OPTIM MBEDTLS_ECP_NIST_OPTIM
+#endif
+#if defined MBEDTLS_ECP_WINDOW_SIZE
+#define POLARSSL_ECP_WINDOW_SIZE MBEDTLS_ECP_WINDOW_SIZE
+#endif
+#if defined MBEDTLS_ENABLE_WEAK_CIPHERSUITES
+#define POLARSSL_ENABLE_WEAK_CIPHERSUITES MBEDTLS_ENABLE_WEAK_CIPHERSUITES
+#endif
+#if defined MBEDTLS_ENTROPY_C
+#define POLARSSL_ENTROPY_C MBEDTLS_ENTROPY_C
+#endif
+#if defined MBEDTLS_ENTROPY_FORCE_SHA256
+#define POLARSSL_ENTROPY_FORCE_SHA256 MBEDTLS_ENTROPY_FORCE_SHA256
+#endif
+#if defined MBEDTLS_ERROR_C
+#define POLARSSL_ERROR_C MBEDTLS_ERROR_C
+#endif
+#if defined MBEDTLS_ERROR_STRERROR_DUMMY
+#define POLARSSL_ERROR_STRERROR_DUMMY MBEDTLS_ERROR_STRERROR_DUMMY
+#endif
+#if defined MBEDTLS_FS_IO
+#define POLARSSL_FS_IO MBEDTLS_FS_IO
+#endif
+#if defined MBEDTLS_GCM_C
+#define POLARSSL_GCM_C MBEDTLS_GCM_C
+#endif
+#if defined MBEDTLS_GENPRIME
+#define POLARSSL_GENPRIME MBEDTLS_GENPRIME
+#endif
+#if defined MBEDTLS_HAVEGE_C
+#define POLARSSL_HAVEGE_C MBEDTLS_HAVEGE_C
+#endif
+#if defined MBEDTLS_HAVE_ASM
+#define POLARSSL_HAVE_ASM MBEDTLS_HAVE_ASM
+#endif
+#if defined MBEDTLS_HAVE_SSE2
+#define POLARSSL_HAVE_SSE2 MBEDTLS_HAVE_SSE2
+#endif
+#if defined MBEDTLS_HAVE_TIME
+#define POLARSSL_HAVE_TIME MBEDTLS_HAVE_TIME
+#endif
+#if defined MBEDTLS_HMAC_DRBG_C
+#define POLARSSL_HMAC_DRBG_C MBEDTLS_HMAC_DRBG_C
+#endif
+#if defined MBEDTLS_HMAC_DRBG_MAX_INPUT
+#define POLARSSL_HMAC_DRBG_MAX_INPUT MBEDTLS_HMAC_DRBG_MAX_INPUT
+#endif
+#if defined MBEDTLS_HMAC_DRBG_MAX_REQUEST
+#define POLARSSL_HMAC_DRBG_MAX_REQUEST MBEDTLS_HMAC_DRBG_MAX_REQUEST
+#endif
+#if defined MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT
+#define POLARSSL_HMAC_DRBG_MAX_SEED_INPUT MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT
+#endif
+#if defined MBEDTLS_HMAC_DRBG_RESEED_INTERVAL
+#define POLARSSL_HMAC_DRBG_RESEED_INTERVAL MBEDTLS_HMAC_DRBG_RESEED_INTERVAL
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
+#define POLARSSL_KEY_EXCHANGE_DHE_PSK_ENABLED MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_DHE_RSA_ENABLED MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
+#define POLARSSL_KEY_EXCHANGE_ECDHE_PSK_ENABLED MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_ECDHE_RSA_ENABLED MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_ECDH_ECDSA_ENABLED MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_ECDH_RSA_ENABLED MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
+#define POLARSSL_KEY_EXCHANGE_PSK_ENABLED MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
+#define POLARSSL_KEY_EXCHANGE_RSA_ENABLED MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
+#endif
+#if defined MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
+#define POLARSSL_KEY_EXCHANGE_RSA_PSK_ENABLED MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
+#endif
+#if defined MBEDTLS_MD2_ALT
+#define POLARSSL_MD2_ALT MBEDTLS_MD2_ALT
+#endif
+#if defined MBEDTLS_MD2_C
+#define POLARSSL_MD2_C MBEDTLS_MD2_C
+#endif
+#if defined MBEDTLS_MD2_PROCESS_ALT
+#define POLARSSL_MD2_PROCESS_ALT MBEDTLS_MD2_PROCESS_ALT
+#endif
+#if defined MBEDTLS_MD4_ALT
+#define POLARSSL_MD4_ALT MBEDTLS_MD4_ALT
+#endif
+#if defined MBEDTLS_MD4_C
+#define POLARSSL_MD4_C MBEDTLS_MD4_C
+#endif
+#if defined MBEDTLS_MD4_PROCESS_ALT
+#define POLARSSL_MD4_PROCESS_ALT MBEDTLS_MD4_PROCESS_ALT
+#endif
+#if defined MBEDTLS_MD5_ALT
+#define POLARSSL_MD5_ALT MBEDTLS_MD5_ALT
+#endif
+#if defined MBEDTLS_MD5_C
+#define POLARSSL_MD5_C MBEDTLS_MD5_C
+#endif
+#if defined MBEDTLS_MD5_PROCESS_ALT
+#define POLARSSL_MD5_PROCESS_ALT MBEDTLS_MD5_PROCESS_ALT
+#endif
+#if defined MBEDTLS_MD_C
+#define POLARSSL_MD_C MBEDTLS_MD_C
+#endif
+#if defined MBEDTLS_MEMORY_ALIGN_MULTIPLE
+#define POLARSSL_MEMORY_ALIGN_MULTIPLE MBEDTLS_MEMORY_ALIGN_MULTIPLE
+#endif
+#if defined MBEDTLS_MEMORY_BACKTRACE
+#define POLARSSL_MEMORY_BACKTRACE MBEDTLS_MEMORY_BACKTRACE
+#endif
+#if defined MBEDTLS_MEMORY_BUFFER_ALLOC_C
+#define POLARSSL_MEMORY_BUFFER_ALLOC_C MBEDTLS_MEMORY_BUFFER_ALLOC_C
+#endif
+#if defined MBEDTLS_MEMORY_DEBUG
+#define POLARSSL_MEMORY_DEBUG MBEDTLS_MEMORY_DEBUG
+#endif
+#if defined MBEDTLS_MPI_MAX_SIZE
+#define POLARSSL_MPI_MAX_SIZE MBEDTLS_MPI_MAX_SIZE
+#endif
+#if defined MBEDTLS_MPI_WINDOW_SIZE
+#define POLARSSL_MPI_WINDOW_SIZE MBEDTLS_MPI_WINDOW_SIZE
+#endif
+#if defined MBEDTLS_NET_C
+#define POLARSSL_NET_C MBEDTLS_NET_C
+#endif
+#if defined MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
+#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
+#endif
+#if defined MBEDTLS_NO_PLATFORM_ENTROPY
+#define POLARSSL_NO_PLATFORM_ENTROPY MBEDTLS_NO_PLATFORM_ENTROPY
+#endif
+#if defined MBEDTLS_OID_C
+#define POLARSSL_OID_C MBEDTLS_OID_C
+#endif
+#if defined MBEDTLS_PADLOCK_C
+#define POLARSSL_PADLOCK_C MBEDTLS_PADLOCK_C
+#endif
+#if defined MBEDTLS_PEM_PARSE_C
+#define POLARSSL_PEM_PARSE_C MBEDTLS_PEM_PARSE_C
+#endif
+#if defined MBEDTLS_PEM_WRITE_C
+#define POLARSSL_PEM_WRITE_C MBEDTLS_PEM_WRITE_C
+#endif
+#if defined MBEDTLS_PKCS11_C
+#define POLARSSL_PKCS11_C MBEDTLS_PKCS11_C
+#endif
+#if defined MBEDTLS_PKCS12_C
+#define POLARSSL_PKCS12_C MBEDTLS_PKCS12_C
+#endif
+#if defined MBEDTLS_PKCS1_V15
+#define POLARSSL_PKCS1_V15 MBEDTLS_PKCS1_V15
+#endif
+#if defined MBEDTLS_PKCS1_V21
+#define POLARSSL_PKCS1_V21 MBEDTLS_PKCS1_V21
+#endif
+#if defined MBEDTLS_PKCS5_C
+#define POLARSSL_PKCS5_C MBEDTLS_PKCS5_C
+#endif
+#if defined MBEDTLS_PK_C
+#define POLARSSL_PK_C MBEDTLS_PK_C
+#endif
+#if defined MBEDTLS_PK_PARSE_C
+#define POLARSSL_PK_PARSE_C MBEDTLS_PK_PARSE_C
+#endif
+#if defined MBEDTLS_PK_PARSE_EC_EXTENDED
+#define POLARSSL_PK_PARSE_EC_EXTENDED MBEDTLS_PK_PARSE_EC_EXTENDED
+#endif
+#if defined MBEDTLS_PK_RSA_ALT_SUPPORT
+#define POLARSSL_PK_RSA_ALT_SUPPORT MBEDTLS_PK_RSA_ALT_SUPPORT
+#endif
+#if defined MBEDTLS_PK_WRITE_C
+#define POLARSSL_PK_WRITE_C MBEDTLS_PK_WRITE_C
+#endif
+#if defined MBEDTLS_PLATFORM_C
+#define POLARSSL_PLATFORM_C MBEDTLS_PLATFORM_C
+#endif
+#if defined MBEDTLS_PLATFORM_EXIT_ALT
+#define POLARSSL_PLATFORM_EXIT_ALT MBEDTLS_PLATFORM_EXIT_ALT
+#endif
+#if defined MBEDTLS_PLATFORM_EXIT_MACRO
+#define POLARSSL_PLATFORM_EXIT_MACRO MBEDTLS_PLATFORM_EXIT_MACRO
+#endif
+#if defined MBEDTLS_PLATFORM_FPRINTF_ALT
+#define POLARSSL_PLATFORM_FPRINTF_ALT MBEDTLS_PLATFORM_FPRINTF_ALT
+#endif
+#if defined MBEDTLS_PLATFORM_FPRINTF_MACRO
+#define POLARSSL_PLATFORM_FPRINTF_MACRO MBEDTLS_PLATFORM_FPRINTF_MACRO
+#endif
+#if defined MBEDTLS_PLATFORM_FREE_MACRO
+#define POLARSSL_PLATFORM_FREE_MACRO MBEDTLS_PLATFORM_FREE_MACRO
+#endif
+#if defined MBEDTLS_PLATFORM_MEMORY
+#define POLARSSL_PLATFORM_MEMORY MBEDTLS_PLATFORM_MEMORY
+#endif
+#if defined MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
+#define POLARSSL_PLATFORM_NO_STD_FUNCTIONS MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
+#endif
+#if defined MBEDTLS_PLATFORM_PRINTF_ALT
+#define POLARSSL_PLATFORM_PRINTF_ALT MBEDTLS_PLATFORM_PRINTF_ALT
+#endif
+#if defined MBEDTLS_PLATFORM_PRINTF_MACRO
+#define POLARSSL_PLATFORM_PRINTF_MACRO MBEDTLS_PLATFORM_PRINTF_MACRO
+#endif
+#if defined MBEDTLS_PLATFORM_SNPRINTF_ALT
+#define POLARSSL_PLATFORM_SNPRINTF_ALT MBEDTLS_PLATFORM_SNPRINTF_ALT
+#endif
+#if defined MBEDTLS_PLATFORM_SNPRINTF_MACRO
+#define POLARSSL_PLATFORM_SNPRINTF_MACRO MBEDTLS_PLATFORM_SNPRINTF_MACRO
+#endif
+#if defined MBEDTLS_PLATFORM_STD_EXIT
+#define POLARSSL_PLATFORM_STD_EXIT MBEDTLS_PLATFORM_STD_EXIT
+#endif
+#if defined MBEDTLS_PLATFORM_STD_FPRINTF
+#define POLARSSL_PLATFORM_STD_FPRINTF MBEDTLS_PLATFORM_STD_FPRINTF
+#endif
+#if defined MBEDTLS_PLATFORM_STD_FREE
+#define POLARSSL_PLATFORM_STD_FREE MBEDTLS_PLATFORM_STD_FREE
+#endif
+#if defined MBEDTLS_PLATFORM_STD_MEM_HDR
+#define POLARSSL_PLATFORM_STD_MEM_HDR MBEDTLS_PLATFORM_STD_MEM_HDR
+#endif
+#if defined MBEDTLS_PLATFORM_STD_PRINTF
+#define POLARSSL_PLATFORM_STD_PRINTF MBEDTLS_PLATFORM_STD_PRINTF
+#endif
+#if defined MBEDTLS_PLATFORM_STD_SNPRINTF
+#define POLARSSL_PLATFORM_STD_SNPRINTF MBEDTLS_PLATFORM_STD_SNPRINTF
+#endif
+#if defined MBEDTLS_PSK_MAX_LEN
+#define POLARSSL_PSK_MAX_LEN MBEDTLS_PSK_MAX_LEN
+#endif
+#if defined MBEDTLS_REMOVE_ARC4_CIPHERSUITES
+#define POLARSSL_REMOVE_ARC4_CIPHERSUITES MBEDTLS_REMOVE_ARC4_CIPHERSUITES
+#endif
+#if defined MBEDTLS_RIPEMD160_ALT
+#define POLARSSL_RIPEMD160_ALT MBEDTLS_RIPEMD160_ALT
+#endif
+#if defined MBEDTLS_RIPEMD160_C
+#define POLARSSL_RIPEMD160_C MBEDTLS_RIPEMD160_C
+#endif
+#if defined MBEDTLS_RIPEMD160_PROCESS_ALT
+#define POLARSSL_RIPEMD160_PROCESS_ALT MBEDTLS_RIPEMD160_PROCESS_ALT
+#endif
+#if defined MBEDTLS_RSA_C
+#define POLARSSL_RSA_C MBEDTLS_RSA_C
+#endif
+#if defined MBEDTLS_RSA_NO_CRT
+#define POLARSSL_RSA_NO_CRT MBEDTLS_RSA_NO_CRT
+#endif
+#if defined MBEDTLS_SELF_TEST
+#define POLARSSL_SELF_TEST MBEDTLS_SELF_TEST
+#endif
+#if defined MBEDTLS_SHA1_ALT
+#define POLARSSL_SHA1_ALT MBEDTLS_SHA1_ALT
+#endif
+#if defined MBEDTLS_SHA1_C
+#define POLARSSL_SHA1_C MBEDTLS_SHA1_C
+#endif
+#if defined MBEDTLS_SHA1_PROCESS_ALT
+#define POLARSSL_SHA1_PROCESS_ALT MBEDTLS_SHA1_PROCESS_ALT
+#endif
+#if defined MBEDTLS_SHA256_ALT
+#define POLARSSL_SHA256_ALT MBEDTLS_SHA256_ALT
+#endif
+#if defined MBEDTLS_SHA256_C
+#define POLARSSL_SHA256_C MBEDTLS_SHA256_C
+#endif
+#if defined MBEDTLS_SHA256_PROCESS_ALT
+#define POLARSSL_SHA256_PROCESS_ALT MBEDTLS_SHA256_PROCESS_ALT
+#endif
+#if defined MBEDTLS_SHA512_ALT
+#define POLARSSL_SHA512_ALT MBEDTLS_SHA512_ALT
+#endif
+#if defined MBEDTLS_SHA512_C
+#define POLARSSL_SHA512_C MBEDTLS_SHA512_C
+#endif
+#if defined MBEDTLS_SHA512_PROCESS_ALT
+#define POLARSSL_SHA512_PROCESS_ALT MBEDTLS_SHA512_PROCESS_ALT
+#endif
+#if defined MBEDTLS_SSL_ALL_ALERT_MESSAGES
+#define POLARSSL_SSL_ALL_ALERT_MESSAGES MBEDTLS_SSL_ALL_ALERT_MESSAGES
+#endif
+#if defined MBEDTLS_SSL_ALPN
+#define POLARSSL_SSL_ALPN MBEDTLS_SSL_ALPN
+#endif
+#if defined MBEDTLS_SSL_CACHE_C
+#define POLARSSL_SSL_CACHE_C MBEDTLS_SSL_CACHE_C
+#endif
+#if defined MBEDTLS_SSL_CBC_RECORD_SPLITTING
+#define POLARSSL_SSL_CBC_RECORD_SPLITTING MBEDTLS_SSL_CBC_RECORD_SPLITTING
+#endif
+#if defined MBEDTLS_SSL_CLI_C
+#define POLARSSL_SSL_CLI_C MBEDTLS_SSL_CLI_C
+#endif
+#if defined MBEDTLS_SSL_COOKIE_C
+#define POLARSSL_SSL_COOKIE_C MBEDTLS_SSL_COOKIE_C
+#endif
+#if defined MBEDTLS_SSL_COOKIE_TIMEOUT
+#define POLARSSL_SSL_COOKIE_TIMEOUT MBEDTLS_SSL_COOKIE_TIMEOUT
+#endif
+#if defined MBEDTLS_SSL_DEBUG_ALL
+#define POLARSSL_SSL_DEBUG_ALL MBEDTLS_SSL_DEBUG_ALL
+#endif
+#if defined MBEDTLS_SSL_DTLS_ANTI_REPLAY
+#define POLARSSL_SSL_DTLS_ANTI_REPLAY MBEDTLS_SSL_DTLS_ANTI_REPLAY
+#endif
+#if defined MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+#define POLARSSL_SSL_DTLS_BADMAC_LIMIT MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+#endif
+#if defined MBEDTLS_SSL_DTLS_HELLO_VERIFY
+#define POLARSSL_SSL_DTLS_HELLO_VERIFY MBEDTLS_SSL_DTLS_HELLO_VERIFY
+#endif
+#if defined MBEDTLS_SSL_ENCRYPT_THEN_MAC
+#define POLARSSL_SSL_ENCRYPT_THEN_MAC MBEDTLS_SSL_ENCRYPT_THEN_MAC
+#endif
+#if defined MBEDTLS_SSL_EXTENDED_MASTER_SECRET
+#define POLARSSL_SSL_EXTENDED_MASTER_SECRET MBEDTLS_SSL_EXTENDED_MASTER_SECRET
+#endif
+#if defined MBEDTLS_SSL_FALLBACK_SCSV
+#define POLARSSL_SSL_FALLBACK_SCSV MBEDTLS_SSL_FALLBACK_SCSV
+#endif
+#if defined MBEDTLS_SSL_HW_RECORD_ACCEL
+#define POLARSSL_SSL_HW_RECORD_ACCEL MBEDTLS_SSL_HW_RECORD_ACCEL
+#endif
+#if defined MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
+#define POLARSSL_SSL_MAX_FRAGMENT_LENGTH MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
+#endif
+#if defined MBEDTLS_SSL_PROTO_DTLS
+#define POLARSSL_SSL_PROTO_DTLS MBEDTLS_SSL_PROTO_DTLS
+#endif
+#if defined MBEDTLS_SSL_PROTO_SSL3
+#define POLARSSL_SSL_PROTO_SSL3 MBEDTLS_SSL_PROTO_SSL3
+#endif
+#if defined MBEDTLS_SSL_PROTO_TLS1
+#define POLARSSL_SSL_PROTO_TLS1 MBEDTLS_SSL_PROTO_TLS1
+#endif
+#if defined MBEDTLS_SSL_PROTO_TLS1_1
+#define POLARSSL_SSL_PROTO_TLS1_1 MBEDTLS_SSL_PROTO_TLS1_1
+#endif
+#if defined MBEDTLS_SSL_PROTO_TLS1_2
+#define POLARSSL_SSL_PROTO_TLS1_2 MBEDTLS_SSL_PROTO_TLS1_2
+#endif
+#if defined MBEDTLS_SSL_RENEGOTIATION
+#define POLARSSL_SSL_RENEGOTIATION MBEDTLS_SSL_RENEGOTIATION
+#endif
+#if defined MBEDTLS_SSL_SERVER_NAME_INDICATION
+#define POLARSSL_SSL_SERVER_NAME_INDICATION MBEDTLS_SSL_SERVER_NAME_INDICATION
+#endif
+#if defined MBEDTLS_SSL_SESSION_TICKETS
+#define POLARSSL_SSL_SESSION_TICKETS MBEDTLS_SSL_SESSION_TICKETS
+#endif
+#if defined MBEDTLS_SSL_SRV_C
+#define POLARSSL_SSL_SRV_C MBEDTLS_SSL_SRV_C
+#endif
+#if defined MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
+#define POLARSSL_SSL_SRV_RESPECT_CLIENT_PREFERENCE MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
+#endif
+#if defined MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
+#define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
+#endif
+#if defined MBEDTLS_SSL_TLS_C
+#define POLARSSL_SSL_TLS_C MBEDTLS_SSL_TLS_C
+#endif
+#if defined MBEDTLS_SSL_TRUNCATED_HMAC
+#define POLARSSL_SSL_TRUNCATED_HMAC MBEDTLS_SSL_TRUNCATED_HMAC
+#endif
+#if defined MBEDTLS_THREADING_ALT
+#define POLARSSL_THREADING_ALT MBEDTLS_THREADING_ALT
+#endif
+#if defined MBEDTLS_THREADING_C
+#define POLARSSL_THREADING_C MBEDTLS_THREADING_C
+#endif
+#if defined MBEDTLS_THREADING_PTHREAD
+#define POLARSSL_THREADING_PTHREAD MBEDTLS_THREADING_PTHREAD
+#endif
+#if defined MBEDTLS_TIMING_ALT
+#define POLARSSL_TIMING_ALT MBEDTLS_TIMING_ALT
+#endif
+#if defined MBEDTLS_TIMING_C
+#define POLARSSL_TIMING_C MBEDTLS_TIMING_C
+#endif
+#if defined MBEDTLS_VERSION_C
+#define POLARSSL_VERSION_C MBEDTLS_VERSION_C
+#endif
+#if defined MBEDTLS_VERSION_FEATURES
+#define POLARSSL_VERSION_FEATURES MBEDTLS_VERSION_FEATURES
+#endif
+#if defined MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
+#define POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3 MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
+#endif
+#if defined MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
+#define POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
+#endif
+#if defined MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
+#define POLARSSL_X509_CHECK_EXTENDED_KEY_USAGE MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
+#endif
+#if defined MBEDTLS_X509_CHECK_KEY_USAGE
+#define POLARSSL_X509_CHECK_KEY_USAGE MBEDTLS_X509_CHECK_KEY_USAGE
+#endif
+#if defined MBEDTLS_X509_CREATE_C
+#define POLARSSL_X509_CREATE_C MBEDTLS_X509_CREATE_C
+#endif
+#if defined MBEDTLS_X509_CRL_PARSE_C
+#define POLARSSL_X509_CRL_PARSE_C MBEDTLS_X509_CRL_PARSE_C
+#endif
+#if defined MBEDTLS_X509_CRT_PARSE_C
+#define POLARSSL_X509_CRT_PARSE_C MBEDTLS_X509_CRT_PARSE_C
+#endif
+#if defined MBEDTLS_X509_CRT_WRITE_C
+#define POLARSSL_X509_CRT_WRITE_C MBEDTLS_X509_CRT_WRITE_C
+#endif
+#if defined MBEDTLS_X509_CSR_PARSE_C
+#define POLARSSL_X509_CSR_PARSE_C MBEDTLS_X509_CSR_PARSE_C
+#endif
+#if defined MBEDTLS_X509_CSR_WRITE_C
+#define POLARSSL_X509_CSR_WRITE_C MBEDTLS_X509_CSR_WRITE_C
+#endif
+#if defined MBEDTLS_X509_MAX_INTERMEDIATE_CA
+#define POLARSSL_X509_MAX_INTERMEDIATE_CA MBEDTLS_X509_MAX_INTERMEDIATE_CA
+#endif
+#if defined MBEDTLS_X509_RSASSA_PSS_SUPPORT
+#define POLARSSL_X509_RSASSA_PSS_SUPPORT MBEDTLS_X509_RSASSA_PSS_SUPPORT
+#endif
+#if defined MBEDTLS_X509_USE_C
+#define POLARSSL_X509_USE_C MBEDTLS_X509_USE_C
+#endif
+#if defined MBEDTLS_XTEA_ALT
+#define POLARSSL_XTEA_ALT MBEDTLS_XTEA_ALT
+#endif
+#if defined MBEDTLS_XTEA_C
+#define POLARSSL_XTEA_C MBEDTLS_XTEA_C
+#endif
+#if defined MBEDTLS_ZLIB_SUPPORT
+#define POLARSSL_ZLIB_SUPPORT MBEDTLS_ZLIB_SUPPORT
+#endif
+
+/*
+ * Misc names (macros, types, functions, enum constants...)
+ */
+#define AES_DECRYPT MBEDTLS_AES_DECRYPT
+#define AES_ENCRYPT MBEDTLS_AES_ENCRYPT
+#define ASN1_BIT_STRING MBEDTLS_ASN1_BIT_STRING
+#define ASN1_BMP_STRING MBEDTLS_ASN1_BMP_STRING
+#define ASN1_BOOLEAN MBEDTLS_ASN1_BOOLEAN
+#define ASN1_CHK_ADD MBEDTLS_ASN1_CHK_ADD
+#define ASN1_CONSTRUCTED MBEDTLS_ASN1_CONSTRUCTED
+#define ASN1_CONTEXT_SPECIFIC MBEDTLS_ASN1_CONTEXT_SPECIFIC
+#define ASN1_GENERALIZED_TIME MBEDTLS_ASN1_GENERALIZED_TIME
+#define ASN1_IA5_STRING MBEDTLS_ASN1_IA5_STRING
+#define ASN1_INTEGER MBEDTLS_ASN1_INTEGER
+#define ASN1_NULL MBEDTLS_ASN1_NULL
+#define ASN1_OCTET_STRING MBEDTLS_ASN1_OCTET_STRING
+#define ASN1_OID MBEDTLS_ASN1_OID
+#define ASN1_PRIMITIVE MBEDTLS_ASN1_PRIMITIVE
+#define ASN1_PRINTABLE_STRING MBEDTLS_ASN1_PRINTABLE_STRING
+#define ASN1_SEQUENCE MBEDTLS_ASN1_SEQUENCE
+#define ASN1_SET MBEDTLS_ASN1_SET
+#define ASN1_T61_STRING MBEDTLS_ASN1_T61_STRING
+#define ASN1_UNIVERSAL_STRING MBEDTLS_ASN1_UNIVERSAL_STRING
+#define ASN1_UTC_TIME MBEDTLS_ASN1_UTC_TIME
+#define ASN1_UTF8_STRING MBEDTLS_ASN1_UTF8_STRING
+#define BADCERT_CN_MISMATCH MBEDTLS_X509_BADCERT_CN_MISMATCH
+#define BADCERT_EXPIRED MBEDTLS_X509_BADCERT_EXPIRED
+#define BADCERT_FUTURE MBEDTLS_X509_BADCERT_FUTURE
+#define BADCERT_MISSING MBEDTLS_X509_BADCERT_MISSING
+#define BADCERT_NOT_TRUSTED MBEDTLS_X509_BADCERT_NOT_TRUSTED
+#define BADCERT_OTHER MBEDTLS_X509_BADCERT_OTHER
+#define BADCERT_REVOKED MBEDTLS_X509_BADCERT_REVOKED
+#define BADCERT_SKIP_VERIFY MBEDTLS_X509_BADCERT_SKIP_VERIFY
+#define BADCRL_EXPIRED MBEDTLS_X509_BADCRL_EXPIRED
+#define BADCRL_FUTURE MBEDTLS_X509_BADCRL_FUTURE
+#define BADCRL_NOT_TRUSTED MBEDTLS_X509_BADCRL_NOT_TRUSTED
+#define BLOWFISH_BLOCKSIZE MBEDTLS_BLOWFISH_BLOCKSIZE
+#define BLOWFISH_DECRYPT MBEDTLS_BLOWFISH_DECRYPT
+#define BLOWFISH_ENCRYPT MBEDTLS_BLOWFISH_ENCRYPT
+#define BLOWFISH_MAX_KEY MBEDTLS_BLOWFISH_MAX_KEY_BITS
+#define BLOWFISH_MIN_KEY MBEDTLS_BLOWFISH_MIN_KEY_BITS
+#define BLOWFISH_ROUNDS MBEDTLS_BLOWFISH_ROUNDS
+#define CAMELLIA_DECRYPT MBEDTLS_CAMELLIA_DECRYPT
+#define CAMELLIA_ENCRYPT MBEDTLS_CAMELLIA_ENCRYPT
+#define COLLECT_SIZE MBEDTLS_HAVEGE_COLLECT_SIZE
+#define CTR_DRBG_BLOCKSIZE MBEDTLS_CTR_DRBG_BLOCKSIZE
+#define CTR_DRBG_ENTROPY_LEN MBEDTLS_CTR_DRBG_ENTROPY_LEN
+#define CTR_DRBG_KEYBITS MBEDTLS_CTR_DRBG_KEYBITS
+#define CTR_DRBG_KEYSIZE MBEDTLS_CTR_DRBG_KEYSIZE
+#define CTR_DRBG_MAX_INPUT MBEDTLS_CTR_DRBG_MAX_INPUT
+#define CTR_DRBG_MAX_REQUEST MBEDTLS_CTR_DRBG_MAX_REQUEST
+#define CTR_DRBG_MAX_SEED_INPUT MBEDTLS_CTR_DRBG_MAX_SEED_INPUT
+#define CTR_DRBG_PR_OFF MBEDTLS_CTR_DRBG_PR_OFF
+#define CTR_DRBG_PR_ON MBEDTLS_CTR_DRBG_PR_ON
+#define CTR_DRBG_RESEED_INTERVAL MBEDTLS_CTR_DRBG_RESEED_INTERVAL
+#define CTR_DRBG_SEEDLEN MBEDTLS_CTR_DRBG_SEEDLEN
+#define DEPRECATED MBEDTLS_DEPRECATED
+#define DES_DECRYPT MBEDTLS_DES_DECRYPT
+#define DES_ENCRYPT MBEDTLS_DES_ENCRYPT
+#define DES_KEY_SIZE MBEDTLS_DES_KEY_SIZE
+#define ENTROPY_BLOCK_SIZE MBEDTLS_ENTROPY_BLOCK_SIZE
+#define ENTROPY_MAX_GATHER MBEDTLS_ENTROPY_MAX_GATHER
+#define ENTROPY_MAX_SEED_SIZE MBEDTLS_ENTROPY_MAX_SEED_SIZE
+#define ENTROPY_MAX_SOURCES MBEDTLS_ENTROPY_MAX_SOURCES
+#define ENTROPY_MIN_HARDCLOCK MBEDTLS_ENTROPY_MIN_HARDCLOCK
+#define ENTROPY_MIN_HAVEGE MBEDTLS_ENTROPY_MIN_HAVEGE
+#define ENTROPY_MIN_PLATFORM MBEDTLS_ENTROPY_MIN_PLATFORM
+#define ENTROPY_SOURCE_MANUAL MBEDTLS_ENTROPY_SOURCE_MANUAL
+#define EXT_AUTHORITY_KEY_IDENTIFIER MBEDTLS_X509_EXT_AUTHORITY_KEY_IDENTIFIER
+#define EXT_BASIC_CONSTRAINTS MBEDTLS_X509_EXT_BASIC_CONSTRAINTS
+#define EXT_CERTIFICATE_POLICIES MBEDTLS_X509_EXT_CERTIFICATE_POLICIES
+#define EXT_CRL_DISTRIBUTION_POINTS MBEDTLS_X509_EXT_CRL_DISTRIBUTION_POINTS
+#define EXT_EXTENDED_KEY_USAGE MBEDTLS_X509_EXT_EXTENDED_KEY_USAGE
+#define EXT_FRESHEST_CRL MBEDTLS_X509_EXT_FRESHEST_CRL
+#define EXT_INIHIBIT_ANYPOLICY MBEDTLS_X509_EXT_INIHIBIT_ANYPOLICY
+#define EXT_ISSUER_ALT_NAME MBEDTLS_X509_EXT_ISSUER_ALT_NAME
+#define EXT_KEY_USAGE MBEDTLS_X509_EXT_KEY_USAGE
+#define EXT_NAME_CONSTRAINTS MBEDTLS_X509_EXT_NAME_CONSTRAINTS
+#define EXT_NS_CERT_TYPE MBEDTLS_X509_EXT_NS_CERT_TYPE
+#define EXT_POLICY_CONSTRAINTS MBEDTLS_X509_EXT_POLICY_CONSTRAINTS
+#define EXT_POLICY_MAPPINGS MBEDTLS_X509_EXT_POLICY_MAPPINGS
+#define EXT_SUBJECT_ALT_NAME MBEDTLS_X509_EXT_SUBJECT_ALT_NAME
+#define EXT_SUBJECT_DIRECTORY_ATTRS MBEDTLS_X509_EXT_SUBJECT_DIRECTORY_ATTRS
+#define EXT_SUBJECT_KEY_IDENTIFIER MBEDTLS_X509_EXT_SUBJECT_KEY_IDENTIFIER
+#define GCM_DECRYPT MBEDTLS_GCM_DECRYPT
+#define GCM_ENCRYPT MBEDTLS_GCM_ENCRYPT
+#define KU_CRL_SIGN MBEDTLS_X509_KU_CRL_SIGN
+#define KU_DATA_ENCIPHERMENT MBEDTLS_X509_KU_DATA_ENCIPHERMENT
+#define KU_DIGITAL_SIGNATURE MBEDTLS_X509_KU_DIGITAL_SIGNATURE
+#define KU_KEY_AGREEMENT MBEDTLS_X509_KU_KEY_AGREEMENT
+#define KU_KEY_CERT_SIGN MBEDTLS_X509_KU_KEY_CERT_SIGN
+#define KU_KEY_ENCIPHERMENT MBEDTLS_X509_KU_KEY_ENCIPHERMENT
+#define KU_NON_REPUDIATION MBEDTLS_X509_KU_NON_REPUDIATION
+#define LN_2_DIV_LN_10_SCALE100 MBEDTLS_LN_2_DIV_LN_10_SCALE100
+#define MEMORY_VERIFY_ALLOC MBEDTLS_MEMORY_VERIFY_ALLOC
+#define MEMORY_VERIFY_ALWAYS MBEDTLS_MEMORY_VERIFY_ALWAYS
+#define MEMORY_VERIFY_FREE MBEDTLS_MEMORY_VERIFY_FREE
+#define MEMORY_VERIFY_NONE MBEDTLS_MEMORY_VERIFY_NONE
+#define MPI_CHK MBEDTLS_MPI_CHK
+#define NET_PROTO_TCP MBEDTLS_NET_PROTO_TCP
+#define NET_PROTO_UDP MBEDTLS_NET_PROTO_UDP
+#define NS_CERT_TYPE_EMAIL MBEDTLS_X509_NS_CERT_TYPE_EMAIL
+#define NS_CERT_TYPE_EMAIL_CA MBEDTLS_X509_NS_CERT_TYPE_EMAIL_CA
+#define NS_CERT_TYPE_OBJECT_SIGNING MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING
+#define NS_CERT_TYPE_OBJECT_SIGNING_CA MBEDTLS_X509_NS_CERT_TYPE_OBJECT_SIGNING_CA
+#define NS_CERT_TYPE_RESERVED MBEDTLS_X509_NS_CERT_TYPE_RESERVED
+#define NS_CERT_TYPE_SSL_CA MBEDTLS_X509_NS_CERT_TYPE_SSL_CA
+#define NS_CERT_TYPE_SSL_CLIENT MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT
+#define NS_CERT_TYPE_SSL_SERVER MBEDTLS_X509_NS_CERT_TYPE_SSL_SERVER
+#define OID_ANSI_X9_62 MBEDTLS_OID_ANSI_X9_62
+#define OID_ANSI_X9_62_FIELD_TYPE MBEDTLS_OID_ANSI_X9_62_FIELD_TYPE
+#define OID_ANSI_X9_62_PRIME_FIELD MBEDTLS_OID_ANSI_X9_62_PRIME_FIELD
+#define OID_ANSI_X9_62_SIG MBEDTLS_OID_ANSI_X9_62_SIG
+#define OID_ANSI_X9_62_SIG_SHA2 MBEDTLS_OID_ANSI_X9_62_SIG_SHA2
+#define OID_ANY_EXTENDED_KEY_USAGE MBEDTLS_OID_ANY_EXTENDED_KEY_USAGE
+#define OID_AT MBEDTLS_OID_AT
+#define OID_AT_CN MBEDTLS_OID_AT_CN
+#define OID_AT_COUNTRY MBEDTLS_OID_AT_COUNTRY
+#define OID_AT_DN_QUALIFIER MBEDTLS_OID_AT_DN_QUALIFIER
+#define OID_AT_GENERATION_QUALIFIER MBEDTLS_OID_AT_GENERATION_QUALIFIER
+#define OID_AT_GIVEN_NAME MBEDTLS_OID_AT_GIVEN_NAME
+#define OID_AT_INITIALS MBEDTLS_OID_AT_INITIALS
+#define OID_AT_LOCALITY MBEDTLS_OID_AT_LOCALITY
+#define OID_AT_ORGANIZATION MBEDTLS_OID_AT_ORGANIZATION
+#define OID_AT_ORG_UNIT MBEDTLS_OID_AT_ORG_UNIT
+#define OID_AT_POSTAL_ADDRESS MBEDTLS_OID_AT_POSTAL_ADDRESS
+#define OID_AT_POSTAL_CODE MBEDTLS_OID_AT_POSTAL_CODE
+#define OID_AT_PSEUDONYM MBEDTLS_OID_AT_PSEUDONYM
+#define OID_AT_SERIAL_NUMBER MBEDTLS_OID_AT_SERIAL_NUMBER
+#define OID_AT_STATE MBEDTLS_OID_AT_STATE
+#define OID_AT_SUR_NAME MBEDTLS_OID_AT_SUR_NAME
+#define OID_AT_TITLE MBEDTLS_OID_AT_TITLE
+#define OID_AT_UNIQUE_IDENTIFIER MBEDTLS_OID_AT_UNIQUE_IDENTIFIER
+#define OID_AUTHORITY_KEY_IDENTIFIER MBEDTLS_OID_AUTHORITY_KEY_IDENTIFIER
+#define OID_BASIC_CONSTRAINTS MBEDTLS_OID_BASIC_CONSTRAINTS
+#define OID_CERTICOM MBEDTLS_OID_CERTICOM
+#define OID_CERTIFICATE_POLICIES MBEDTLS_OID_CERTIFICATE_POLICIES
+#define OID_CLIENT_AUTH MBEDTLS_OID_CLIENT_AUTH
+#define OID_CMP MBEDTLS_OID_CMP
+#define OID_CODE_SIGNING MBEDTLS_OID_CODE_SIGNING
+#define OID_COUNTRY_US MBEDTLS_OID_COUNTRY_US
+#define OID_CRL_DISTRIBUTION_POINTS MBEDTLS_OID_CRL_DISTRIBUTION_POINTS
+#define OID_CRL_NUMBER MBEDTLS_OID_CRL_NUMBER
+#define OID_DES_CBC MBEDTLS_OID_DES_CBC
+#define OID_DES_EDE3_CBC MBEDTLS_OID_DES_EDE3_CBC
+#define OID_DIGEST_ALG_MD2 MBEDTLS_OID_DIGEST_ALG_MD2
+#define OID_DIGEST_ALG_MD4 MBEDTLS_OID_DIGEST_ALG_MD4
+#define OID_DIGEST_ALG_MD5 MBEDTLS_OID_DIGEST_ALG_MD5
+#define OID_DIGEST_ALG_SHA1 MBEDTLS_OID_DIGEST_ALG_SHA1
+#define OID_DIGEST_ALG_SHA224 MBEDTLS_OID_DIGEST_ALG_SHA224
+#define OID_DIGEST_ALG_SHA256 MBEDTLS_OID_DIGEST_ALG_SHA256
+#define OID_DIGEST_ALG_SHA384 MBEDTLS_OID_DIGEST_ALG_SHA384
+#define OID_DIGEST_ALG_SHA512 MBEDTLS_OID_DIGEST_ALG_SHA512
+#define OID_DOMAIN_COMPONENT MBEDTLS_OID_DOMAIN_COMPONENT
+#define OID_ECDSA_SHA1 MBEDTLS_OID_ECDSA_SHA1
+#define OID_ECDSA_SHA224 MBEDTLS_OID_ECDSA_SHA224
+#define OID_ECDSA_SHA256 MBEDTLS_OID_ECDSA_SHA256
+#define OID_ECDSA_SHA384 MBEDTLS_OID_ECDSA_SHA384
+#define OID_ECDSA_SHA512 MBEDTLS_OID_ECDSA_SHA512
+#define OID_EC_ALG_ECDH MBEDTLS_OID_EC_ALG_ECDH
+#define OID_EC_ALG_UNRESTRICTED MBEDTLS_OID_EC_ALG_UNRESTRICTED
+#define OID_EC_BRAINPOOL_V1 MBEDTLS_OID_EC_BRAINPOOL_V1
+#define OID_EC_GRP_BP256R1 MBEDTLS_OID_EC_GRP_BP256R1
+#define OID_EC_GRP_BP384R1 MBEDTLS_OID_EC_GRP_BP384R1
+#define OID_EC_GRP_BP512R1 MBEDTLS_OID_EC_GRP_BP512R1
+#define OID_EC_GRP_SECP192K1 MBEDTLS_OID_EC_GRP_SECP192K1
+#define OID_EC_GRP_SECP192R1 MBEDTLS_OID_EC_GRP_SECP192R1
+#define OID_EC_GRP_SECP224K1 MBEDTLS_OID_EC_GRP_SECP224K1
+#define OID_EC_GRP_SECP224R1 MBEDTLS_OID_EC_GRP_SECP224R1
+#define OID_EC_GRP_SECP256K1 MBEDTLS_OID_EC_GRP_SECP256K1
+#define OID_EC_GRP_SECP256R1 MBEDTLS_OID_EC_GRP_SECP256R1
+#define OID_EC_GRP_SECP384R1 MBEDTLS_OID_EC_GRP_SECP384R1
+#define OID_EC_GRP_SECP521R1 MBEDTLS_OID_EC_GRP_SECP521R1
+#define OID_EMAIL_PROTECTION MBEDTLS_OID_EMAIL_PROTECTION
+#define OID_EXTENDED_KEY_USAGE MBEDTLS_OID_EXTENDED_KEY_USAGE
+#define OID_FRESHEST_CRL MBEDTLS_OID_FRESHEST_CRL
+#define OID_GOV MBEDTLS_OID_GOV
+#define OID_HMAC_SHA1 MBEDTLS_OID_HMAC_SHA1
+#define OID_ID_CE MBEDTLS_OID_ID_CE
+#define OID_INIHIBIT_ANYPOLICY MBEDTLS_OID_INIHIBIT_ANYPOLICY
+#define OID_ISO_CCITT_DS MBEDTLS_OID_ISO_CCITT_DS
+#define OID_ISO_IDENTIFIED_ORG MBEDTLS_OID_ISO_IDENTIFIED_ORG
+#define OID_ISO_ITU_COUNTRY MBEDTLS_OID_ISO_ITU_COUNTRY
+#define OID_ISO_ITU_US_ORG MBEDTLS_OID_ISO_ITU_US_ORG
+#define OID_ISO_MEMBER_BODIES MBEDTLS_OID_ISO_MEMBER_BODIES
+#define OID_ISSUER_ALT_NAME MBEDTLS_OID_ISSUER_ALT_NAME
+#define OID_KEY_USAGE MBEDTLS_OID_KEY_USAGE
+#define OID_KP MBEDTLS_OID_KP
+#define OID_MGF1 MBEDTLS_OID_MGF1
+#define OID_NAME_CONSTRAINTS MBEDTLS_OID_NAME_CONSTRAINTS
+#define OID_NETSCAPE MBEDTLS_OID_NETSCAPE
+#define OID_NS_BASE_URL MBEDTLS_OID_NS_BASE_URL
+#define OID_NS_CA_POLICY_URL MBEDTLS_OID_NS_CA_POLICY_URL
+#define OID_NS_CA_REVOCATION_URL MBEDTLS_OID_NS_CA_REVOCATION_URL
+#define OID_NS_CERT MBEDTLS_OID_NS_CERT
+#define OID_NS_CERT_SEQUENCE MBEDTLS_OID_NS_CERT_SEQUENCE
+#define OID_NS_CERT_TYPE MBEDTLS_OID_NS_CERT_TYPE
+#define OID_NS_COMMENT MBEDTLS_OID_NS_COMMENT
+#define OID_NS_DATA_TYPE MBEDTLS_OID_NS_DATA_TYPE
+#define OID_NS_RENEWAL_URL MBEDTLS_OID_NS_RENEWAL_URL
+#define OID_NS_REVOCATION_URL MBEDTLS_OID_NS_REVOCATION_URL
+#define OID_NS_SSL_SERVER_NAME MBEDTLS_OID_NS_SSL_SERVER_NAME
+#define OID_OCSP_SIGNING MBEDTLS_OID_OCSP_SIGNING
+#define OID_OIW_SECSIG MBEDTLS_OID_OIW_SECSIG
+#define OID_OIW_SECSIG_ALG MBEDTLS_OID_OIW_SECSIG_ALG
+#define OID_OIW_SECSIG_SHA1 MBEDTLS_OID_OIW_SECSIG_SHA1
+#define OID_ORGANIZATION MBEDTLS_OID_ORGANIZATION
+#define OID_ORG_ANSI_X9_62 MBEDTLS_OID_ORG_ANSI_X9_62
+#define OID_ORG_CERTICOM MBEDTLS_OID_ORG_CERTICOM
+#define OID_ORG_DOD MBEDTLS_OID_ORG_DOD
+#define OID_ORG_GOV MBEDTLS_OID_ORG_GOV
+#define OID_ORG_NETSCAPE MBEDTLS_OID_ORG_NETSCAPE
+#define OID_ORG_OIW MBEDTLS_OID_ORG_OIW
+#define OID_ORG_RSA_DATA_SECURITY MBEDTLS_OID_ORG_RSA_DATA_SECURITY
+#define OID_ORG_TELETRUST MBEDTLS_OID_ORG_TELETRUST
+#define OID_PKCS MBEDTLS_OID_PKCS
+#define OID_PKCS1 MBEDTLS_OID_PKCS1
+#define OID_PKCS12 MBEDTLS_OID_PKCS12
+#define OID_PKCS12_PBE MBEDTLS_OID_PKCS12_PBE
+#define OID_PKCS12_PBE_SHA1_DES2_EDE_CBC MBEDTLS_OID_PKCS12_PBE_SHA1_DES2_EDE_CBC
+#define OID_PKCS12_PBE_SHA1_DES3_EDE_CBC MBEDTLS_OID_PKCS12_PBE_SHA1_DES3_EDE_CBC
+#define OID_PKCS12_PBE_SHA1_RC2_128_CBC MBEDTLS_OID_PKCS12_PBE_SHA1_RC2_128_CBC
+#define OID_PKCS12_PBE_SHA1_RC2_40_CBC MBEDTLS_OID_PKCS12_PBE_SHA1_RC2_40_CBC
+#define OID_PKCS12_PBE_SHA1_RC4_128 MBEDTLS_OID_PKCS12_PBE_SHA1_RC4_128
+#define OID_PKCS12_PBE_SHA1_RC4_40 MBEDTLS_OID_PKCS12_PBE_SHA1_RC4_40
+#define OID_PKCS1_MD2 MBEDTLS_OID_PKCS1_MD2
+#define OID_PKCS1_MD4 MBEDTLS_OID_PKCS1_MD4
+#define OID_PKCS1_MD5 MBEDTLS_OID_PKCS1_MD5
+#define OID_PKCS1_RSA MBEDTLS_OID_PKCS1_RSA
+#define OID_PKCS1_SHA1 MBEDTLS_OID_PKCS1_SHA1
+#define OID_PKCS1_SHA224 MBEDTLS_OID_PKCS1_SHA224
+#define OID_PKCS1_SHA256 MBEDTLS_OID_PKCS1_SHA256
+#define OID_PKCS1_SHA384 MBEDTLS_OID_PKCS1_SHA384
+#define OID_PKCS1_SHA512 MBEDTLS_OID_PKCS1_SHA512
+#define OID_PKCS5 MBEDTLS_OID_PKCS5
+#define OID_PKCS5_PBES2 MBEDTLS_OID_PKCS5_PBES2
+#define OID_PKCS5_PBE_MD2_DES_CBC MBEDTLS_OID_PKCS5_PBE_MD2_DES_CBC
+#define OID_PKCS5_PBE_MD2_RC2_CBC MBEDTLS_OID_PKCS5_PBE_MD2_RC2_CBC
+#define OID_PKCS5_PBE_MD5_DES_CBC MBEDTLS_OID_PKCS5_PBE_MD5_DES_CBC
+#define OID_PKCS5_PBE_MD5_RC2_CBC MBEDTLS_OID_PKCS5_PBE_MD5_RC2_CBC
+#define OID_PKCS5_PBE_SHA1_DES_CBC MBEDTLS_OID_PKCS5_PBE_SHA1_DES_CBC
+#define OID_PKCS5_PBE_SHA1_RC2_CBC MBEDTLS_OID_PKCS5_PBE_SHA1_RC2_CBC
+#define OID_PKCS5_PBKDF2 MBEDTLS_OID_PKCS5_PBKDF2
+#define OID_PKCS5_PBMAC1 MBEDTLS_OID_PKCS5_PBMAC1
+#define OID_PKCS9 MBEDTLS_OID_PKCS9
+#define OID_PKCS9_CSR_EXT_REQ MBEDTLS_OID_PKCS9_CSR_EXT_REQ
+#define OID_PKCS9_EMAIL MBEDTLS_OID_PKCS9_EMAIL
+#define OID_PKIX MBEDTLS_OID_PKIX
+#define OID_POLICY_CONSTRAINTS MBEDTLS_OID_POLICY_CONSTRAINTS
+#define OID_POLICY_MAPPINGS MBEDTLS_OID_POLICY_MAPPINGS
+#define OID_PRIVATE_KEY_USAGE_PERIOD MBEDTLS_OID_PRIVATE_KEY_USAGE_PERIOD
+#define OID_RSASSA_PSS MBEDTLS_OID_RSASSA_PSS
+#define OID_RSA_COMPANY MBEDTLS_OID_RSA_COMPANY
+#define OID_RSA_SHA_OBS MBEDTLS_OID_RSA_SHA_OBS
+#define OID_SERVER_AUTH MBEDTLS_OID_SERVER_AUTH
+#define OID_SIZE MBEDTLS_OID_SIZE
+#define OID_SUBJECT_ALT_NAME MBEDTLS_OID_SUBJECT_ALT_NAME
+#define OID_SUBJECT_DIRECTORY_ATTRS MBEDTLS_OID_SUBJECT_DIRECTORY_ATTRS
+#define OID_SUBJECT_KEY_IDENTIFIER MBEDTLS_OID_SUBJECT_KEY_IDENTIFIER
+#define OID_TELETRUST MBEDTLS_OID_TELETRUST
+#define OID_TIME_STAMPING MBEDTLS_OID_TIME_STAMPING
+#define PADLOCK_ACE MBEDTLS_PADLOCK_ACE
+#define PADLOCK_ALIGN16 MBEDTLS_PADLOCK_ALIGN16
+#define PADLOCK_PHE MBEDTLS_PADLOCK_PHE
+#define PADLOCK_PMM MBEDTLS_PADLOCK_PMM
+#define PADLOCK_RNG MBEDTLS_PADLOCK_RNG
+#define PKCS12_DERIVE_IV MBEDTLS_PKCS12_DERIVE_IV
+#define PKCS12_DERIVE_KEY MBEDTLS_PKCS12_DERIVE_KEY
+#define PKCS12_DERIVE_MAC_KEY MBEDTLS_PKCS12_DERIVE_MAC_KEY
+#define PKCS12_PBE_DECRYPT MBEDTLS_PKCS12_PBE_DECRYPT
+#define PKCS12_PBE_ENCRYPT MBEDTLS_PKCS12_PBE_ENCRYPT
+#define PKCS5_DECRYPT MBEDTLS_PKCS5_DECRYPT
+#define PKCS5_ENCRYPT MBEDTLS_PKCS5_ENCRYPT
+#define POLARSSL_AESNI_AES MBEDTLS_AESNI_AES
+#define POLARSSL_AESNI_CLMUL MBEDTLS_AESNI_CLMUL
+#define POLARSSL_AESNI_H MBEDTLS_AESNI_H
+#define POLARSSL_AES_H MBEDTLS_AES_H
+#define POLARSSL_ARC4_H MBEDTLS_ARC4_H
+#define POLARSSL_ASN1_H MBEDTLS_ASN1_H
+#define POLARSSL_ASN1_WRITE_H MBEDTLS_ASN1_WRITE_H
+#define POLARSSL_BASE64_H MBEDTLS_BASE64_H
+#define POLARSSL_BIGNUM_H MBEDTLS_BIGNUM_H
+#define POLARSSL_BLOWFISH_H MBEDTLS_BLOWFISH_H
+#define POLARSSL_BN_MUL_H MBEDTLS_BN_MUL_H
+#define POLARSSL_CAMELLIA_H MBEDTLS_CAMELLIA_H
+#define POLARSSL_CCM_H MBEDTLS_CCM_H
+#define POLARSSL_CERTS_H MBEDTLS_CERTS_H
+#define POLARSSL_CHECK_CONFIG_H MBEDTLS_CHECK_CONFIG_H
+#define POLARSSL_CIPHERSUITE_NODTLS MBEDTLS_CIPHERSUITE_NODTLS
+#define POLARSSL_CIPHERSUITE_SHORT_TAG MBEDTLS_CIPHERSUITE_SHORT_TAG
+#define POLARSSL_CIPHERSUITE_WEAK MBEDTLS_CIPHERSUITE_WEAK
+#define POLARSSL_CIPHER_AES_128_CBC MBEDTLS_CIPHER_AES_128_CBC
+#define POLARSSL_CIPHER_AES_128_CCM MBEDTLS_CIPHER_AES_128_CCM
+#define POLARSSL_CIPHER_AES_128_CFB128 MBEDTLS_CIPHER_AES_128_CFB128
+#define POLARSSL_CIPHER_AES_128_CTR MBEDTLS_CIPHER_AES_128_CTR
+#define POLARSSL_CIPHER_AES_128_ECB MBEDTLS_CIPHER_AES_128_ECB
+#define POLARSSL_CIPHER_AES_128_GCM MBEDTLS_CIPHER_AES_128_GCM
+#define POLARSSL_CIPHER_AES_192_CBC MBEDTLS_CIPHER_AES_192_CBC
+#define POLARSSL_CIPHER_AES_192_CCM MBEDTLS_CIPHER_AES_192_CCM
+#define POLARSSL_CIPHER_AES_192_CFB128 MBEDTLS_CIPHER_AES_192_CFB128
+#define POLARSSL_CIPHER_AES_192_CTR MBEDTLS_CIPHER_AES_192_CTR
+#define POLARSSL_CIPHER_AES_192_ECB MBEDTLS_CIPHER_AES_192_ECB
+#define POLARSSL_CIPHER_AES_192_GCM MBEDTLS_CIPHER_AES_192_GCM
+#define POLARSSL_CIPHER_AES_256_CBC MBEDTLS_CIPHER_AES_256_CBC
+#define POLARSSL_CIPHER_AES_256_CCM MBEDTLS_CIPHER_AES_256_CCM
+#define POLARSSL_CIPHER_AES_256_CFB128 MBEDTLS_CIPHER_AES_256_CFB128
+#define POLARSSL_CIPHER_AES_256_CTR MBEDTLS_CIPHER_AES_256_CTR
+#define POLARSSL_CIPHER_AES_256_ECB MBEDTLS_CIPHER_AES_256_ECB
+#define POLARSSL_CIPHER_AES_256_GCM MBEDTLS_CIPHER_AES_256_GCM
+#define POLARSSL_CIPHER_ARC4_128 MBEDTLS_CIPHER_ARC4_128
+#define POLARSSL_CIPHER_BLOWFISH_CBC MBEDTLS_CIPHER_BLOWFISH_CBC
+#define POLARSSL_CIPHER_BLOWFISH_CFB64 MBEDTLS_CIPHER_BLOWFISH_CFB64
+#define POLARSSL_CIPHER_BLOWFISH_CTR MBEDTLS_CIPHER_BLOWFISH_CTR
+#define POLARSSL_CIPHER_BLOWFISH_ECB MBEDTLS_CIPHER_BLOWFISH_ECB
+#define POLARSSL_CIPHER_CAMELLIA_128_CBC MBEDTLS_CIPHER_CAMELLIA_128_CBC
+#define POLARSSL_CIPHER_CAMELLIA_128_CCM MBEDTLS_CIPHER_CAMELLIA_128_CCM
+#define POLARSSL_CIPHER_CAMELLIA_128_CFB128 MBEDTLS_CIPHER_CAMELLIA_128_CFB128
+#define POLARSSL_CIPHER_CAMELLIA_128_CTR MBEDTLS_CIPHER_CAMELLIA_128_CTR
+#define POLARSSL_CIPHER_CAMELLIA_128_ECB MBEDTLS_CIPHER_CAMELLIA_128_ECB
+#define POLARSSL_CIPHER_CAMELLIA_128_GCM MBEDTLS_CIPHER_CAMELLIA_128_GCM
+#define POLARSSL_CIPHER_CAMELLIA_192_CBC MBEDTLS_CIPHER_CAMELLIA_192_CBC
+#define POLARSSL_CIPHER_CAMELLIA_192_CCM MBEDTLS_CIPHER_CAMELLIA_192_CCM
+#define POLARSSL_CIPHER_CAMELLIA_192_CFB128 MBEDTLS_CIPHER_CAMELLIA_192_CFB128
+#define POLARSSL_CIPHER_CAMELLIA_192_CTR MBEDTLS_CIPHER_CAMELLIA_192_CTR
+#define POLARSSL_CIPHER_CAMELLIA_192_ECB MBEDTLS_CIPHER_CAMELLIA_192_ECB
+#define POLARSSL_CIPHER_CAMELLIA_192_GCM MBEDTLS_CIPHER_CAMELLIA_192_GCM
+#define POLARSSL_CIPHER_CAMELLIA_256_CBC MBEDTLS_CIPHER_CAMELLIA_256_CBC
+#define POLARSSL_CIPHER_CAMELLIA_256_CCM MBEDTLS_CIPHER_CAMELLIA_256_CCM
+#define POLARSSL_CIPHER_CAMELLIA_256_CFB128 MBEDTLS_CIPHER_CAMELLIA_256_CFB128
+#define POLARSSL_CIPHER_CAMELLIA_256_CTR MBEDTLS_CIPHER_CAMELLIA_256_CTR
+#define POLARSSL_CIPHER_CAMELLIA_256_ECB MBEDTLS_CIPHER_CAMELLIA_256_ECB
+#define POLARSSL_CIPHER_CAMELLIA_256_GCM MBEDTLS_CIPHER_CAMELLIA_256_GCM
+#define POLARSSL_CIPHER_DES_CBC MBEDTLS_CIPHER_DES_CBC
+#define POLARSSL_CIPHER_DES_ECB MBEDTLS_CIPHER_DES_ECB
+#define POLARSSL_CIPHER_DES_EDE3_CBC MBEDTLS_CIPHER_DES_EDE3_CBC
+#define POLARSSL_CIPHER_DES_EDE3_ECB MBEDTLS_CIPHER_DES_EDE3_ECB
+#define POLARSSL_CIPHER_DES_EDE_CBC MBEDTLS_CIPHER_DES_EDE_CBC
+#define POLARSSL_CIPHER_DES_EDE_ECB MBEDTLS_CIPHER_DES_EDE_ECB
+#define POLARSSL_CIPHER_H MBEDTLS_CIPHER_H
+#define POLARSSL_CIPHER_ID_3DES MBEDTLS_CIPHER_ID_3DES
+#define POLARSSL_CIPHER_ID_AES MBEDTLS_CIPHER_ID_AES
+#define POLARSSL_CIPHER_ID_ARC4 MBEDTLS_CIPHER_ID_ARC4
+#define POLARSSL_CIPHER_ID_BLOWFISH MBEDTLS_CIPHER_ID_BLOWFISH
+#define POLARSSL_CIPHER_ID_CAMELLIA MBEDTLS_CIPHER_ID_CAMELLIA
+#define POLARSSL_CIPHER_ID_DES MBEDTLS_CIPHER_ID_DES
+#define POLARSSL_CIPHER_ID_NONE MBEDTLS_CIPHER_ID_NONE
+#define POLARSSL_CIPHER_ID_NULL MBEDTLS_CIPHER_ID_NULL
+#define POLARSSL_CIPHER_MODE_AEAD MBEDTLS_CIPHER_MODE_AEAD
+#define POLARSSL_CIPHER_MODE_STREAM MBEDTLS_CIPHER_MODE_STREAM
+#define POLARSSL_CIPHER_MODE_WITH_PADDING MBEDTLS_CIPHER_MODE_WITH_PADDING
+#define POLARSSL_CIPHER_NONE MBEDTLS_CIPHER_NONE
+#define POLARSSL_CIPHER_NULL MBEDTLS_CIPHER_NULL
+#define POLARSSL_CIPHER_VARIABLE_IV_LEN MBEDTLS_CIPHER_VARIABLE_IV_LEN
+#define POLARSSL_CIPHER_VARIABLE_KEY_LEN MBEDTLS_CIPHER_VARIABLE_KEY_LEN
+#define POLARSSL_CIPHER_WRAP_H MBEDTLS_CIPHER_WRAP_H
+#define POLARSSL_CONFIG_H MBEDTLS_CONFIG_H
+#define POLARSSL_CTR_DRBG_H MBEDTLS_CTR_DRBG_H
+#define POLARSSL_DEBUG_H MBEDTLS_DEBUG_H
+#define POLARSSL_DECRYPT MBEDTLS_DECRYPT
+#define POLARSSL_DES_H MBEDTLS_DES_H
+#define POLARSSL_DHM_H MBEDTLS_DHM_H
+#define POLARSSL_DHM_RFC3526_MODP_2048_G MBEDTLS_DHM_RFC3526_MODP_2048_G
+#define POLARSSL_DHM_RFC3526_MODP_2048_P MBEDTLS_DHM_RFC3526_MODP_2048_P
+#define POLARSSL_DHM_RFC3526_MODP_3072_G MBEDTLS_DHM_RFC3526_MODP_3072_G
+#define POLARSSL_DHM_RFC3526_MODP_3072_P MBEDTLS_DHM_RFC3526_MODP_3072_P
+#define POLARSSL_DHM_RFC5114_MODP_2048_G MBEDTLS_DHM_RFC5114_MODP_2048_G
+#define POLARSSL_DHM_RFC5114_MODP_2048_P MBEDTLS_DHM_RFC5114_MODP_2048_P
+#define POLARSSL_ECDH_H MBEDTLS_ECDH_H
+#define POLARSSL_ECDH_OURS MBEDTLS_ECDH_OURS
+#define POLARSSL_ECDH_THEIRS MBEDTLS_ECDH_THEIRS
+#define POLARSSL_ECDSA_H MBEDTLS_ECDSA_H
+#define POLARSSL_ECP_DP_BP256R1 MBEDTLS_ECP_DP_BP256R1
+#define POLARSSL_ECP_DP_BP384R1 MBEDTLS_ECP_DP_BP384R1
+#define POLARSSL_ECP_DP_BP512R1 MBEDTLS_ECP_DP_BP512R1
+#define POLARSSL_ECP_DP_M255 MBEDTLS_ECP_DP_CURVE25519
+#define POLARSSL_ECP_DP_MAX MBEDTLS_ECP_DP_MAX
+#define POLARSSL_ECP_DP_NONE MBEDTLS_ECP_DP_NONE
+#define POLARSSL_ECP_DP_SECP192K1 MBEDTLS_ECP_DP_SECP192K1
+#define POLARSSL_ECP_DP_SECP192R1 MBEDTLS_ECP_DP_SECP192R1
+#define POLARSSL_ECP_DP_SECP224K1 MBEDTLS_ECP_DP_SECP224K1
+#define POLARSSL_ECP_DP_SECP224R1 MBEDTLS_ECP_DP_SECP224R1
+#define POLARSSL_ECP_DP_SECP256K1 MBEDTLS_ECP_DP_SECP256K1
+#define POLARSSL_ECP_DP_SECP256R1 MBEDTLS_ECP_DP_SECP256R1
+#define POLARSSL_ECP_DP_SECP384R1 MBEDTLS_ECP_DP_SECP384R1
+#define POLARSSL_ECP_DP_SECP521R1 MBEDTLS_ECP_DP_SECP521R1
+#define POLARSSL_ECP_H MBEDTLS_ECP_H
+#define POLARSSL_ECP_MAX_BYTES MBEDTLS_ECP_MAX_BYTES
+#define POLARSSL_ECP_MAX_PT_LEN MBEDTLS_ECP_MAX_PT_LEN
+#define POLARSSL_ECP_PF_COMPRESSED MBEDTLS_ECP_PF_COMPRESSED
+#define POLARSSL_ECP_PF_UNCOMPRESSED MBEDTLS_ECP_PF_UNCOMPRESSED
+#define POLARSSL_ECP_TLS_NAMED_CURVE MBEDTLS_ECP_TLS_NAMED_CURVE
+#define POLARSSL_ENCRYPT MBEDTLS_ENCRYPT
+#define POLARSSL_ENTROPY_H MBEDTLS_ENTROPY_H
+#define POLARSSL_ENTROPY_POLL_H MBEDTLS_ENTROPY_POLL_H
+#define POLARSSL_ENTROPY_SHA256_ACCUMULATOR MBEDTLS_ENTROPY_SHA256_ACCUMULATOR
+#define POLARSSL_ENTROPY_SHA512_ACCUMULATOR MBEDTLS_ENTROPY_SHA512_ACCUMULATOR
+#define POLARSSL_ERROR_H MBEDTLS_ERROR_H
+#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
+#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
+#define POLARSSL_ERR_ASN1_BUF_TOO_SMALL MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
+#define POLARSSL_ERR_ASN1_INVALID_DATA MBEDTLS_ERR_ASN1_INVALID_DATA
+#define POLARSSL_ERR_ASN1_INVALID_LENGTH MBEDTLS_ERR_ASN1_INVALID_LENGTH
+#define POLARSSL_ERR_ASN1_LENGTH_MISMATCH MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
+#define POLARSSL_ERR_ASN1_MALLOC_FAILED MBEDTLS_ERR_ASN1_ALLOC_FAILED
+#define POLARSSL_ERR_ASN1_OUT_OF_DATA MBEDTLS_ERR_ASN1_OUT_OF_DATA
+#define POLARSSL_ERR_ASN1_UNEXPECTED_TAG MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
+#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
+#define POLARSSL_ERR_BASE64_INVALID_CHARACTER MBEDTLS_ERR_BASE64_INVALID_CHARACTER
+#define POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH
+#define POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH
+#define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH
+#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
+#define POLARSSL_ERR_CCM_AUTH_FAILED MBEDTLS_ERR_CCM_AUTH_FAILED
+#define POLARSSL_ERR_CCM_BAD_INPUT MBEDTLS_ERR_CCM_BAD_INPUT
+#define POLARSSL_ERR_CIPHER_ALLOC_FAILED MBEDTLS_ERR_CIPHER_ALLOC_FAILED
+#define POLARSSL_ERR_CIPHER_AUTH_FAILED MBEDTLS_ERR_CIPHER_AUTH_FAILED
+#define POLARSSL_ERR_CIPHER_BAD_INPUT_DATA MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA
+#define POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED
+#define POLARSSL_ERR_CIPHER_INVALID_PADDING MBEDTLS_ERR_CIPHER_INVALID_PADDING
+#define POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
+#define POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR
+#define POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG
+#define POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG
+#define POLARSSL_ERR_DES_INVALID_INPUT_LENGTH MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH
+#define POLARSSL_ERR_DHM_BAD_INPUT_DATA MBEDTLS_ERR_DHM_BAD_INPUT_DATA
+#define POLARSSL_ERR_DHM_CALC_SECRET_FAILED MBEDTLS_ERR_DHM_CALC_SECRET_FAILED
+#define POLARSSL_ERR_DHM_FILE_IO_ERROR MBEDTLS_ERR_DHM_FILE_IO_ERROR
+#define POLARSSL_ERR_DHM_INVALID_FORMAT MBEDTLS_ERR_DHM_INVALID_FORMAT
+#define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED
+#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED
+#define POLARSSL_ERR_DHM_MALLOC_FAILED MBEDTLS_ERR_DHM_ALLOC_FAILED
+#define POLARSSL_ERR_DHM_READ_PARAMS_FAILED MBEDTLS_ERR_DHM_READ_PARAMS_FAILED
+#define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED
+#define POLARSSL_ERR_ECP_BAD_INPUT_DATA MBEDTLS_ERR_ECP_BAD_INPUT_DATA
+#define POLARSSL_ERR_ECP_BUFFER_TOO_SMALL MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
+#define POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_ECP_INVALID_KEY MBEDTLS_ERR_ECP_INVALID_KEY
+#define POLARSSL_ERR_ECP_MALLOC_FAILED MBEDTLS_ERR_ECP_ALLOC_FAILED
+#define POLARSSL_ERR_ECP_RANDOM_FAILED MBEDTLS_ERR_ECP_RANDOM_FAILED
+#define POLARSSL_ERR_ECP_SIG_LEN_MISMATCH MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH
+#define POLARSSL_ERR_ECP_VERIFY_FAILED MBEDTLS_ERR_ECP_VERIFY_FAILED
+#define POLARSSL_ERR_ENTROPY_FILE_IO_ERROR MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR
+#define POLARSSL_ERR_ENTROPY_MAX_SOURCES MBEDTLS_ERR_ENTROPY_MAX_SOURCES
+#define POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED
+#define POLARSSL_ERR_ENTROPY_SOURCE_FAILED MBEDTLS_ERR_ENTROPY_SOURCE_FAILED
+#define POLARSSL_ERR_GCM_AUTH_FAILED MBEDTLS_ERR_GCM_AUTH_FAILED
+#define POLARSSL_ERR_GCM_BAD_INPUT MBEDTLS_ERR_GCM_BAD_INPUT
+#define POLARSSL_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED
+#define POLARSSL_ERR_HMAC_DRBG_FILE_IO_ERROR MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR
+#define POLARSSL_ERR_HMAC_DRBG_INPUT_TOO_BIG MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG
+#define POLARSSL_ERR_HMAC_DRBG_REQUEST_TOO_BIG MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG
+#define POLARSSL_ERR_MD_ALLOC_FAILED MBEDTLS_ERR_MD_ALLOC_FAILED
+#define POLARSSL_ERR_MD_BAD_INPUT_DATA MBEDTLS_ERR_MD_BAD_INPUT_DATA
+#define POLARSSL_ERR_MD_FEATURE_UNAVAILABLE MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_MD_FILE_IO_ERROR MBEDTLS_ERR_MD_FILE_IO_ERROR
+#define POLARSSL_ERR_MPI_BAD_INPUT_DATA MBEDTLS_ERR_MPI_BAD_INPUT_DATA
+#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL
+#define POLARSSL_ERR_MPI_DIVISION_BY_ZERO MBEDTLS_ERR_MPI_DIVISION_BY_ZERO
+#define POLARSSL_ERR_MPI_FILE_IO_ERROR MBEDTLS_ERR_MPI_FILE_IO_ERROR
+#define POLARSSL_ERR_MPI_INVALID_CHARACTER MBEDTLS_ERR_MPI_INVALID_CHARACTER
+#define POLARSSL_ERR_MPI_MALLOC_FAILED MBEDTLS_ERR_MPI_ALLOC_FAILED
+#define POLARSSL_ERR_MPI_NEGATIVE_VALUE MBEDTLS_ERR_MPI_NEGATIVE_VALUE
+#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE MBEDTLS_ERR_MPI_NOT_ACCEPTABLE
+#define POLARSSL_ERR_NET_ACCEPT_FAILED MBEDTLS_ERR_NET_ACCEPT_FAILED
+#define POLARSSL_ERR_NET_BIND_FAILED MBEDTLS_ERR_NET_BIND_FAILED
+#define POLARSSL_ERR_NET_CONNECT_FAILED MBEDTLS_ERR_NET_CONNECT_FAILED
+#define POLARSSL_ERR_NET_CONN_RESET MBEDTLS_ERR_NET_CONN_RESET
+#define POLARSSL_ERR_NET_LISTEN_FAILED MBEDTLS_ERR_NET_LISTEN_FAILED
+#define POLARSSL_ERR_NET_RECV_FAILED MBEDTLS_ERR_NET_RECV_FAILED
+#define POLARSSL_ERR_NET_SEND_FAILED MBEDTLS_ERR_NET_SEND_FAILED
+#define POLARSSL_ERR_NET_SOCKET_FAILED MBEDTLS_ERR_NET_SOCKET_FAILED
+#define POLARSSL_ERR_NET_TIMEOUT MBEDTLS_ERR_SSL_TIMEOUT
+#define POLARSSL_ERR_NET_UNKNOWN_HOST MBEDTLS_ERR_NET_UNKNOWN_HOST
+#define POLARSSL_ERR_NET_WANT_READ MBEDTLS_ERR_SSL_WANT_READ
+#define POLARSSL_ERR_NET_WANT_WRITE MBEDTLS_ERR_SSL_WANT_WRITE
+#define POLARSSL_ERR_OID_BUF_TOO_SMALL MBEDTLS_ERR_OID_BUF_TOO_SMALL
+#define POLARSSL_ERR_OID_NOT_FOUND MBEDTLS_ERR_OID_NOT_FOUND
+#define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED
+#define POLARSSL_ERR_PEM_BAD_INPUT_DATA MBEDTLS_ERR_PEM_BAD_INPUT_DATA
+#define POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_PEM_INVALID_DATA MBEDTLS_ERR_PEM_INVALID_DATA
+#define POLARSSL_ERR_PEM_INVALID_ENC_IV MBEDTLS_ERR_PEM_INVALID_ENC_IV
+#define POLARSSL_ERR_PEM_MALLOC_FAILED MBEDTLS_ERR_PEM_ALLOC_FAILED
+#define POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT
+#define POLARSSL_ERR_PEM_PASSWORD_MISMATCH MBEDTLS_ERR_PEM_PASSWORD_MISMATCH
+#define POLARSSL_ERR_PEM_PASSWORD_REQUIRED MBEDTLS_ERR_PEM_PASSWORD_REQUIRED
+#define POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG
+#define POLARSSL_ERR_PKCS12_BAD_INPUT_DATA MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
+#define POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_PKCS12_PASSWORD_MISMATCH MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH
+#define POLARSSL_ERR_PKCS12_PBE_INVALID_FORMAT MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT
+#define POLARSSL_ERR_PKCS5_BAD_INPUT_DATA MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA
+#define POLARSSL_ERR_PKCS5_FEATURE_UNAVAILABLE MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_PKCS5_INVALID_FORMAT MBEDTLS_ERR_PKCS5_INVALID_FORMAT
+#define POLARSSL_ERR_PKCS5_PASSWORD_MISMATCH MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH
+#define POLARSSL_ERR_PK_BAD_INPUT_DATA MBEDTLS_ERR_PK_BAD_INPUT_DATA
+#define POLARSSL_ERR_PK_FEATURE_UNAVAILABLE MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_PK_FILE_IO_ERROR MBEDTLS_ERR_PK_FILE_IO_ERROR
+#define POLARSSL_ERR_PK_INVALID_ALG MBEDTLS_ERR_PK_INVALID_ALG
+#define POLARSSL_ERR_PK_INVALID_PUBKEY MBEDTLS_ERR_PK_INVALID_PUBKEY
+#define POLARSSL_ERR_PK_KEY_INVALID_FORMAT MBEDTLS_ERR_PK_KEY_INVALID_FORMAT
+#define POLARSSL_ERR_PK_KEY_INVALID_VERSION MBEDTLS_ERR_PK_KEY_INVALID_VERSION
+#define POLARSSL_ERR_PK_MALLOC_FAILED MBEDTLS_ERR_PK_ALLOC_FAILED
+#define POLARSSL_ERR_PK_PASSWORD_MISMATCH MBEDTLS_ERR_PK_PASSWORD_MISMATCH
+#define POLARSSL_ERR_PK_PASSWORD_REQUIRED MBEDTLS_ERR_PK_PASSWORD_REQUIRED
+#define POLARSSL_ERR_PK_SIG_LEN_MISMATCH MBEDTLS_ERR_PK_SIG_LEN_MISMATCH
+#define POLARSSL_ERR_PK_TYPE_MISMATCH MBEDTLS_ERR_PK_TYPE_MISMATCH
+#define POLARSSL_ERR_PK_UNKNOWN_NAMED_CURVE MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE
+#define POLARSSL_ERR_PK_UNKNOWN_PK_ALG MBEDTLS_ERR_PK_UNKNOWN_PK_ALG
+#define POLARSSL_ERR_RSA_BAD_INPUT_DATA MBEDTLS_ERR_RSA_BAD_INPUT_DATA
+#define POLARSSL_ERR_RSA_INVALID_PADDING MBEDTLS_ERR_RSA_INVALID_PADDING
+#define POLARSSL_ERR_RSA_KEY_CHECK_FAILED MBEDTLS_ERR_RSA_KEY_CHECK_FAILED
+#define POLARSSL_ERR_RSA_KEY_GEN_FAILED MBEDTLS_ERR_RSA_KEY_GEN_FAILED
+#define POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE
+#define POLARSSL_ERR_RSA_PRIVATE_FAILED MBEDTLS_ERR_RSA_PRIVATE_FAILED
+#define POLARSSL_ERR_RSA_PUBLIC_FAILED MBEDTLS_ERR_RSA_PUBLIC_FAILED
+#define POLARSSL_ERR_RSA_RNG_FAILED MBEDTLS_ERR_RSA_RNG_FAILED
+#define POLARSSL_ERR_RSA_VERIFY_FAILED MBEDTLS_ERR_RSA_VERIFY_FAILED
+#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE
+#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST
+#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY
+#define POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC
+#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO
+#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE
+#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS
+#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP
+#define POLARSSL_ERR_SSL_BAD_HS_FINISHED MBEDTLS_ERR_SSL_BAD_HS_FINISHED
+#define POLARSSL_ERR_SSL_BAD_HS_NEW_SESSION_TICKET MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET
+#define POLARSSL_ERR_SSL_BAD_HS_PROTOCOL_VERSION MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION
+#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO
+#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE
+#define POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE
+#define POLARSSL_ERR_SSL_BAD_INPUT_DATA MBEDTLS_ERR_SSL_BAD_INPUT_DATA
+#define POLARSSL_ERR_SSL_BUFFER_TOO_SMALL MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL
+#define POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED
+#define POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED
+#define POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE
+#define POLARSSL_ERR_SSL_COMPRESSION_FAILED MBEDTLS_ERR_SSL_COMPRESSION_FAILED
+#define POLARSSL_ERR_SSL_CONN_EOF MBEDTLS_ERR_SSL_CONN_EOF
+#define POLARSSL_ERR_SSL_COUNTER_WRAPPING MBEDTLS_ERR_SSL_COUNTER_WRAPPING
+#define POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE
+#define POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_SSL_HELLO_VERIFY_REQUIRED MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
+#define POLARSSL_ERR_SSL_HW_ACCEL_FAILED MBEDTLS_ERR_SSL_HW_ACCEL_FAILED
+#define POLARSSL_ERR_SSL_HW_ACCEL_FALLTHROUGH MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH
+#define POLARSSL_ERR_SSL_INTERNAL_ERROR MBEDTLS_ERR_SSL_INTERNAL_ERROR
+#define POLARSSL_ERR_SSL_INVALID_MAC MBEDTLS_ERR_SSL_INVALID_MAC
+#define POLARSSL_ERR_SSL_INVALID_RECORD MBEDTLS_ERR_SSL_INVALID_RECORD
+#define POLARSSL_ERR_SSL_MALLOC_FAILED MBEDTLS_ERR_SSL_ALLOC_FAILED
+#define POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN
+#define POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE
+#define POLARSSL_ERR_SSL_NO_RNG MBEDTLS_ERR_SSL_NO_RNG
+#define POLARSSL_ERR_SSL_NO_USABLE_CIPHERSUITE MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE
+#define POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY
+#define POLARSSL_ERR_SSL_PEER_VERIFY_FAILED MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED
+#define POLARSSL_ERR_SSL_PK_TYPE_MISMATCH MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH
+#define POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED
+#define POLARSSL_ERR_SSL_SESSION_TICKET_EXPIRED MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED
+#define POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE
+#define POLARSSL_ERR_SSL_UNKNOWN_CIPHER MBEDTLS_ERR_SSL_UNKNOWN_CIPHER
+#define POLARSSL_ERR_SSL_UNKNOWN_IDENTITY MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY
+#define POLARSSL_ERR_SSL_WAITING_SERVER_HELLO_RENEGO MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO
+#define POLARSSL_ERR_THREADING_BAD_INPUT_DATA MBEDTLS_ERR_THREADING_BAD_INPUT_DATA
+#define POLARSSL_ERR_THREADING_FEATURE_UNAVAILABLE MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_THREADING_MUTEX_ERROR MBEDTLS_ERR_THREADING_MUTEX_ERROR
+#define POLARSSL_ERR_X509_BAD_INPUT_DATA MBEDTLS_ERR_X509_BAD_INPUT_DATA
+#define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT
+#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED MBEDTLS_ERR_X509_CERT_VERIFY_FAILED
+#define POLARSSL_ERR_X509_FEATURE_UNAVAILABLE MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE
+#define POLARSSL_ERR_X509_FILE_IO_ERROR MBEDTLS_ERR_X509_FILE_IO_ERROR
+#define POLARSSL_ERR_X509_INVALID_ALG MBEDTLS_ERR_X509_INVALID_ALG
+#define POLARSSL_ERR_X509_INVALID_DATE MBEDTLS_ERR_X509_INVALID_DATE
+#define POLARSSL_ERR_X509_INVALID_EXTENSIONS MBEDTLS_ERR_X509_INVALID_EXTENSIONS
+#define POLARSSL_ERR_X509_INVALID_FORMAT MBEDTLS_ERR_X509_INVALID_FORMAT
+#define POLARSSL_ERR_X509_INVALID_NAME MBEDTLS_ERR_X509_INVALID_NAME
+#define POLARSSL_ERR_X509_INVALID_SERIAL MBEDTLS_ERR_X509_INVALID_SERIAL
+#define POLARSSL_ERR_X509_INVALID_SIGNATURE MBEDTLS_ERR_X509_INVALID_SIGNATURE
+#define POLARSSL_ERR_X509_INVALID_VERSION MBEDTLS_ERR_X509_INVALID_VERSION
+#define POLARSSL_ERR_X509_MALLOC_FAILED MBEDTLS_ERR_X509_ALLOC_FAILED
+#define POLARSSL_ERR_X509_SIG_MISMATCH MBEDTLS_ERR_X509_SIG_MISMATCH
+#define POLARSSL_ERR_X509_UNKNOWN_OID MBEDTLS_ERR_X509_UNKNOWN_OID
+#define POLARSSL_ERR_X509_UNKNOWN_SIG_ALG MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG
+#define POLARSSL_ERR_X509_UNKNOWN_VERSION MBEDTLS_ERR_X509_UNKNOWN_VERSION
+#define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH
+#define POLARSSL_GCM_H MBEDTLS_GCM_H
+#define POLARSSL_HAVEGE_H MBEDTLS_HAVEGE_H
+#define POLARSSL_HAVE_INT32 MBEDTLS_HAVE_INT32
+#define POLARSSL_HAVE_INT64 MBEDTLS_HAVE_INT64
+#define POLARSSL_HAVE_UDBL MBEDTLS_HAVE_UDBL
+#define POLARSSL_HAVE_X86 MBEDTLS_HAVE_X86
+#define POLARSSL_HAVE_X86_64 MBEDTLS_HAVE_X86_64
+#define POLARSSL_HMAC_DRBG_H MBEDTLS_HMAC_DRBG_H
+#define POLARSSL_HMAC_DRBG_PR_OFF MBEDTLS_HMAC_DRBG_PR_OFF
+#define POLARSSL_HMAC_DRBG_PR_ON MBEDTLS_HMAC_DRBG_PR_ON
+#define POLARSSL_KEY_EXCHANGE_DHE_PSK MBEDTLS_KEY_EXCHANGE_DHE_PSK
+#define POLARSSL_KEY_EXCHANGE_DHE_RSA MBEDTLS_KEY_EXCHANGE_DHE_RSA
+#define POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA
+#define POLARSSL_KEY_EXCHANGE_ECDHE_PSK MBEDTLS_KEY_EXCHANGE_ECDHE_PSK
+#define POLARSSL_KEY_EXCHANGE_ECDHE_RSA MBEDTLS_KEY_EXCHANGE_ECDHE_RSA
+#define POLARSSL_KEY_EXCHANGE_ECDH_ECDSA MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA
+#define POLARSSL_KEY_EXCHANGE_ECDH_RSA MBEDTLS_KEY_EXCHANGE_ECDH_RSA
+#define POLARSSL_KEY_EXCHANGE_NONE MBEDTLS_KEY_EXCHANGE_NONE
+#define POLARSSL_KEY_EXCHANGE_PSK MBEDTLS_KEY_EXCHANGE_PSK
+#define POLARSSL_KEY_EXCHANGE_RSA MBEDTLS_KEY_EXCHANGE_RSA
+#define POLARSSL_KEY_EXCHANGE_RSA_PSK MBEDTLS_KEY_EXCHANGE_RSA_PSK
+#define POLARSSL_KEY_EXCHANGE__SOME__ECDHE_ENABLED MBEDTLS_KEY_EXCHANGE__SOME__ECDHE_ENABLED
+#define POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED
+#define POLARSSL_KEY_EXCHANGE__WITH_CERT__ENABLED MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED
+#define POLARSSL_KEY_LENGTH_DES MBEDTLS_KEY_LENGTH_DES
+#define POLARSSL_KEY_LENGTH_DES_EDE MBEDTLS_KEY_LENGTH_DES_EDE
+#define POLARSSL_KEY_LENGTH_DES_EDE3 MBEDTLS_KEY_LENGTH_DES_EDE3
+#define POLARSSL_KEY_LENGTH_NONE MBEDTLS_KEY_LENGTH_NONE
+#define POLARSSL_MAX_BLOCK_LENGTH MBEDTLS_MAX_BLOCK_LENGTH
+#define POLARSSL_MAX_IV_LENGTH MBEDTLS_MAX_IV_LENGTH
+#define POLARSSL_MD2_H MBEDTLS_MD2_H
+#define POLARSSL_MD4_H MBEDTLS_MD4_H
+#define POLARSSL_MD5_H MBEDTLS_MD5_H
+#define POLARSSL_MD_H MBEDTLS_MD_H
+#define POLARSSL_MD_MAX_SIZE MBEDTLS_MD_MAX_SIZE
+#define POLARSSL_MD_MD2 MBEDTLS_MD_MD2
+#define POLARSSL_MD_MD4 MBEDTLS_MD_MD4
+#define POLARSSL_MD_MD5 MBEDTLS_MD_MD5
+#define POLARSSL_MD_NONE MBEDTLS_MD_NONE
+#define POLARSSL_MD_RIPEMD160 MBEDTLS_MD_RIPEMD160
+#define POLARSSL_MD_SHA1 MBEDTLS_MD_SHA1
+#define POLARSSL_MD_SHA224 MBEDTLS_MD_SHA224
+#define POLARSSL_MD_SHA256 MBEDTLS_MD_SHA256
+#define POLARSSL_MD_SHA384 MBEDTLS_MD_SHA384
+#define POLARSSL_MD_SHA512 MBEDTLS_MD_SHA512
+#define POLARSSL_MD_WRAP_H MBEDTLS_MD_WRAP_H
+#define POLARSSL_MEMORY_BUFFER_ALLOC_H MBEDTLS_MEMORY_BUFFER_ALLOC_H
+#define POLARSSL_MODE_CBC MBEDTLS_MODE_CBC
+#define POLARSSL_MODE_CCM MBEDTLS_MODE_CCM
+#define POLARSSL_MODE_CFB MBEDTLS_MODE_CFB
+#define POLARSSL_MODE_CTR MBEDTLS_MODE_CTR
+#define POLARSSL_MODE_ECB MBEDTLS_MODE_ECB
+#define POLARSSL_MODE_GCM MBEDTLS_MODE_GCM
+#define POLARSSL_MODE_NONE MBEDTLS_MODE_NONE
+#define POLARSSL_MODE_OFB MBEDTLS_MODE_OFB
+#define POLARSSL_MODE_STREAM MBEDTLS_MODE_STREAM
+#define POLARSSL_MPI_MAX_BITS MBEDTLS_MPI_MAX_BITS
+#define POLARSSL_MPI_MAX_BITS_SCALE100 MBEDTLS_MPI_MAX_BITS_SCALE100
+#define POLARSSL_MPI_MAX_LIMBS MBEDTLS_MPI_MAX_LIMBS
+#define POLARSSL_MPI_RW_BUFFER_SIZE MBEDTLS_MPI_RW_BUFFER_SIZE
+#define POLARSSL_NET_H MBEDTLS_NET_SOCKETS_H
+#define POLARSSL_NET_LISTEN_BACKLOG MBEDTLS_NET_LISTEN_BACKLOG
+#define POLARSSL_OID_H MBEDTLS_OID_H
+#define POLARSSL_OPERATION_NONE MBEDTLS_OPERATION_NONE
+#define POLARSSL_PADDING_NONE MBEDTLS_PADDING_NONE
+#define POLARSSL_PADDING_ONE_AND_ZEROS MBEDTLS_PADDING_ONE_AND_ZEROS
+#define POLARSSL_PADDING_PKCS7 MBEDTLS_PADDING_PKCS7
+#define POLARSSL_PADDING_ZEROS MBEDTLS_PADDING_ZEROS
+#define POLARSSL_PADDING_ZEROS_AND_LEN MBEDTLS_PADDING_ZEROS_AND_LEN
+#define POLARSSL_PADLOCK_H MBEDTLS_PADLOCK_H
+#define POLARSSL_PEM_H MBEDTLS_PEM_H
+#define POLARSSL_PKCS11_H MBEDTLS_PKCS11_H
+#define POLARSSL_PKCS12_H MBEDTLS_PKCS12_H
+#define POLARSSL_PKCS5_H MBEDTLS_PKCS5_H
+#define POLARSSL_PK_DEBUG_ECP MBEDTLS_PK_DEBUG_ECP
+#define POLARSSL_PK_DEBUG_MAX_ITEMS MBEDTLS_PK_DEBUG_MAX_ITEMS
+#define POLARSSL_PK_DEBUG_MPI MBEDTLS_PK_DEBUG_MPI
+#define POLARSSL_PK_DEBUG_NONE MBEDTLS_PK_DEBUG_NONE
+#define POLARSSL_PK_ECDSA MBEDTLS_PK_ECDSA
+#define POLARSSL_PK_ECKEY MBEDTLS_PK_ECKEY
+#define POLARSSL_PK_ECKEY_DH MBEDTLS_PK_ECKEY_DH
+#define POLARSSL_PK_H MBEDTLS_PK_H
+#define POLARSSL_PK_NONE MBEDTLS_PK_NONE
+#define POLARSSL_PK_RSA MBEDTLS_PK_RSA
+#define POLARSSL_PK_RSASSA_PSS MBEDTLS_PK_RSASSA_PSS
+#define POLARSSL_PK_RSA_ALT MBEDTLS_PK_RSA_ALT
+#define POLARSSL_PK_WRAP_H MBEDTLS_PK_WRAP_H
+#define POLARSSL_PLATFORM_H MBEDTLS_PLATFORM_H
+#define POLARSSL_PREMASTER_SIZE MBEDTLS_PREMASTER_SIZE
+#define POLARSSL_RIPEMD160_H MBEDTLS_RIPEMD160_H
+#define POLARSSL_RSA_H MBEDTLS_RSA_H
+#define POLARSSL_SHA1_H MBEDTLS_SHA1_H
+#define POLARSSL_SHA256_H MBEDTLS_SHA256_H
+#define POLARSSL_SHA512_H MBEDTLS_SHA512_H
+#define POLARSSL_SSL_CACHE_H MBEDTLS_SSL_CACHE_H
+#define POLARSSL_SSL_CIPHERSUITES_H MBEDTLS_SSL_CIPHERSUITES_H
+#define POLARSSL_SSL_COOKIE_H MBEDTLS_SSL_COOKIE_H
+#define POLARSSL_SSL_H MBEDTLS_SSL_H
+#define POLARSSL_THREADING_H MBEDTLS_THREADING_H
+#define POLARSSL_THREADING_IMPL MBEDTLS_THREADING_IMPL
+#define POLARSSL_TIMING_H MBEDTLS_TIMING_H
+#define POLARSSL_VERSION_H MBEDTLS_VERSION_H
+#define POLARSSL_VERSION_MAJOR MBEDTLS_VERSION_MAJOR
+#define POLARSSL_VERSION_MINOR MBEDTLS_VERSION_MINOR
+#define POLARSSL_VERSION_NUMBER MBEDTLS_VERSION_NUMBER
+#define POLARSSL_VERSION_PATCH MBEDTLS_VERSION_PATCH
+#define POLARSSL_VERSION_STRING MBEDTLS_VERSION_STRING
+#define POLARSSL_VERSION_STRING_FULL MBEDTLS_VERSION_STRING_FULL
+#define POLARSSL_X509_CRL_H MBEDTLS_X509_CRL_H
+#define POLARSSL_X509_CRT_H MBEDTLS_X509_CRT_H
+#define POLARSSL_X509_CSR_H MBEDTLS_X509_CSR_H
+#define POLARSSL_X509_H MBEDTLS_X509_H
+#define POLARSSL_XTEA_H MBEDTLS_XTEA_H
+#define RSA_CRYPT MBEDTLS_RSA_CRYPT
+#define RSA_PKCS_V15 MBEDTLS_RSA_PKCS_V15
+#define RSA_PKCS_V21 MBEDTLS_RSA_PKCS_V21
+#define RSA_PRIVATE MBEDTLS_RSA_PRIVATE
+#define RSA_PUBLIC MBEDTLS_RSA_PUBLIC
+#define RSA_SALT_LEN_ANY MBEDTLS_RSA_SALT_LEN_ANY
+#define RSA_SIGN MBEDTLS_RSA_SIGN
+#define SSL_ALERT_LEVEL_FATAL MBEDTLS_SSL_ALERT_LEVEL_FATAL
+#define SSL_ALERT_LEVEL_WARNING MBEDTLS_SSL_ALERT_LEVEL_WARNING
+#define SSL_ALERT_MSG_ACCESS_DENIED MBEDTLS_SSL_ALERT_MSG_ACCESS_DENIED
+#define SSL_ALERT_MSG_BAD_CERT MBEDTLS_SSL_ALERT_MSG_BAD_CERT
+#define SSL_ALERT_MSG_BAD_RECORD_MAC MBEDTLS_SSL_ALERT_MSG_BAD_RECORD_MAC
+#define SSL_ALERT_MSG_CERT_EXPIRED MBEDTLS_SSL_ALERT_MSG_CERT_EXPIRED
+#define SSL_ALERT_MSG_CERT_REVOKED MBEDTLS_SSL_ALERT_MSG_CERT_REVOKED
+#define SSL_ALERT_MSG_CERT_UNKNOWN MBEDTLS_SSL_ALERT_MSG_CERT_UNKNOWN
+#define SSL_ALERT_MSG_CLOSE_NOTIFY MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY
+#define SSL_ALERT_MSG_DECODE_ERROR MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR
+#define SSL_ALERT_MSG_DECOMPRESSION_FAILURE MBEDTLS_SSL_ALERT_MSG_DECOMPRESSION_FAILURE
+#define SSL_ALERT_MSG_DECRYPTION_FAILED MBEDTLS_SSL_ALERT_MSG_DECRYPTION_FAILED
+#define SSL_ALERT_MSG_DECRYPT_ERROR MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR
+#define SSL_ALERT_MSG_EXPORT_RESTRICTION MBEDTLS_SSL_ALERT_MSG_EXPORT_RESTRICTION
+#define SSL_ALERT_MSG_HANDSHAKE_FAILURE MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE
+#define SSL_ALERT_MSG_ILLEGAL_PARAMETER MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER
+#define SSL_ALERT_MSG_INAPROPRIATE_FALLBACK MBEDTLS_SSL_ALERT_MSG_INAPROPRIATE_FALLBACK
+#define SSL_ALERT_MSG_INSUFFICIENT_SECURITY MBEDTLS_SSL_ALERT_MSG_INSUFFICIENT_SECURITY
+#define SSL_ALERT_MSG_INTERNAL_ERROR MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR
+#define SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL
+#define SSL_ALERT_MSG_NO_CERT MBEDTLS_SSL_ALERT_MSG_NO_CERT
+#define SSL_ALERT_MSG_NO_RENEGOTIATION MBEDTLS_SSL_ALERT_MSG_NO_RENEGOTIATION
+#define SSL_ALERT_MSG_PROTOCOL_VERSION MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION
+#define SSL_ALERT_MSG_RECORD_OVERFLOW MBEDTLS_SSL_ALERT_MSG_RECORD_OVERFLOW
+#define SSL_ALERT_MSG_UNEXPECTED_MESSAGE MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE
+#define SSL_ALERT_MSG_UNKNOWN_CA MBEDTLS_SSL_ALERT_MSG_UNKNOWN_CA
+#define SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY
+#define SSL_ALERT_MSG_UNRECOGNIZED_NAME MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME
+#define SSL_ALERT_MSG_UNSUPPORTED_CERT MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_CERT
+#define SSL_ALERT_MSG_UNSUPPORTED_EXT MBEDTLS_SSL_ALERT_MSG_UNSUPPORTED_EXT
+#define SSL_ALERT_MSG_USER_CANCELED MBEDTLS_SSL_ALERT_MSG_USER_CANCELED
+#define SSL_ANTI_REPLAY_DISABLED MBEDTLS_SSL_ANTI_REPLAY_DISABLED
+#define SSL_ANTI_REPLAY_ENABLED MBEDTLS_SSL_ANTI_REPLAY_ENABLED
+#define SSL_ARC4_DISABLED MBEDTLS_SSL_ARC4_DISABLED
+#define SSL_ARC4_ENABLED MBEDTLS_SSL_ARC4_ENABLED
+#define SSL_BUFFER_LEN ( ( ( MBEDTLS_SSL_IN_BUFFER_LEN ) < ( MBEDTLS_SSL_OUT_BUFFER_LEN ) ) \
+                         ? ( MBEDTLS_SSL_IN_BUFFER_LEN ) : ( MBEDTLS_SSL_OUT_BUFFER_LEN ) )
+#define SSL_CACHE_DEFAULT_MAX_ENTRIES MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES
+#define SSL_CACHE_DEFAULT_TIMEOUT MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT
+#define SSL_CBC_RECORD_SPLITTING_DISABLED MBEDTLS_SSL_CBC_RECORD_SPLITTING_DISABLED
+#define SSL_CBC_RECORD_SPLITTING_ENABLED MBEDTLS_SSL_CBC_RECORD_SPLITTING_ENABLED
+#define SSL_CERTIFICATE_REQUEST MBEDTLS_SSL_CERTIFICATE_REQUEST
+#define SSL_CERTIFICATE_VERIFY MBEDTLS_SSL_CERTIFICATE_VERIFY
+#define SSL_CERT_TYPE_ECDSA_SIGN MBEDTLS_SSL_CERT_TYPE_ECDSA_SIGN
+#define SSL_CERT_TYPE_RSA_SIGN MBEDTLS_SSL_CERT_TYPE_RSA_SIGN
+#define SSL_CHANNEL_INBOUND MBEDTLS_SSL_CHANNEL_INBOUND
+#define SSL_CHANNEL_OUTBOUND MBEDTLS_SSL_CHANNEL_OUTBOUND
+#define SSL_CIPHERSUITES MBEDTLS_SSL_CIPHERSUITES
+#define SSL_CLIENT_CERTIFICATE MBEDTLS_SSL_CLIENT_CERTIFICATE
+#define SSL_CLIENT_CHANGE_CIPHER_SPEC MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC
+#define SSL_CLIENT_FINISHED MBEDTLS_SSL_CLIENT_FINISHED
+#define SSL_CLIENT_HELLO MBEDTLS_SSL_CLIENT_HELLO
+#define SSL_CLIENT_KEY_EXCHANGE MBEDTLS_SSL_CLIENT_KEY_EXCHANGE
+#define SSL_COMPRESSION_ADD MBEDTLS_SSL_COMPRESSION_ADD
+#define SSL_COMPRESS_DEFLATE MBEDTLS_SSL_COMPRESS_DEFLATE
+#define SSL_COMPRESS_NULL MBEDTLS_SSL_COMPRESS_NULL
+#define SSL_DEBUG_BUF MBEDTLS_SSL_DEBUG_BUF
+#define SSL_DEBUG_CRT MBEDTLS_SSL_DEBUG_CRT
+#define SSL_DEBUG_ECP MBEDTLS_SSL_DEBUG_ECP
+#define SSL_DEBUG_MPI MBEDTLS_SSL_DEBUG_MPI
+#define SSL_DEBUG_MSG MBEDTLS_SSL_DEBUG_MSG
+#define SSL_DEBUG_RET MBEDTLS_SSL_DEBUG_RET
+#define SSL_DEFAULT_TICKET_LIFETIME MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME
+#define SSL_DTLS_TIMEOUT_DFL_MAX MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MAX
+#define SSL_DTLS_TIMEOUT_DFL_MIN MBEDTLS_SSL_DTLS_TIMEOUT_DFL_MIN
+#define SSL_EMPTY_RENEGOTIATION_INFO MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO
+#define SSL_ETM_DISABLED MBEDTLS_SSL_ETM_DISABLED
+#define SSL_ETM_ENABLED MBEDTLS_SSL_ETM_ENABLED
+#define SSL_EXTENDED_MS_DISABLED MBEDTLS_SSL_EXTENDED_MS_DISABLED
+#define SSL_EXTENDED_MS_ENABLED MBEDTLS_SSL_EXTENDED_MS_ENABLED
+#define SSL_FALLBACK_SCSV MBEDTLS_SSL_FALLBACK_SCSV
+#define SSL_FLUSH_BUFFERS MBEDTLS_SSL_FLUSH_BUFFERS
+#define SSL_HANDSHAKE_OVER MBEDTLS_SSL_HANDSHAKE_OVER
+#define SSL_HANDSHAKE_WRAPUP MBEDTLS_SSL_HANDSHAKE_WRAPUP
+#define SSL_HASH_MD5 MBEDTLS_SSL_HASH_MD5
+#define SSL_HASH_NONE MBEDTLS_SSL_HASH_NONE
+#define SSL_HASH_SHA1 MBEDTLS_SSL_HASH_SHA1
+#define SSL_HASH_SHA224 MBEDTLS_SSL_HASH_SHA224
+#define SSL_HASH_SHA256 MBEDTLS_SSL_HASH_SHA256
+#define SSL_HASH_SHA384 MBEDTLS_SSL_HASH_SHA384
+#define SSL_HASH_SHA512 MBEDTLS_SSL_HASH_SHA512
+#define SSL_HELLO_REQUEST MBEDTLS_SSL_HELLO_REQUEST
+#define SSL_HS_CERTIFICATE MBEDTLS_SSL_HS_CERTIFICATE
+#define SSL_HS_CERTIFICATE_REQUEST MBEDTLS_SSL_HS_CERTIFICATE_REQUEST
+#define SSL_HS_CERTIFICATE_VERIFY MBEDTLS_SSL_HS_CERTIFICATE_VERIFY
+#define SSL_HS_CLIENT_HELLO MBEDTLS_SSL_HS_CLIENT_HELLO
+#define SSL_HS_CLIENT_KEY_EXCHANGE MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE
+#define SSL_HS_FINISHED MBEDTLS_SSL_HS_FINISHED
+#define SSL_HS_HELLO_REQUEST MBEDTLS_SSL_HS_HELLO_REQUEST
+#define SSL_HS_HELLO_VERIFY_REQUEST MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST
+#define SSL_HS_NEW_SESSION_TICKET MBEDTLS_SSL_HS_NEW_SESSION_TICKET
+#define SSL_HS_SERVER_HELLO MBEDTLS_SSL_HS_SERVER_HELLO
+#define SSL_HS_SERVER_HELLO_DONE MBEDTLS_SSL_HS_SERVER_HELLO_DONE
+#define SSL_HS_SERVER_KEY_EXCHANGE MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE
+#define SSL_INITIAL_HANDSHAKE MBEDTLS_SSL_INITIAL_HANDSHAKE
+#define SSL_IS_CLIENT MBEDTLS_SSL_IS_CLIENT
+#define SSL_IS_FALLBACK MBEDTLS_SSL_IS_FALLBACK
+#define SSL_IS_NOT_FALLBACK MBEDTLS_SSL_IS_NOT_FALLBACK
+#define SSL_IS_SERVER MBEDTLS_SSL_IS_SERVER
+#define SSL_LEGACY_ALLOW_RENEGOTIATION MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION
+#define SSL_LEGACY_BREAK_HANDSHAKE MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE
+#define SSL_LEGACY_NO_RENEGOTIATION MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION
+#define SSL_LEGACY_RENEGOTIATION MBEDTLS_SSL_LEGACY_RENEGOTIATION
+#define SSL_MAC_ADD MBEDTLS_SSL_MAC_ADD
+#define SSL_MAJOR_VERSION_3 MBEDTLS_SSL_MAJOR_VERSION_3
+#define SSL_MAX_CONTENT_LEN MBEDTLS_SSL_MAX_CONTENT_LEN
+#define SSL_MAX_FRAG_LEN_1024 MBEDTLS_SSL_MAX_FRAG_LEN_1024
+#define SSL_MAX_FRAG_LEN_2048 MBEDTLS_SSL_MAX_FRAG_LEN_2048
+#define SSL_MAX_FRAG_LEN_4096 MBEDTLS_SSL_MAX_FRAG_LEN_4096
+#define SSL_MAX_FRAG_LEN_512 MBEDTLS_SSL_MAX_FRAG_LEN_512
+#define SSL_MAX_FRAG_LEN_INVALID MBEDTLS_SSL_MAX_FRAG_LEN_INVALID
+#define SSL_MAX_FRAG_LEN_NONE MBEDTLS_SSL_MAX_FRAG_LEN_NONE
+#define SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAX_MAJOR_VERSION
+#define SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MAX_MINOR_VERSION
+#define SSL_MINOR_VERSION_0 MBEDTLS_SSL_MINOR_VERSION_0
+#define SSL_MINOR_VERSION_1 MBEDTLS_SSL_MINOR_VERSION_1
+#define SSL_MINOR_VERSION_2 MBEDTLS_SSL_MINOR_VERSION_2
+#define SSL_MINOR_VERSION_3 MBEDTLS_SSL_MINOR_VERSION_3
+#define SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MIN_MAJOR_VERSION
+#define SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MIN_MINOR_VERSION
+#define SSL_MSG_ALERT MBEDTLS_SSL_MSG_ALERT
+#define SSL_MSG_APPLICATION_DATA MBEDTLS_SSL_MSG_APPLICATION_DATA
+#define SSL_MSG_CHANGE_CIPHER_SPEC MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC
+#define SSL_MSG_HANDSHAKE MBEDTLS_SSL_MSG_HANDSHAKE
+#define SSL_PADDING_ADD MBEDTLS_SSL_PADDING_ADD
+#define SSL_RENEGOTIATION MBEDTLS_SSL_RENEGOTIATION
+#define SSL_RENEGOTIATION_DISABLED MBEDTLS_SSL_RENEGOTIATION_DISABLED
+#define SSL_RENEGOTIATION_DONE MBEDTLS_SSL_RENEGOTIATION_DONE
+#define SSL_RENEGOTIATION_ENABLED MBEDTLS_SSL_RENEGOTIATION_ENABLED
+#define SSL_RENEGOTIATION_NOT_ENFORCED MBEDTLS_SSL_RENEGOTIATION_NOT_ENFORCED
+#define SSL_RENEGOTIATION_PENDING MBEDTLS_SSL_RENEGOTIATION_PENDING
+#define SSL_RENEGO_MAX_RECORDS_DEFAULT MBEDTLS_SSL_RENEGO_MAX_RECORDS_DEFAULT
+#define SSL_RETRANS_FINISHED MBEDTLS_SSL_RETRANS_FINISHED
+#define SSL_RETRANS_PREPARING MBEDTLS_SSL_RETRANS_PREPARING
+#define SSL_RETRANS_SENDING MBEDTLS_SSL_RETRANS_SENDING
+#define SSL_RETRANS_WAITING MBEDTLS_SSL_RETRANS_WAITING
+#define SSL_SECURE_RENEGOTIATION MBEDTLS_SSL_SECURE_RENEGOTIATION
+#define SSL_SERVER_CERTIFICATE MBEDTLS_SSL_SERVER_CERTIFICATE
+#define SSL_SERVER_CHANGE_CIPHER_SPEC MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC
+#define SSL_SERVER_FINISHED MBEDTLS_SSL_SERVER_FINISHED
+#define SSL_SERVER_HELLO MBEDTLS_SSL_SERVER_HELLO
+#define SSL_SERVER_HELLO_DONE MBEDTLS_SSL_SERVER_HELLO_DONE
+#define SSL_SERVER_HELLO_VERIFY_REQUEST_SENT MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT
+#define SSL_SERVER_KEY_EXCHANGE MBEDTLS_SSL_SERVER_KEY_EXCHANGE
+#define SSL_SERVER_NEW_SESSION_TICKET MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET
+#define SSL_SESSION_TICKETS_DISABLED MBEDTLS_SSL_SESSION_TICKETS_DISABLED
+#define SSL_SESSION_TICKETS_ENABLED MBEDTLS_SSL_SESSION_TICKETS_ENABLED
+#define SSL_SIG_ANON MBEDTLS_SSL_SIG_ANON
+#define SSL_SIG_ECDSA MBEDTLS_SSL_SIG_ECDSA
+#define SSL_SIG_RSA MBEDTLS_SSL_SIG_RSA
+#define SSL_TRANSPORT_DATAGRAM MBEDTLS_SSL_TRANSPORT_DATAGRAM
+#define SSL_TRANSPORT_STREAM MBEDTLS_SSL_TRANSPORT_STREAM
+#define SSL_TRUNCATED_HMAC_LEN MBEDTLS_SSL_TRUNCATED_HMAC_LEN
+#define SSL_TRUNC_HMAC_DISABLED MBEDTLS_SSL_TRUNC_HMAC_DISABLED
+#define SSL_TRUNC_HMAC_ENABLED MBEDTLS_SSL_TRUNC_HMAC_ENABLED
+#define SSL_VERIFY_DATA_MAX_LEN MBEDTLS_SSL_VERIFY_DATA_MAX_LEN
+#define SSL_VERIFY_NONE MBEDTLS_SSL_VERIFY_NONE
+#define SSL_VERIFY_OPTIONAL MBEDTLS_SSL_VERIFY_OPTIONAL
+#define SSL_VERIFY_REQUIRED MBEDTLS_SSL_VERIFY_REQUIRED
+#define TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
+#define TLS_DHE_PSK_WITH_AES_128_CBC_SHA MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
+#define TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
+#define TLS_DHE_PSK_WITH_AES_128_CCM MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM
+#define TLS_DHE_PSK_WITH_AES_128_CCM_8 MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CCM_8
+#define TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
+#define TLS_DHE_PSK_WITH_AES_256_CBC_SHA MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
+#define TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
+#define TLS_DHE_PSK_WITH_AES_256_CCM MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM
+#define TLS_DHE_PSK_WITH_AES_256_CCM_8 MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CCM_8
+#define TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
+#define TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_DHE_PSK_WITH_NULL_SHA MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA
+#define TLS_DHE_PSK_WITH_NULL_SHA256 MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256
+#define TLS_DHE_PSK_WITH_NULL_SHA384 MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384
+#define TLS_DHE_PSK_WITH_RC4_128_SHA MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
+#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
+#define TLS_DHE_RSA_WITH_AES_128_CCM MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM
+#define TLS_DHE_RSA_WITH_AES_128_CCM_8 MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CCM_8
+#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
+#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
+#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+#define TLS_DHE_RSA_WITH_AES_256_CCM MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM
+#define TLS_DHE_RSA_WITH_AES_256_CCM_8 MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CCM_8
+#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
+#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
+#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
+#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
+#define TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_DHE_RSA_WITH_DES_CBC_SHA MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA
+#define TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
+#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
+#define TLS_ECDHE_ECDSA_WITH_AES_128_CCM MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM
+#define TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
+#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
+#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
+#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
+#define TLS_ECDHE_ECDSA_WITH_AES_256_CCM MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM
+#define TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8
+#define TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
+#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_ECDHE_ECDSA_WITH_NULL_SHA MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA
+#define TLS_ECDHE_ECDSA_WITH_RC4_128_SHA MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
+#define TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
+#define TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
+#define TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
+#define TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
+#define TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
+#define TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_ECDHE_PSK_WITH_NULL_SHA MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA
+#define TLS_ECDHE_PSK_WITH_NULL_SHA256 MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256
+#define TLS_ECDHE_PSK_WITH_NULL_SHA384 MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384
+#define TLS_ECDHE_PSK_WITH_RC4_128_SHA MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
+#define TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
+#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
+#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
+#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
+#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
+#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#define TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_ECDHE_RSA_WITH_NULL_SHA MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA
+#define TLS_ECDHE_RSA_WITH_RC4_128_SHA MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
+#define TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
+#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
+#define TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
+#define TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
+#define TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
+#define TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
+#define TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_ECDH_ECDSA_WITH_NULL_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA
+#define TLS_ECDH_ECDSA_WITH_RC4_128_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
+#define TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_ECDH_RSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
+#define TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
+#define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
+#define TLS_ECDH_RSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
+#define TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
+#define TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
+#define TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_ECDH_RSA_WITH_NULL_SHA MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA
+#define TLS_ECDH_RSA_WITH_RC4_128_SHA MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
+#define TLS_EXT_ALPN MBEDTLS_TLS_EXT_ALPN
+#define TLS_EXT_ENCRYPT_THEN_MAC MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC
+#define TLS_EXT_EXTENDED_MASTER_SECRET MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET
+#define TLS_EXT_MAX_FRAGMENT_LENGTH MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH
+#define TLS_EXT_RENEGOTIATION_INFO MBEDTLS_TLS_EXT_RENEGOTIATION_INFO
+#define TLS_EXT_SERVERNAME MBEDTLS_TLS_EXT_SERVERNAME
+#define TLS_EXT_SERVERNAME_HOSTNAME MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME
+#define TLS_EXT_SESSION_TICKET MBEDTLS_TLS_EXT_SESSION_TICKET
+#define TLS_EXT_SIG_ALG MBEDTLS_TLS_EXT_SIG_ALG
+#define TLS_EXT_SUPPORTED_ELLIPTIC_CURVES MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES
+#define TLS_EXT_SUPPORTED_POINT_FORMATS MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS
+#define TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT
+#define TLS_EXT_TRUNCATED_HMAC MBEDTLS_TLS_EXT_TRUNCATED_HMAC
+#define TLS_PSK_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
+#define TLS_PSK_WITH_AES_128_CBC_SHA MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
+#define TLS_PSK_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
+#define TLS_PSK_WITH_AES_128_CCM MBEDTLS_TLS_PSK_WITH_AES_128_CCM
+#define TLS_PSK_WITH_AES_128_CCM_8 MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8
+#define TLS_PSK_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
+#define TLS_PSK_WITH_AES_256_CBC_SHA MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
+#define TLS_PSK_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
+#define TLS_PSK_WITH_AES_256_CCM MBEDTLS_TLS_PSK_WITH_AES_256_CCM
+#define TLS_PSK_WITH_AES_256_CCM_8 MBEDTLS_TLS_PSK_WITH_AES_256_CCM_8
+#define TLS_PSK_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
+#define TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_PSK_WITH_NULL_SHA MBEDTLS_TLS_PSK_WITH_NULL_SHA
+#define TLS_PSK_WITH_NULL_SHA256 MBEDTLS_TLS_PSK_WITH_NULL_SHA256
+#define TLS_PSK_WITH_NULL_SHA384 MBEDTLS_TLS_PSK_WITH_NULL_SHA384
+#define TLS_PSK_WITH_RC4_128_SHA MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
+#define TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
+#define TLS_RSA_PSK_WITH_AES_128_CBC_SHA MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
+#define TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
+#define TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
+#define TLS_RSA_PSK_WITH_AES_256_CBC_SHA MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
+#define TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
+#define TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
+#define TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
+#define TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_RSA_PSK_WITH_NULL_SHA MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA
+#define TLS_RSA_PSK_WITH_NULL_SHA256 MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256
+#define TLS_RSA_PSK_WITH_NULL_SHA384 MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384
+#define TLS_RSA_PSK_WITH_RC4_128_SHA MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
+#define TLS_RSA_WITH_3DES_EDE_CBC_SHA MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
+#define TLS_RSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
+#define TLS_RSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
+#define TLS_RSA_WITH_AES_128_CCM MBEDTLS_TLS_RSA_WITH_AES_128_CCM
+#define TLS_RSA_WITH_AES_128_CCM_8 MBEDTLS_TLS_RSA_WITH_AES_128_CCM_8
+#define TLS_RSA_WITH_AES_128_GCM_SHA256 MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
+#define TLS_RSA_WITH_AES_256_CBC_SHA MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
+#define TLS_RSA_WITH_AES_256_CBC_SHA256 MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
+#define TLS_RSA_WITH_AES_256_CCM MBEDTLS_TLS_RSA_WITH_AES_256_CCM
+#define TLS_RSA_WITH_AES_256_CCM_8 MBEDTLS_TLS_RSA_WITH_AES_256_CCM_8
+#define TLS_RSA_WITH_AES_256_GCM_SHA384 MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
+#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
+#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
+#define TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
+#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
+#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
+#define TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
+#define TLS_RSA_WITH_DES_CBC_SHA MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA
+#define TLS_RSA_WITH_NULL_MD5 MBEDTLS_TLS_RSA_WITH_NULL_MD5
+#define TLS_RSA_WITH_NULL_SHA MBEDTLS_TLS_RSA_WITH_NULL_SHA
+#define TLS_RSA_WITH_NULL_SHA256 MBEDTLS_TLS_RSA_WITH_NULL_SHA256
+#define TLS_RSA_WITH_RC4_128_MD5 MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
+#define TLS_RSA_WITH_RC4_128_SHA MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
+#define X509_CRT_VERSION_1 MBEDTLS_X509_CRT_VERSION_1
+#define X509_CRT_VERSION_2 MBEDTLS_X509_CRT_VERSION_2
+#define X509_CRT_VERSION_3 MBEDTLS_X509_CRT_VERSION_3
+#define X509_FORMAT_DER MBEDTLS_X509_FORMAT_DER
+#define X509_FORMAT_PEM MBEDTLS_X509_FORMAT_PEM
+#define X509_MAX_DN_NAME_SIZE MBEDTLS_X509_MAX_DN_NAME_SIZE
+#define X509_RFC5280_MAX_SERIAL_LEN MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN
+#define X509_RFC5280_UTC_TIME_LEN MBEDTLS_X509_RFC5280_UTC_TIME_LEN
+#define XTEA_DECRYPT MBEDTLS_XTEA_DECRYPT
+#define XTEA_ENCRYPT MBEDTLS_XTEA_ENCRYPT
+#define _asn1_bitstring mbedtls_asn1_bitstring
+#define _asn1_buf mbedtls_asn1_buf
+#define _asn1_named_data mbedtls_asn1_named_data
+#define _asn1_sequence mbedtls_asn1_sequence
+#define _ssl_cache_context mbedtls_ssl_cache_context
+#define _ssl_cache_entry mbedtls_ssl_cache_entry
+#define _ssl_ciphersuite_t mbedtls_ssl_ciphersuite_t
+#define _ssl_context mbedtls_ssl_context
+#define _ssl_flight_item mbedtls_ssl_flight_item
+#define _ssl_handshake_params mbedtls_ssl_handshake_params
+#define _ssl_key_cert mbedtls_ssl_key_cert
+#define _ssl_premaster_secret mbedtls_ssl_premaster_secret
+#define _ssl_session mbedtls_ssl_session
+#define _ssl_transform mbedtls_ssl_transform
+#define _x509_crl mbedtls_x509_crl
+#define _x509_crl_entry mbedtls_x509_crl_entry
+#define _x509_crt mbedtls_x509_crt
+#define _x509_csr mbedtls_x509_csr
+#define _x509_time mbedtls_x509_time
+#define _x509write_cert mbedtls_x509write_cert
+#define _x509write_csr mbedtls_x509write_csr
+#define aes_context mbedtls_aes_context
+#define aes_crypt_cbc mbedtls_aes_crypt_cbc
+#define aes_crypt_cfb128 mbedtls_aes_crypt_cfb128
+#define aes_crypt_cfb8 mbedtls_aes_crypt_cfb8
+#define aes_crypt_ctr mbedtls_aes_crypt_ctr
+#define aes_crypt_ecb mbedtls_aes_crypt_ecb
+#define aes_free mbedtls_aes_free
+#define aes_init mbedtls_aes_init
+#define aes_self_test mbedtls_aes_self_test
+#define aes_setkey_dec mbedtls_aes_setkey_dec
+#define aes_setkey_enc mbedtls_aes_setkey_enc
+#define aesni_crypt_ecb mbedtls_aesni_crypt_ecb
+#define aesni_gcm_mult mbedtls_aesni_gcm_mult
+#define aesni_inverse_key mbedtls_aesni_inverse_key
+#define aesni_setkey_enc mbedtls_aesni_setkey_enc
+#define aesni_supports mbedtls_aesni_has_support
+#define alarmed mbedtls_timing_alarmed
+#define arc4_context mbedtls_arc4_context
+#define arc4_crypt mbedtls_arc4_crypt
+#define arc4_free mbedtls_arc4_free
+#define arc4_init mbedtls_arc4_init
+#define arc4_self_test mbedtls_arc4_self_test
+#define arc4_setup mbedtls_arc4_setup
+#define asn1_bitstring mbedtls_asn1_bitstring
+#define asn1_buf mbedtls_asn1_buf
+#define asn1_find_named_data mbedtls_asn1_find_named_data
+#define asn1_free_named_data mbedtls_asn1_free_named_data
+#define asn1_free_named_data_list mbedtls_asn1_free_named_data_list
+#define asn1_get_alg mbedtls_asn1_get_alg
+#define asn1_get_alg_null mbedtls_asn1_get_alg_null
+#define asn1_get_bitstring mbedtls_asn1_get_bitstring
+#define asn1_get_bitstring_null mbedtls_asn1_get_bitstring_null
+#define asn1_get_bool mbedtls_asn1_get_bool
+#define asn1_get_int mbedtls_asn1_get_int
+#define asn1_get_len mbedtls_asn1_get_len
+#define asn1_get_mpi mbedtls_asn1_get_mpi
+#define asn1_get_sequence_of mbedtls_asn1_get_sequence_of
+#define asn1_get_tag mbedtls_asn1_get_tag
+#define asn1_named_data mbedtls_asn1_named_data
+#define asn1_sequence mbedtls_asn1_sequence
+#define asn1_store_named_data mbedtls_asn1_store_named_data
+#define asn1_write_algorithm_identifier mbedtls_asn1_write_algorithm_identifier
+#define asn1_write_bitstring mbedtls_asn1_write_bitstring
+#define asn1_write_bool mbedtls_asn1_write_bool
+#define asn1_write_ia5_string mbedtls_asn1_write_ia5_string
+#define asn1_write_int mbedtls_asn1_write_int
+#define asn1_write_len mbedtls_asn1_write_len
+#define asn1_write_mpi mbedtls_asn1_write_mpi
+#define asn1_write_null mbedtls_asn1_write_null
+#define asn1_write_octet_string mbedtls_asn1_write_octet_string
+#define asn1_write_oid mbedtls_asn1_write_oid
+#define asn1_write_printable_string mbedtls_asn1_write_printable_string
+#define asn1_write_raw_buffer mbedtls_asn1_write_raw_buffer
+#define asn1_write_tag mbedtls_asn1_write_tag
+#define base64_decode mbedtls_base64_decode
+#define base64_encode mbedtls_base64_encode
+#define base64_self_test mbedtls_base64_self_test
+#define blowfish_context mbedtls_blowfish_context
+#define blowfish_crypt_cbc mbedtls_blowfish_crypt_cbc
+#define blowfish_crypt_cfb64 mbedtls_blowfish_crypt_cfb64
+#define blowfish_crypt_ctr mbedtls_blowfish_crypt_ctr
+#define blowfish_crypt_ecb mbedtls_blowfish_crypt_ecb
+#define blowfish_free mbedtls_blowfish_free
+#define blowfish_init mbedtls_blowfish_init
+#define blowfish_setkey mbedtls_blowfish_setkey
+#define camellia_context mbedtls_camellia_context
+#define camellia_crypt_cbc mbedtls_camellia_crypt_cbc
+#define camellia_crypt_cfb128 mbedtls_camellia_crypt_cfb128
+#define camellia_crypt_ctr mbedtls_camellia_crypt_ctr
+#define camellia_crypt_ecb mbedtls_camellia_crypt_ecb
+#define camellia_free mbedtls_camellia_free
+#define camellia_init mbedtls_camellia_init
+#define camellia_self_test mbedtls_camellia_self_test
+#define camellia_setkey_dec mbedtls_camellia_setkey_dec
+#define camellia_setkey_enc mbedtls_camellia_setkey_enc
+#define ccm_auth_decrypt mbedtls_ccm_auth_decrypt
+#define ccm_context mbedtls_ccm_context
+#define ccm_encrypt_and_tag mbedtls_ccm_encrypt_and_tag
+#define ccm_free mbedtls_ccm_free
+#define ccm_init mbedtls_ccm_init
+#define ccm_self_test mbedtls_ccm_self_test
+#define cipher_auth_decrypt mbedtls_cipher_auth_decrypt
+#define cipher_auth_encrypt mbedtls_cipher_auth_encrypt
+#define cipher_base_t mbedtls_cipher_base_t
+#define cipher_check_tag mbedtls_cipher_check_tag
+#define cipher_context_t mbedtls_cipher_context_t
+#define cipher_crypt mbedtls_cipher_crypt
+#define cipher_definition_t mbedtls_cipher_definition_t
+#define cipher_definitions mbedtls_cipher_definitions
+#define cipher_finish mbedtls_cipher_finish
+#define cipher_free mbedtls_cipher_free
+#define cipher_get_block_size mbedtls_cipher_get_block_size
+#define cipher_get_cipher_mode mbedtls_cipher_get_cipher_mode
+#define cipher_get_iv_size mbedtls_cipher_get_iv_size
+#define cipher_get_key_size mbedtls_cipher_get_key_bitlen
+#define cipher_get_name mbedtls_cipher_get_name
+#define cipher_get_operation mbedtls_cipher_get_operation
+#define cipher_get_type mbedtls_cipher_get_type
+#define cipher_id_t mbedtls_cipher_id_t
+#define cipher_info_from_string mbedtls_cipher_info_from_string
+#define cipher_info_from_type mbedtls_cipher_info_from_type
+#define cipher_info_from_values mbedtls_cipher_info_from_values
+#define cipher_info_t mbedtls_cipher_info_t
+#define cipher_init mbedtls_cipher_init
+#define cipher_init_ctx mbedtls_cipher_setup
+#define cipher_list mbedtls_cipher_list
+#define cipher_mode_t mbedtls_cipher_mode_t
+#define cipher_padding_t mbedtls_cipher_padding_t
+#define cipher_reset mbedtls_cipher_reset
+#define cipher_set_iv mbedtls_cipher_set_iv
+#define cipher_set_padding_mode mbedtls_cipher_set_padding_mode
+#define cipher_setkey mbedtls_cipher_setkey
+#define cipher_type_t mbedtls_cipher_type_t
+#define cipher_update mbedtls_cipher_update
+#define cipher_update_ad mbedtls_cipher_update_ad
+#define cipher_write_tag mbedtls_cipher_write_tag
+#define ctr_drbg_context mbedtls_ctr_drbg_context
+#define ctr_drbg_free mbedtls_ctr_drbg_free
+#define ctr_drbg_init mbedtls_ctr_drbg_init
+#define ctr_drbg_random mbedtls_ctr_drbg_random
+#define ctr_drbg_random_with_add mbedtls_ctr_drbg_random_with_add
+#define ctr_drbg_reseed mbedtls_ctr_drbg_reseed
+#define ctr_drbg_self_test mbedtls_ctr_drbg_self_test
+#define ctr_drbg_set_entropy_len mbedtls_ctr_drbg_set_entropy_len
+#define ctr_drbg_set_prediction_resistance mbedtls_ctr_drbg_set_prediction_resistance
+#define ctr_drbg_set_reseed_interval mbedtls_ctr_drbg_set_reseed_interval
+#define ctr_drbg_update mbedtls_ctr_drbg_update
+#define ctr_drbg_update_seed_file mbedtls_ctr_drbg_update_seed_file
+#define ctr_drbg_write_seed_file mbedtls_ctr_drbg_write_seed_file
+#define debug_print_buf mbedtls_debug_print_buf
+#define debug_print_crt mbedtls_debug_print_crt
+#define debug_print_ecp mbedtls_debug_print_ecp
+#define debug_print_mpi mbedtls_debug_print_mpi
+#define debug_print_msg mbedtls_debug_print_msg
+#define debug_print_ret mbedtls_debug_print_ret
+#define debug_set_threshold mbedtls_debug_set_threshold
+#define des3_context mbedtls_des3_context
+#define des3_crypt_cbc mbedtls_des3_crypt_cbc
+#define des3_crypt_ecb mbedtls_des3_crypt_ecb
+#define des3_free mbedtls_des3_free
+#define des3_init mbedtls_des3_init
+#define des3_set2key_dec mbedtls_des3_set2key_dec
+#define des3_set2key_enc mbedtls_des3_set2key_enc
+#define des3_set3key_dec mbedtls_des3_set3key_dec
+#define des3_set3key_enc mbedtls_des3_set3key_enc
+#define des_context mbedtls_des_context
+#define des_crypt_cbc mbedtls_des_crypt_cbc
+#define des_crypt_ecb mbedtls_des_crypt_ecb
+#define des_free mbedtls_des_free
+#define des_init mbedtls_des_init
+#define des_key_check_key_parity mbedtls_des_key_check_key_parity
+#define des_key_check_weak mbedtls_des_key_check_weak
+#define des_key_set_parity mbedtls_des_key_set_parity
+#define des_self_test mbedtls_des_self_test
+#define des_setkey_dec mbedtls_des_setkey_dec
+#define des_setkey_enc mbedtls_des_setkey_enc
+#define dhm_calc_secret mbedtls_dhm_calc_secret
+#define dhm_context mbedtls_dhm_context
+#define dhm_free mbedtls_dhm_free
+#define dhm_init mbedtls_dhm_init
+#define dhm_make_params mbedtls_dhm_make_params
+#define dhm_make_public mbedtls_dhm_make_public
+#define dhm_parse_dhm mbedtls_dhm_parse_dhm
+#define dhm_parse_dhmfile mbedtls_dhm_parse_dhmfile
+#define dhm_read_params mbedtls_dhm_read_params
+#define dhm_read_public mbedtls_dhm_read_public
+#define dhm_self_test mbedtls_dhm_self_test
+#define ecdh_calc_secret mbedtls_ecdh_calc_secret
+#define ecdh_compute_shared mbedtls_ecdh_compute_shared
+#define ecdh_context mbedtls_ecdh_context
+#define ecdh_free mbedtls_ecdh_free
+#define ecdh_gen_public mbedtls_ecdh_gen_public
+#define ecdh_get_params mbedtls_ecdh_get_params
+#define ecdh_init mbedtls_ecdh_init
+#define ecdh_make_params mbedtls_ecdh_make_params
+#define ecdh_make_public mbedtls_ecdh_make_public
+#define ecdh_read_params mbedtls_ecdh_read_params
+#define ecdh_read_public mbedtls_ecdh_read_public
+#define ecdh_side mbedtls_ecdh_side
+#define ecdsa_context mbedtls_ecdsa_context
+#define ecdsa_free mbedtls_ecdsa_free
+#define ecdsa_from_keypair mbedtls_ecdsa_from_keypair
+#define ecdsa_genkey mbedtls_ecdsa_genkey
+#define ecdsa_info mbedtls_ecdsa_info
+#define ecdsa_init mbedtls_ecdsa_init
+#define ecdsa_read_signature mbedtls_ecdsa_read_signature
+#define ecdsa_sign mbedtls_ecdsa_sign
+#define ecdsa_sign_det mbedtls_ecdsa_sign_det
+#define ecdsa_verify mbedtls_ecdsa_verify
+#define ecdsa_write_signature mbedtls_ecdsa_write_signature
+#define ecdsa_write_signature_det mbedtls_ecdsa_write_signature_det
+#define eckey_info mbedtls_eckey_info
+#define eckeydh_info mbedtls_eckeydh_info
+#define ecp_check_privkey mbedtls_ecp_check_privkey
+#define ecp_check_pub_priv mbedtls_ecp_check_pub_priv
+#define ecp_check_pubkey mbedtls_ecp_check_pubkey
+#define ecp_copy mbedtls_ecp_copy
+#define ecp_curve_info mbedtls_ecp_curve_info
+#define ecp_curve_info_from_grp_id mbedtls_ecp_curve_info_from_grp_id
+#define ecp_curve_info_from_name mbedtls_ecp_curve_info_from_name
+#define ecp_curve_info_from_tls_id mbedtls_ecp_curve_info_from_tls_id
+#define ecp_curve_list mbedtls_ecp_curve_list
+#define ecp_gen_key mbedtls_ecp_gen_key
+#define ecp_gen_keypair mbedtls_ecp_gen_keypair
+#define ecp_group mbedtls_ecp_group
+#define ecp_group_copy mbedtls_ecp_group_copy
+#define ecp_group_free mbedtls_ecp_group_free
+#define ecp_group_id mbedtls_ecp_group_id
+#define ecp_group_init mbedtls_ecp_group_init
+#define ecp_grp_id_list mbedtls_ecp_grp_id_list
+#define ecp_is_zero mbedtls_ecp_is_zero
+#define ecp_keypair mbedtls_ecp_keypair
+#define ecp_keypair_free mbedtls_ecp_keypair_free
+#define ecp_keypair_init mbedtls_ecp_keypair_init
+#define ecp_mul mbedtls_ecp_mul
+#define ecp_point mbedtls_ecp_point
+#define ecp_point_free mbedtls_ecp_point_free
+#define ecp_point_init mbedtls_ecp_point_init
+#define ecp_point_read_binary mbedtls_ecp_point_read_binary
+#define ecp_point_read_string mbedtls_ecp_point_read_string
+#define ecp_point_write_binary mbedtls_ecp_point_write_binary
+#define ecp_self_test mbedtls_ecp_self_test
+#define ecp_set_zero mbedtls_ecp_set_zero
+#define ecp_tls_read_group mbedtls_ecp_tls_read_group
+#define ecp_tls_read_point mbedtls_ecp_tls_read_point
+#define ecp_tls_write_group mbedtls_ecp_tls_write_group
+#define ecp_tls_write_point mbedtls_ecp_tls_write_point
+#define ecp_use_known_dp mbedtls_ecp_group_load
+#define entropy_add_source mbedtls_entropy_add_source
+#define entropy_context mbedtls_entropy_context
+#define entropy_free mbedtls_entropy_free
+#define entropy_func mbedtls_entropy_func
+#define entropy_gather mbedtls_entropy_gather
+#define entropy_init mbedtls_entropy_init
+#define entropy_self_test mbedtls_entropy_self_test
+#define entropy_update_manual mbedtls_entropy_update_manual
+#define entropy_update_seed_file mbedtls_entropy_update_seed_file
+#define entropy_write_seed_file mbedtls_entropy_write_seed_file
+#define error_strerror mbedtls_strerror
+#define f_source_ptr mbedtls_entropy_f_source_ptr
+#define gcm_auth_decrypt mbedtls_gcm_auth_decrypt
+#define gcm_context mbedtls_gcm_context
+#define gcm_crypt_and_tag mbedtls_gcm_crypt_and_tag
+#define gcm_finish mbedtls_gcm_finish
+#define gcm_free mbedtls_gcm_free
+#define gcm_init mbedtls_gcm_init
+#define gcm_self_test mbedtls_gcm_self_test
+#define gcm_starts mbedtls_gcm_starts
+#define gcm_update mbedtls_gcm_update
+#define get_timer mbedtls_timing_get_timer
+#define hardclock mbedtls_timing_hardclock
+#define hardclock_poll mbedtls_hardclock_poll
+#define havege_free mbedtls_havege_free
+#define havege_init mbedtls_havege_init
+#define havege_poll mbedtls_havege_poll
+#define havege_random mbedtls_havege_random
+#define havege_state mbedtls_havege_state
+#define hmac_drbg_context mbedtls_hmac_drbg_context
+#define hmac_drbg_free mbedtls_hmac_drbg_free
+#define hmac_drbg_init mbedtls_hmac_drbg_init
+#define hmac_drbg_random mbedtls_hmac_drbg_random
+#define hmac_drbg_random_with_add mbedtls_hmac_drbg_random_with_add
+#define hmac_drbg_reseed mbedtls_hmac_drbg_reseed
+#define hmac_drbg_self_test mbedtls_hmac_drbg_self_test
+#define hmac_drbg_set_entropy_len mbedtls_hmac_drbg_set_entropy_len
+#define hmac_drbg_set_prediction_resistance mbedtls_hmac_drbg_set_prediction_resistance
+#define hmac_drbg_set_reseed_interval mbedtls_hmac_drbg_set_reseed_interval
+#define hmac_drbg_update mbedtls_hmac_drbg_update
+#define hmac_drbg_update_seed_file mbedtls_hmac_drbg_update_seed_file
+#define hmac_drbg_write_seed_file mbedtls_hmac_drbg_write_seed_file
+#define hr_time mbedtls_timing_hr_time
+#define key_exchange_type_t mbedtls_key_exchange_type_t
+#define md mbedtls_md
+#define md2 mbedtls_md2
+#define md2_context mbedtls_md2_context
+#define md2_finish mbedtls_md2_finish
+#define md2_free mbedtls_md2_free
+#define md2_info mbedtls_md2_info
+#define md2_init mbedtls_md2_init
+#define md2_process mbedtls_md2_process
+#define md2_self_test mbedtls_md2_self_test
+#define md2_starts mbedtls_md2_starts
+#define md2_update mbedtls_md2_update
+#define md4 mbedtls_md4
+#define md4_context mbedtls_md4_context
+#define md4_finish mbedtls_md4_finish
+#define md4_free mbedtls_md4_free
+#define md4_info mbedtls_md4_info
+#define md4_init mbedtls_md4_init
+#define md4_process mbedtls_md4_process
+#define md4_self_test mbedtls_md4_self_test
+#define md4_starts mbedtls_md4_starts
+#define md4_update mbedtls_md4_update
+#define md5 mbedtls_md5
+#define md5_context mbedtls_md5_context
+#define md5_finish mbedtls_md5_finish
+#define md5_free mbedtls_md5_free
+#define md5_info mbedtls_md5_info
+#define md5_init mbedtls_md5_init
+#define md5_process mbedtls_md5_process
+#define md5_self_test mbedtls_md5_self_test
+#define md5_starts mbedtls_md5_starts
+#define md5_update mbedtls_md5_update
+#define md_context_t mbedtls_md_context_t
+#define md_file mbedtls_md_file
+#define md_finish mbedtls_md_finish
+#define md_free mbedtls_md_free
+#define md_get_name mbedtls_md_get_name
+#define md_get_size mbedtls_md_get_size
+#define md_get_type mbedtls_md_get_type
+#define md_hmac mbedtls_md_hmac
+#define md_hmac_finish mbedtls_md_hmac_finish
+#define md_hmac_reset mbedtls_md_hmac_reset
+#define md_hmac_starts mbedtls_md_hmac_starts
+#define md_hmac_update mbedtls_md_hmac_update
+#define md_info_from_string mbedtls_md_info_from_string
+#define md_info_from_type mbedtls_md_info_from_type
+#define md_info_t mbedtls_md_info_t
+#define md_init mbedtls_md_init
+#define md_init_ctx mbedtls_md_init_ctx
+#define md_list mbedtls_md_list
+#define md_process mbedtls_md_process
+#define md_starts mbedtls_md_starts
+#define md_type_t mbedtls_md_type_t
+#define md_update mbedtls_md_update
+#define memory_buffer_alloc_cur_get mbedtls_memory_buffer_alloc_cur_get
+#define memory_buffer_alloc_free mbedtls_memory_buffer_alloc_free
+#define memory_buffer_alloc_init mbedtls_memory_buffer_alloc_init
+#define memory_buffer_alloc_max_get mbedtls_memory_buffer_alloc_max_get
+#define memory_buffer_alloc_max_reset mbedtls_memory_buffer_alloc_max_reset
+#define memory_buffer_alloc_self_test mbedtls_memory_buffer_alloc_self_test
+#define memory_buffer_alloc_status mbedtls_memory_buffer_alloc_status
+#define memory_buffer_alloc_verify mbedtls_memory_buffer_alloc_verify
+#define memory_buffer_set_verify mbedtls_memory_buffer_set_verify
+#define mpi mbedtls_mpi
+#define mpi_add_abs mbedtls_mpi_add_abs
+#define mpi_add_int mbedtls_mpi_add_int
+#define mpi_add_mpi mbedtls_mpi_add_mpi
+#define mpi_cmp_abs mbedtls_mpi_cmp_abs
+#define mpi_cmp_int mbedtls_mpi_cmp_int
+#define mpi_cmp_mpi mbedtls_mpi_cmp_mpi
+#define mpi_copy mbedtls_mpi_copy
+#define mpi_div_int mbedtls_mpi_div_int
+#define mpi_div_mpi mbedtls_mpi_div_mpi
+#define mpi_exp_mod mbedtls_mpi_exp_mod
+#define mpi_fill_random mbedtls_mpi_fill_random
+#define mpi_free mbedtls_mpi_free
+#define mpi_gcd mbedtls_mpi_gcd
+#define mpi_gen_prime mbedtls_mpi_gen_prime
+#define mpi_get_bit mbedtls_mpi_get_bit
+#define mpi_grow mbedtls_mpi_grow
+#define mpi_init mbedtls_mpi_init
+#define mpi_inv_mod mbedtls_mpi_inv_mod
+#define mpi_is_prime mbedtls_mpi_is_prime
+#define mpi_lsb mbedtls_mpi_lsb
+#define mpi_lset mbedtls_mpi_lset
+#define mpi_mod_int mbedtls_mpi_mod_int
+#define mpi_mod_mpi mbedtls_mpi_mod_mpi
+#define mpi_msb mbedtls_mpi_bitlen
+#define mpi_mul_int mbedtls_mpi_mul_int
+#define mpi_mul_mpi mbedtls_mpi_mul_mpi
+#define mpi_read_binary mbedtls_mpi_read_binary
+#define mpi_read_file mbedtls_mpi_read_file
+#define mpi_read_string mbedtls_mpi_read_string
+#define mpi_safe_cond_assign mbedtls_mpi_safe_cond_assign
+#define mpi_safe_cond_swap mbedtls_mpi_safe_cond_swap
+#define mpi_self_test mbedtls_mpi_self_test
+#define mpi_set_bit mbedtls_mpi_set_bit
+#define mpi_shift_l mbedtls_mpi_shift_l
+#define mpi_shift_r mbedtls_mpi_shift_r
+#define mpi_shrink mbedtls_mpi_shrink
+#define mpi_size mbedtls_mpi_size
+#define mpi_sub_abs mbedtls_mpi_sub_abs
+#define mpi_sub_int mbedtls_mpi_sub_int
+#define mpi_sub_mpi mbedtls_mpi_sub_mpi
+#define mpi_swap mbedtls_mpi_swap
+#define mpi_write_binary mbedtls_mpi_write_binary
+#define mpi_write_file mbedtls_mpi_write_file
+#define mpi_write_string mbedtls_mpi_write_string
+#define net_accept mbedtls_net_accept
+#define net_bind mbedtls_net_bind
+#define net_close mbedtls_net_free
+#define net_connect mbedtls_net_connect
+#define net_recv mbedtls_net_recv
+#define net_recv_timeout mbedtls_net_recv_timeout
+#define net_send mbedtls_net_send
+#define net_set_block mbedtls_net_set_block
+#define net_set_nonblock mbedtls_net_set_nonblock
+#define net_usleep mbedtls_net_usleep
+#define oid_descriptor_t mbedtls_oid_descriptor_t
+#define oid_get_attr_short_name mbedtls_oid_get_attr_short_name
+#define oid_get_cipher_alg mbedtls_oid_get_cipher_alg
+#define oid_get_ec_grp mbedtls_oid_get_ec_grp
+#define oid_get_extended_key_usage mbedtls_oid_get_extended_key_usage
+#define oid_get_md_alg mbedtls_oid_get_md_alg
+#define oid_get_numeric_string mbedtls_oid_get_numeric_string
+#define oid_get_oid_by_ec_grp mbedtls_oid_get_oid_by_ec_grp
+#define oid_get_oid_by_md mbedtls_oid_get_oid_by_md
+#define oid_get_oid_by_pk_alg mbedtls_oid_get_oid_by_pk_alg
+#define oid_get_oid_by_sig_alg mbedtls_oid_get_oid_by_sig_alg
+#define oid_get_pk_alg mbedtls_oid_get_pk_alg
+#define oid_get_pkcs12_pbe_alg mbedtls_oid_get_pkcs12_pbe_alg
+#define oid_get_sig_alg mbedtls_oid_get_sig_alg
+#define oid_get_sig_alg_desc mbedtls_oid_get_sig_alg_desc
+#define oid_get_x509_ext_type mbedtls_oid_get_x509_ext_type
+#define operation_t mbedtls_operation_t
+#define padlock_supports mbedtls_padlock_has_support
+#define padlock_xcryptcbc mbedtls_padlock_xcryptcbc
+#define padlock_xcryptecb mbedtls_padlock_xcryptecb
+#define pem_context mbedtls_pem_context
+#define pem_free mbedtls_pem_free
+#define pem_init mbedtls_pem_init
+#define pem_read_buffer mbedtls_pem_read_buffer
+#define pem_write_buffer mbedtls_pem_write_buffer
+#define pk_can_do mbedtls_pk_can_do
+#define pk_check_pair mbedtls_pk_check_pair
+#define pk_context mbedtls_pk_context
+#define pk_debug mbedtls_pk_debug
+#define pk_debug_item mbedtls_pk_debug_item
+#define pk_debug_type mbedtls_pk_debug_type
+#define pk_decrypt mbedtls_pk_decrypt
+#define pk_ec mbedtls_pk_ec
+#define pk_encrypt mbedtls_pk_encrypt
+#define pk_free mbedtls_pk_free
+#define pk_get_len mbedtls_pk_get_len
+#define pk_get_name mbedtls_pk_get_name
+#define pk_get_size mbedtls_pk_get_bitlen
+#define pk_get_type mbedtls_pk_get_type
+#define pk_info_from_type mbedtls_pk_info_from_type
+#define pk_info_t mbedtls_pk_info_t
+#define pk_init mbedtls_pk_init
+#define pk_init_ctx mbedtls_pk_setup
+#define pk_init_ctx_rsa_alt mbedtls_pk_setup_rsa_alt
+#define pk_load_file mbedtls_pk_load_file
+#define pk_parse_key mbedtls_pk_parse_key
+#define pk_parse_keyfile mbedtls_pk_parse_keyfile
+#define pk_parse_public_key mbedtls_pk_parse_public_key
+#define pk_parse_public_keyfile mbedtls_pk_parse_public_keyfile
+#define pk_parse_subpubkey mbedtls_pk_parse_subpubkey
+#define pk_rsa mbedtls_pk_rsa
+#define pk_rsa_alt_decrypt_func mbedtls_pk_rsa_alt_decrypt_func
+#define pk_rsa_alt_key_len_func mbedtls_pk_rsa_alt_key_len_func
+#define pk_rsa_alt_sign_func mbedtls_pk_rsa_alt_sign_func
+#define pk_rsassa_pss_options mbedtls_pk_rsassa_pss_options
+#define pk_sign mbedtls_pk_sign
+#define pk_type_t mbedtls_pk_type_t
+#define pk_verify mbedtls_pk_verify
+#define pk_verify_ext mbedtls_pk_verify_ext
+#define pk_write_key_der mbedtls_pk_write_key_der
+#define pk_write_key_pem mbedtls_pk_write_key_pem
+#define pk_write_pubkey mbedtls_pk_write_pubkey
+#define pk_write_pubkey_der mbedtls_pk_write_pubkey_der
+#define pk_write_pubkey_pem mbedtls_pk_write_pubkey_pem
+#define pkcs11_context mbedtls_pkcs11_context
+#define pkcs11_decrypt mbedtls_pkcs11_decrypt
+#define pkcs11_priv_key_free mbedtls_pkcs11_priv_key_free
+#define pkcs11_priv_key_init mbedtls_pkcs11_priv_key_bind
+#define pkcs11_sign mbedtls_pkcs11_sign
+#define pkcs11_x509_cert_init mbedtls_pkcs11_x509_cert_bind
+#define pkcs12_derivation mbedtls_pkcs12_derivation
+#define pkcs12_pbe mbedtls_pkcs12_pbe
+#define pkcs12_pbe_sha1_rc4_128 mbedtls_pkcs12_pbe_sha1_rc4_128
+#define pkcs5_pbes2 mbedtls_pkcs5_pbes2
+#define pkcs5_pbkdf2_hmac mbedtls_pkcs5_pbkdf2_hmac
+#define pkcs5_self_test mbedtls_pkcs5_self_test
+#define platform_entropy_poll mbedtls_platform_entropy_poll
+#define platform_set_exit mbedtls_platform_set_exit
+#define platform_set_fprintf mbedtls_platform_set_fprintf
+#define platform_set_printf mbedtls_platform_set_printf
+#define platform_set_snprintf mbedtls_platform_set_snprintf
+#define polarssl_exit mbedtls_exit
+#define polarssl_fprintf mbedtls_fprintf
+#define polarssl_free mbedtls_free
+#define polarssl_mutex_free mbedtls_mutex_free
+#define polarssl_mutex_init mbedtls_mutex_init
+#define polarssl_mutex_lock mbedtls_mutex_lock
+#define polarssl_mutex_unlock mbedtls_mutex_unlock
+#define polarssl_printf mbedtls_printf
+#define polarssl_snprintf mbedtls_snprintf
+#define polarssl_strerror mbedtls_strerror
+#define ripemd160 mbedtls_ripemd160
+#define ripemd160_context mbedtls_ripemd160_context
+#define ripemd160_finish mbedtls_ripemd160_finish
+#define ripemd160_free mbedtls_ripemd160_free
+#define ripemd160_info mbedtls_ripemd160_info
+#define ripemd160_init mbedtls_ripemd160_init
+#define ripemd160_process mbedtls_ripemd160_process
+#define ripemd160_self_test mbedtls_ripemd160_self_test
+#define ripemd160_starts mbedtls_ripemd160_starts
+#define ripemd160_update mbedtls_ripemd160_update
+#define rsa_alt_context mbedtls_rsa_alt_context
+#define rsa_alt_info mbedtls_rsa_alt_info
+#define rsa_check_privkey mbedtls_rsa_check_privkey
+#define rsa_check_pub_priv mbedtls_rsa_check_pub_priv
+#define rsa_check_pubkey mbedtls_rsa_check_pubkey
+#define rsa_context mbedtls_rsa_context
+#define rsa_copy mbedtls_rsa_copy
+#define rsa_free mbedtls_rsa_free
+#define rsa_gen_key mbedtls_rsa_gen_key
+#define rsa_info mbedtls_rsa_info
+#define rsa_init mbedtls_rsa_init
+#define rsa_pkcs1_decrypt mbedtls_rsa_pkcs1_decrypt
+#define rsa_pkcs1_encrypt mbedtls_rsa_pkcs1_encrypt
+#define rsa_pkcs1_sign mbedtls_rsa_pkcs1_sign
+#define rsa_pkcs1_verify mbedtls_rsa_pkcs1_verify
+#define rsa_private mbedtls_rsa_private
+#define rsa_public mbedtls_rsa_public
+#define rsa_rsaes_oaep_decrypt mbedtls_rsa_rsaes_oaep_decrypt
+#define rsa_rsaes_oaep_encrypt mbedtls_rsa_rsaes_oaep_encrypt
+#define rsa_rsaes_pkcs1_v15_decrypt mbedtls_rsa_rsaes_pkcs1_v15_decrypt
+#define rsa_rsaes_pkcs1_v15_encrypt mbedtls_rsa_rsaes_pkcs1_v15_encrypt
+#define rsa_rsassa_pkcs1_v15_sign mbedtls_rsa_rsassa_pkcs1_v15_sign
+#define rsa_rsassa_pkcs1_v15_verify mbedtls_rsa_rsassa_pkcs1_v15_verify
+#define rsa_rsassa_pss_sign mbedtls_rsa_rsassa_pss_sign
+#define rsa_rsassa_pss_verify mbedtls_rsa_rsassa_pss_verify
+#define rsa_rsassa_pss_verify_ext mbedtls_rsa_rsassa_pss_verify_ext
+#define rsa_self_test mbedtls_rsa_self_test
+#define rsa_set_padding mbedtls_rsa_set_padding
+#define safer_memcmp mbedtls_ssl_safer_memcmp
+#define set_alarm mbedtls_set_alarm
+#define sha1 mbedtls_sha1
+#define sha1_context mbedtls_sha1_context
+#define sha1_finish mbedtls_sha1_finish
+#define sha1_free mbedtls_sha1_free
+#define sha1_info mbedtls_sha1_info
+#define sha1_init mbedtls_sha1_init
+#define sha1_process mbedtls_sha1_process
+#define sha1_self_test mbedtls_sha1_self_test
+#define sha1_starts mbedtls_sha1_starts
+#define sha1_update mbedtls_sha1_update
+#define sha224_info mbedtls_sha224_info
+#define sha256 mbedtls_sha256
+#define sha256_context mbedtls_sha256_context
+#define sha256_finish mbedtls_sha256_finish
+#define sha256_free mbedtls_sha256_free
+#define sha256_info mbedtls_sha256_info
+#define sha256_init mbedtls_sha256_init
+#define sha256_process mbedtls_sha256_process
+#define sha256_self_test mbedtls_sha256_self_test
+#define sha256_starts mbedtls_sha256_starts
+#define sha256_update mbedtls_sha256_update
+#define sha384_info mbedtls_sha384_info
+#define sha512 mbedtls_sha512
+#define sha512_context mbedtls_sha512_context
+#define sha512_finish mbedtls_sha512_finish
+#define sha512_free mbedtls_sha512_free
+#define sha512_info mbedtls_sha512_info
+#define sha512_init mbedtls_sha512_init
+#define sha512_process mbedtls_sha512_process
+#define sha512_self_test mbedtls_sha512_self_test
+#define sha512_starts mbedtls_sha512_starts
+#define sha512_update mbedtls_sha512_update
+#define source_state mbedtls_entropy_source_state
+#define ssl_cache_context mbedtls_ssl_cache_context
+#define ssl_cache_entry mbedtls_ssl_cache_entry
+#define ssl_cache_free mbedtls_ssl_cache_free
+#define ssl_cache_get mbedtls_ssl_cache_get
+#define ssl_cache_init mbedtls_ssl_cache_init
+#define ssl_cache_set mbedtls_ssl_cache_set
+#define ssl_cache_set_max_entries mbedtls_ssl_cache_set_max_entries
+#define ssl_cache_set_timeout mbedtls_ssl_cache_set_timeout
+#define ssl_check_cert_usage mbedtls_ssl_check_cert_usage
+#define ssl_ciphersuite_from_id mbedtls_ssl_ciphersuite_from_id
+#define ssl_ciphersuite_from_string mbedtls_ssl_ciphersuite_from_string
+#define ssl_ciphersuite_t mbedtls_ssl_ciphersuite_t
+#define ssl_ciphersuite_uses_ec mbedtls_ssl_ciphersuite_uses_ec
+#define ssl_ciphersuite_uses_psk mbedtls_ssl_ciphersuite_uses_psk
+#define ssl_close_notify mbedtls_ssl_close_notify
+#define ssl_context mbedtls_ssl_context
+#define ssl_cookie_check mbedtls_ssl_cookie_check
+#define ssl_cookie_check_t mbedtls_ssl_cookie_check_t
+#define ssl_cookie_ctx mbedtls_ssl_cookie_ctx
+#define ssl_cookie_free mbedtls_ssl_cookie_free
+#define ssl_cookie_init mbedtls_ssl_cookie_init
+#define ssl_cookie_set_timeout mbedtls_ssl_cookie_set_timeout
+#define ssl_cookie_setup mbedtls_ssl_cookie_setup
+#define ssl_cookie_write mbedtls_ssl_cookie_write
+#define ssl_cookie_write_t mbedtls_ssl_cookie_write_t
+#define ssl_derive_keys mbedtls_ssl_derive_keys
+#define ssl_dtls_replay_check mbedtls_ssl_dtls_replay_check
+#define ssl_dtls_replay_update mbedtls_ssl_dtls_replay_update
+#define ssl_fetch_input mbedtls_ssl_fetch_input
+#define ssl_flight_item mbedtls_ssl_flight_item
+#define ssl_flush_output mbedtls_ssl_flush_output
+#define ssl_free mbedtls_ssl_free
+#define ssl_get_alpn_protocol mbedtls_ssl_get_alpn_protocol
+#define ssl_get_bytes_avail mbedtls_ssl_get_bytes_avail
+#define ssl_get_ciphersuite mbedtls_ssl_get_ciphersuite
+#define ssl_get_ciphersuite_id mbedtls_ssl_get_ciphersuite_id
+#define ssl_get_ciphersuite_name mbedtls_ssl_get_ciphersuite_name
+#define ssl_get_ciphersuite_sig_pk_alg mbedtls_ssl_get_ciphersuite_sig_pk_alg
+#define ssl_get_peer_cert mbedtls_ssl_get_peer_cert
+#define ssl_get_record_expansion mbedtls_ssl_get_record_expansion
+#define ssl_get_session mbedtls_ssl_get_session
+#define ssl_get_verify_result mbedtls_ssl_get_verify_result
+#define ssl_get_version mbedtls_ssl_get_version
+#define ssl_handshake mbedtls_ssl_handshake
+#define ssl_handshake_client_step mbedtls_ssl_handshake_client_step
+#define ssl_handshake_free mbedtls_ssl_handshake_free
+#define ssl_handshake_params mbedtls_ssl_handshake_params
+#define ssl_handshake_server_step mbedtls_ssl_handshake_server_step
+#define ssl_handshake_step mbedtls_ssl_handshake_step
+#define ssl_handshake_wrapup mbedtls_ssl_handshake_wrapup
+#define ssl_hdr_len mbedtls_ssl_hdr_len
+#define ssl_hs_hdr_len mbedtls_ssl_hs_hdr_len
+#define ssl_hw_record_activate mbedtls_ssl_hw_record_activate
+#define ssl_hw_record_finish mbedtls_ssl_hw_record_finish
+#define ssl_hw_record_init mbedtls_ssl_hw_record_init
+#define ssl_hw_record_read mbedtls_ssl_hw_record_read
+#define ssl_hw_record_reset mbedtls_ssl_hw_record_reset
+#define ssl_hw_record_write mbedtls_ssl_hw_record_write
+#define ssl_init mbedtls_ssl_init
+#define ssl_key_cert mbedtls_ssl_key_cert
+#define ssl_legacy_renegotiation mbedtls_ssl_conf_legacy_renegotiation
+#define ssl_list_ciphersuites mbedtls_ssl_list_ciphersuites
+#define ssl_md_alg_from_hash mbedtls_ssl_md_alg_from_hash
+#define ssl_optimize_checksum mbedtls_ssl_optimize_checksum
+#define ssl_own_cert mbedtls_ssl_own_cert
+#define ssl_own_key mbedtls_ssl_own_key
+#define ssl_parse_certificate mbedtls_ssl_parse_certificate
+#define ssl_parse_change_cipher_spec mbedtls_ssl_parse_change_cipher_spec
+#define ssl_parse_finished mbedtls_ssl_parse_finished
+#define ssl_pk_alg_from_sig mbedtls_ssl_pk_alg_from_sig
+#define ssl_pkcs11_decrypt mbedtls_ssl_pkcs11_decrypt
+#define ssl_pkcs11_key_len mbedtls_ssl_pkcs11_key_len
+#define ssl_pkcs11_sign mbedtls_ssl_pkcs11_sign
+#define ssl_psk_derive_premaster mbedtls_ssl_psk_derive_premaster
+#define ssl_read mbedtls_ssl_read
+#define ssl_read_record mbedtls_ssl_read_record
+#define ssl_read_version mbedtls_ssl_read_version
+#define ssl_recv_flight_completed mbedtls_ssl_recv_flight_completed
+#define ssl_renegotiate mbedtls_ssl_renegotiate
+#define ssl_resend mbedtls_ssl_resend
+#define ssl_reset_checksum mbedtls_ssl_reset_checksum
+#define ssl_send_alert_message mbedtls_ssl_send_alert_message
+#define ssl_send_fatal_handshake_failure mbedtls_ssl_send_fatal_handshake_failure
+#define ssl_send_flight_completed mbedtls_ssl_send_flight_completed
+#define ssl_session mbedtls_ssl_session
+#define ssl_session_free mbedtls_ssl_session_free
+#define ssl_session_init mbedtls_ssl_session_init
+#define ssl_session_reset mbedtls_ssl_session_reset
+#define ssl_set_alpn_protocols mbedtls_ssl_conf_alpn_protocols
+#define ssl_set_arc4_support mbedtls_ssl_conf_arc4_support
+#define ssl_set_authmode mbedtls_ssl_conf_authmode
+#define ssl_set_bio mbedtls_ssl_set_bio
+#define ssl_set_ca_chain mbedtls_ssl_conf_ca_chain
+#define ssl_set_cbc_record_splitting mbedtls_ssl_conf_cbc_record_splitting
+#define ssl_set_ciphersuites mbedtls_ssl_conf_ciphersuites
+#define ssl_set_ciphersuites_for_version mbedtls_ssl_conf_ciphersuites_for_version
+#define ssl_set_client_transport_id mbedtls_ssl_set_client_transport_id
+#define ssl_set_curves mbedtls_ssl_conf_curves
+#define ssl_set_dbg mbedtls_ssl_conf_dbg
+#define ssl_set_dh_param mbedtls_ssl_conf_dh_param
+#define ssl_set_dh_param_ctx mbedtls_ssl_conf_dh_param_ctx
+#define ssl_set_dtls_anti_replay mbedtls_ssl_conf_dtls_anti_replay
+#define ssl_set_dtls_badmac_limit mbedtls_ssl_conf_dtls_badmac_limit
+#define ssl_set_dtls_cookies mbedtls_ssl_conf_dtls_cookies
+#define ssl_set_encrypt_then_mac mbedtls_ssl_conf_encrypt_then_mac
+#define ssl_set_endpoint mbedtls_ssl_conf_endpoint
+#define ssl_set_extended_master_secret mbedtls_ssl_conf_extended_master_secret
+#define ssl_set_fallback mbedtls_ssl_conf_fallback
+#define ssl_set_handshake_timeout mbedtls_ssl_conf_handshake_timeout
+#define ssl_set_hostname mbedtls_ssl_set_hostname
+#define ssl_set_max_frag_len mbedtls_ssl_conf_max_frag_len
+#define ssl_set_max_version mbedtls_ssl_conf_max_version
+#define ssl_set_min_version mbedtls_ssl_conf_min_version
+#define ssl_set_own_cert mbedtls_ssl_conf_own_cert
+#define ssl_set_psk mbedtls_ssl_conf_psk
+#define ssl_set_psk_cb mbedtls_ssl_conf_psk_cb
+#define ssl_set_renegotiation mbedtls_ssl_conf_renegotiation
+#define ssl_set_renegotiation_enforced mbedtls_ssl_conf_renegotiation_enforced
+#define ssl_set_renegotiation_period mbedtls_ssl_conf_renegotiation_period
+#define ssl_set_rng mbedtls_ssl_conf_rng
+#define ssl_set_session mbedtls_ssl_set_session
+#define ssl_set_session_cache mbedtls_ssl_conf_session_cache
+#define ssl_set_session_tickets mbedtls_ssl_conf_session_tickets
+#define ssl_set_sni mbedtls_ssl_conf_sni
+#define ssl_set_transport mbedtls_ssl_conf_transport
+#define ssl_set_truncated_hmac mbedtls_ssl_conf_truncated_hmac
+#define ssl_set_verify mbedtls_ssl_conf_verify
+#define ssl_sig_from_pk mbedtls_ssl_sig_from_pk
+#define ssl_states mbedtls_ssl_states
+#define ssl_transform mbedtls_ssl_transform
+#define ssl_transform_free mbedtls_ssl_transform_free
+#define ssl_write mbedtls_ssl_write
+#define ssl_write_certificate mbedtls_ssl_write_certificate
+#define ssl_write_change_cipher_spec mbedtls_ssl_write_change_cipher_spec
+#define ssl_write_finished mbedtls_ssl_write_finished
+#define ssl_write_record mbedtls_ssl_write_record
+#define ssl_write_version mbedtls_ssl_write_version
+#define supported_ciphers mbedtls_cipher_supported
+#define t_sint mbedtls_mpi_sint
+#define t_udbl mbedtls_t_udbl
+#define t_uint mbedtls_mpi_uint
+#define test_ca_crt mbedtls_test_ca_crt
+#define test_ca_crt_ec mbedtls_test_ca_crt_ec
+#define test_ca_crt_rsa mbedtls_test_ca_crt_rsa
+#define test_ca_key mbedtls_test_ca_key
+#define test_ca_key_ec mbedtls_test_ca_key_ec
+#define test_ca_key_rsa mbedtls_test_ca_key_rsa
+#define test_ca_list mbedtls_test_cas_pem
+#define test_ca_pwd mbedtls_test_ca_pwd
+#define test_ca_pwd_ec mbedtls_test_ca_pwd_ec
+#define test_ca_pwd_rsa mbedtls_test_ca_pwd_rsa
+#define test_cli_crt mbedtls_test_cli_crt
+#define test_cli_crt_ec mbedtls_test_cli_crt_ec
+#define test_cli_crt_rsa mbedtls_test_cli_crt_rsa
+#define test_cli_key mbedtls_test_cli_key
+#define test_cli_key_ec mbedtls_test_cli_key_ec
+#define test_cli_key_rsa mbedtls_test_cli_key_rsa
+#define test_srv_crt mbedtls_test_srv_crt
+#define test_srv_crt_ec mbedtls_test_srv_crt_ec
+#define test_srv_crt_rsa mbedtls_test_srv_crt_rsa
+#define test_srv_key mbedtls_test_srv_key
+#define test_srv_key_ec mbedtls_test_srv_key_ec
+#define test_srv_key_rsa mbedtls_test_srv_key_rsa
+#define threading_mutex_t mbedtls_threading_mutex_t
+#define threading_set_alt mbedtls_threading_set_alt
+#define timing_self_test mbedtls_timing_self_test
+#define version_check_feature mbedtls_version_check_feature
+#define version_get_number mbedtls_version_get_number
+#define version_get_string mbedtls_version_get_string
+#define version_get_string_full mbedtls_version_get_string_full
+#define x509_bitstring mbedtls_x509_bitstring
+#define x509_buf mbedtls_x509_buf
+#define x509_crl mbedtls_x509_crl
+#define x509_crl_entry mbedtls_x509_crl_entry
+#define x509_crl_free mbedtls_x509_crl_free
+#define x509_crl_info mbedtls_x509_crl_info
+#define x509_crl_init mbedtls_x509_crl_init
+#define x509_crl_parse mbedtls_x509_crl_parse
+#define x509_crl_parse_der mbedtls_x509_crl_parse_der
+#define x509_crl_parse_file mbedtls_x509_crl_parse_file
+#define x509_crt mbedtls_x509_crt
+#define x509_crt_check_extended_key_usage mbedtls_x509_crt_check_extended_key_usage
+#define x509_crt_check_key_usage mbedtls_x509_crt_check_key_usage
+#define x509_crt_free mbedtls_x509_crt_free
+#define x509_crt_info mbedtls_x509_crt_info
+#define x509_crt_init mbedtls_x509_crt_init
+#define x509_crt_parse mbedtls_x509_crt_parse
+#define x509_crt_parse_der mbedtls_x509_crt_parse_der
+#define x509_crt_parse_file mbedtls_x509_crt_parse_file
+#define x509_crt_parse_path mbedtls_x509_crt_parse_path
+#define x509_crt_revoked mbedtls_x509_crt_is_revoked
+#define x509_crt_verify mbedtls_x509_crt_verify
+#define x509_csr mbedtls_x509_csr
+#define x509_csr_free mbedtls_x509_csr_free
+#define x509_csr_info mbedtls_x509_csr_info
+#define x509_csr_init mbedtls_x509_csr_init
+#define x509_csr_parse mbedtls_x509_csr_parse
+#define x509_csr_parse_der mbedtls_x509_csr_parse_der
+#define x509_csr_parse_file mbedtls_x509_csr_parse_file
+#define x509_dn_gets mbedtls_x509_dn_gets
+#define x509_get_alg mbedtls_x509_get_alg
+#define x509_get_alg_null mbedtls_x509_get_alg_null
+#define x509_get_ext mbedtls_x509_get_ext
+#define x509_get_name mbedtls_x509_get_name
+#define x509_get_rsassa_pss_params mbedtls_x509_get_rsassa_pss_params
+#define x509_get_serial mbedtls_x509_get_serial
+#define x509_get_sig mbedtls_x509_get_sig
+#define x509_get_sig_alg mbedtls_x509_get_sig_alg
+#define x509_get_time mbedtls_x509_get_time
+#define x509_key_size_helper mbedtls_x509_key_size_helper
+#define x509_name mbedtls_x509_name
+#define x509_self_test mbedtls_x509_self_test
+#define x509_sequence mbedtls_x509_sequence
+#define x509_serial_gets mbedtls_x509_serial_gets
+#define x509_set_extension mbedtls_x509_set_extension
+#define x509_sig_alg_gets mbedtls_x509_sig_alg_gets
+#define x509_string_to_names mbedtls_x509_string_to_names
+#define x509_time mbedtls_x509_time
+#define x509_time_expired mbedtls_x509_time_is_past
+#define x509_time_future mbedtls_x509_time_is_future
+#define x509_write_extensions mbedtls_x509_write_extensions
+#define x509_write_names mbedtls_x509_write_names
+#define x509_write_sig mbedtls_x509_write_sig
+#define x509write_cert mbedtls_x509write_cert
+#define x509write_crt_der mbedtls_x509write_crt_der
+#define x509write_crt_free mbedtls_x509write_crt_free
+#define x509write_crt_init mbedtls_x509write_crt_init
+#define x509write_crt_pem mbedtls_x509write_crt_pem
+#define x509write_crt_set_authority_key_identifier mbedtls_x509write_crt_set_authority_key_identifier
+#define x509write_crt_set_basic_constraints mbedtls_x509write_crt_set_basic_constraints
+#define x509write_crt_set_extension mbedtls_x509write_crt_set_extension
+#define x509write_crt_set_issuer_key mbedtls_x509write_crt_set_issuer_key
+#define x509write_crt_set_issuer_name mbedtls_x509write_crt_set_issuer_name
+#define x509write_crt_set_key_usage mbedtls_x509write_crt_set_key_usage
+#define x509write_crt_set_md_alg mbedtls_x509write_crt_set_md_alg
+#define x509write_crt_set_ns_cert_type mbedtls_x509write_crt_set_ns_cert_type
+#define x509write_crt_set_serial mbedtls_x509write_crt_set_serial
+#define x509write_crt_set_subject_key mbedtls_x509write_crt_set_subject_key
+#define x509write_crt_set_subject_key_identifier mbedtls_x509write_crt_set_subject_key_identifier
+#define x509write_crt_set_subject_name mbedtls_x509write_crt_set_subject_name
+#define x509write_crt_set_validity mbedtls_x509write_crt_set_validity
+#define x509write_crt_set_version mbedtls_x509write_crt_set_version
+#define x509write_csr mbedtls_x509write_csr
+#define x509write_csr_der mbedtls_x509write_csr_der
+#define x509write_csr_free mbedtls_x509write_csr_free
+#define x509write_csr_init mbedtls_x509write_csr_init
+#define x509write_csr_pem mbedtls_x509write_csr_pem
+#define x509write_csr_set_extension mbedtls_x509write_csr_set_extension
+#define x509write_csr_set_key mbedtls_x509write_csr_set_key
+#define x509write_csr_set_key_usage mbedtls_x509write_csr_set_key_usage
+#define x509write_csr_set_md_alg mbedtls_x509write_csr_set_md_alg
+#define x509write_csr_set_ns_cert_type mbedtls_x509write_csr_set_ns_cert_type
+#define x509write_csr_set_subject_name mbedtls_x509write_csr_set_subject_name
+#define xtea_context mbedtls_xtea_context
+#define xtea_crypt_cbc mbedtls_xtea_crypt_cbc
+#define xtea_crypt_ecb mbedtls_xtea_crypt_ecb
+#define xtea_free mbedtls_xtea_free
+#define xtea_init mbedtls_xtea_init
+#define xtea_self_test mbedtls_xtea_self_test
+#define xtea_setup mbedtls_xtea_setup
+
+/*+\NEW\lijiaodi\2020.2.3\Ìí¼Óopenat ssl½Ó¿Ú*/
+#define x509_cert mbedtls_x509_crt
+#define x509_free mbedtls_x509_crt_free
+/*-\NEW\lijiaodi\2020.2.3\Ìí¼Óopenat ssl½Ó¿Ú*/
+#endif /* compat-1.3.h */
+#endif /* MBEDTLS_DEPRECATED_REMOVED */

+ 3177 - 0
bsp/air724/sdk/components/net_inc/config.h

@@ -0,0 +1,3177 @@
+/**
+ * \file config.h
+ *
+ * \brief Configuration options (set of defines)
+ *
+ *  This set of compile-time options may be used to enable
+ *  or disable features selectively, and reduce the global
+ *  memory footprint.
+ */
+/*
+ *  Copyright (C) 2006-2018, ARM Limited, All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of mbed TLS (https://tls.mbed.org)
+ */
+
+#ifndef MBEDTLS_CONFIG_H
+#define MBEDTLS_CONFIG_H
+
+#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+#define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#define unix
+#include "unistd.h"
+//#define SIZE_MAX INT_MAX
+
+
+/**
+ * \name SECTION: System support
+ *
+ * This section sets system specific settings.
+ * \{
+ */
+
+/**
+ * \def MBEDTLS_HAVE_ASM
+ *
+ * The compiler has support for asm().
+ *
+ * Requires support for asm() in compiler.
+ *
+ * Used in:
+ *      library/aria.c
+ *      library/timing.c
+ *      include/mbedtls/bn_mul.h
+ *
+ * Required by:
+ *      MBEDTLS_AESNI_C
+ *      MBEDTLS_PADLOCK_C
+ *
+ * Comment to disable the use of assembly code.
+ */
+//#define MBEDTLS_HAVE_ASM
+
+/**
+ * \def MBEDTLS_NO_UDBL_DIVISION
+ *
+ * The platform lacks support for double-width integer division (64-bit
+ * division on a 32-bit platform, 128-bit division on a 64-bit platform).
+ *
+ * Used in:
+ *      include/mbedtls/bignum.h
+ *      library/bignum.c
+ *
+ * The bignum code uses double-width division to speed up some operations.
+ * Double-width division is often implemented in software that needs to
+ * be linked with the program. The presence of a double-width integer
+ * type is usually detected automatically through preprocessor macros,
+ * but the automatic detection cannot know whether the code needs to
+ * and can be linked with an implementation of division for that type.
+ * By default division is assumed to be usable if the type is present.
+ * Uncomment this option to prevent the use of double-width division.
+ *
+ * Note that division for the native integer type is always required.
+ * Furthermore, a 64-bit type is always required even on a 32-bit
+ * platform, but it need not support multiplication or division. In some
+ * cases it is also desirable to disable some double-width operations. For
+ * example, if double-width division is implemented in software, disabling
+ * it can reduce code size in some embedded targets.
+ */
+//#define MBEDTLS_NO_UDBL_DIVISION
+
+/**
+ * \def MBEDTLS_NO_64BIT_MULTIPLICATION
+ *
+ * The platform lacks support for 32x32 -> 64-bit multiplication.
+ *
+ * Used in:
+ *      library/poly1305.c
+ *
+ * Some parts of the library may use multiplication of two unsigned 32-bit
+ * operands with a 64-bit result in order to speed up computations. On some
+ * platforms, this is not available in hardware and has to be implemented in
+ * software, usually in a library provided by the toolchain.
+ *
+ * Sometimes it is not desirable to have to link to that library. This option
+ * removes the dependency of that library on platforms that lack a hardware
+ * 64-bit multiplier by embedding a software implementation in Mbed TLS.
+ *
+ * Note that depending on the compiler, this may decrease performance compared
+ * to using the library function provided by the toolchain.
+ */
+//#define MBEDTLS_NO_64BIT_MULTIPLICATION
+
+/**
+ * \def MBEDTLS_HAVE_SSE2
+ *
+ * CPU supports SSE2 instruction set.
+ *
+ * Uncomment if the CPU supports SSE2 (IA-32 specific).
+ */
+//#define MBEDTLS_HAVE_SSE2
+
+/**
+ * \def MBEDTLS_HAVE_TIME
+ *
+ * System has time.h and time().
+ * The time does not need to be correct, only time differences are used,
+ * by contrast with MBEDTLS_HAVE_TIME_DATE
+ *
+ * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT,
+ * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and
+ * MBEDTLS_PLATFORM_STD_TIME.
+ *
+ * Comment if your system does not support time functions
+ */
+//#define MBEDTLS_HAVE_TIME
+
+/**
+ * \def MBEDTLS_HAVE_TIME_DATE
+ *
+ * System has time.h, time(), and an implementation for
+ * mbedtls_platform_gmtime_r() (see below).
+ * The time needs to be correct (not necesarily very accurate, but at least
+ * the date should be correct). This is used to verify the validity period of
+ * X.509 certificates.
+ *
+ * Comment if your system does not have a correct clock.
+ *
+ * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that
+ * behaves similarly to the gmtime_r() function from the C standard. Refer to
+ * the documentation for mbedtls_platform_gmtime_r() for more information.
+ *
+ * \note It is possible to configure an implementation for
+ * mbedtls_platform_gmtime_r() at compile-time by using the macro
+ * MBEDTLS_PLATFORM_GMTIME_R_ALT.
+ */
+//#define MBEDTLS_HAVE_TIME_DATE
+
+/**
+ * \def MBEDTLS_PLATFORM_MEMORY
+ *
+ * Enable the memory allocation layer.
+ *
+ * By default mbed TLS uses the system-provided calloc() and free().
+ * This allows different allocators (self-implemented or provided) to be
+ * provided to the platform abstraction layer.
+ *
+ * Enabling MBEDTLS_PLATFORM_MEMORY without the
+ * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide
+ * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and
+ * free() function pointer at runtime.
+ *
+ * Enabling MBEDTLS_PLATFORM_MEMORY and specifying
+ * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the
+ * alternate function at compile time.
+ *
+ * Requires: MBEDTLS_PLATFORM_C
+ *
+ * Enable this layer to allow use of alternative memory allocators.
+ */
+#define MBEDTLS_PLATFORM_MEMORY
+
+/**
+ * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
+ *
+ * Do not assign standard functions in the platform layer (e.g. calloc() to
+ * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF)
+ *
+ * This makes sure there are no linking errors on platforms that do not support
+ * these functions. You will HAVE to provide alternatives, either at runtime
+ * via the platform_set_xxx() functions or at compile time by setting
+ * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a
+ * MBEDTLS_PLATFORM_XXX_MACRO.
+ *
+ * Requires: MBEDTLS_PLATFORM_C
+ *
+ * Uncomment to prevent default assignment of standard functions in the
+ * platform layer.
+ */
+#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
+
+/**
+ * \def MBEDTLS_PLATFORM_EXIT_ALT
+ *
+ * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the
+ * function in the platform abstraction layer.
+ *
+ * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will
+ * provide a function "mbedtls_platform_set_printf()" that allows you to set an
+ * alternative printf function pointer.
+ *
+ * All these define require MBEDTLS_PLATFORM_C to be defined!
+ *
+ * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows;
+ * it will be enabled automatically by check_config.h
+ *
+ * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as
+ * MBEDTLS_PLATFORM_XXX_MACRO!
+ *
+ * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME
+ *
+ * Uncomment a macro to enable alternate implementation of specific base
+ * platform function
+ */
+//#define MBEDTLS_PLATFORM_EXIT_ALT
+//#define MBEDTLS_PLATFORM_TIME_ALT
+//#define MBEDTLS_PLATFORM_FPRINTF_ALT
+#define MBEDTLS_PLATFORM_PRINTF_ALT
+#define MBEDTLS_PLATFORM_SNPRINTF_ALT
+//#define MBEDTLS_PLATFORM_NV_SEED_ALT
+//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
+
+/**
+ * \def MBEDTLS_DEPRECATED_WARNING
+ *
+ * Mark deprecated functions so that they generate a warning if used.
+ * Functions deprecated in one version will usually be removed in the next
+ * version. You can enable this to help you prepare the transition to a new
+ * major version by making sure your code is not using these functions.
+ *
+ * This only works with GCC and Clang. With other compilers, you may want to
+ * use MBEDTLS_DEPRECATED_REMOVED
+ *
+ * Uncomment to get warnings on using deprecated functions.
+ */
+//#define MBEDTLS_DEPRECATED_WARNING
+
+/**
+ * \def MBEDTLS_DEPRECATED_REMOVED
+ *
+ * Remove deprecated functions so that they generate an error if used.
+ * Functions deprecated in one version will usually be removed in the next
+ * version. You can enable this to help you prepare the transition to a new
+ * major version by making sure your code is not using these functions.
+ *
+ * Uncomment to get errors on using deprecated functions.
+ */
+//#define MBEDTLS_DEPRECATED_REMOVED
+
+/* \} name SECTION: System support */
+
+/**
+ * \name SECTION: mbed TLS feature support
+ *
+ * This section sets support for features that are or are not needed
+ * within the modules that are enabled.
+ * \{
+ */
+
+/**
+ * \def MBEDTLS_TIMING_ALT
+ *
+ * Uncomment to provide your own alternate implementation for mbedtls_timing_hardclock(),
+ * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay()
+ *
+ * Only works if you have MBEDTLS_TIMING_C enabled.
+ *
+ * You will need to provide a header "timing_alt.h" and an implementation at
+ * compile time.
+ */
+//#define MBEDTLS_TIMING_ALT
+
+/**
+ * \def MBEDTLS_AES_ALT
+ *
+ * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your
+ * alternate core implementation of a symmetric crypto, an arithmetic or hash
+ * module (e.g. platform specific assembly optimized implementations). Keep
+ * in mind that the function prototypes should remain the same.
+ *
+ * This replaces the whole module. If you only want to replace one of the
+ * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags.
+ *
+ * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer
+ * provide the "struct mbedtls_aes_context" definition and omit the base
+ * function declarations and implementations. "aes_alt.h" will be included from
+ * "aes.h" to include the new function definitions.
+ *
+ * Uncomment a macro to enable alternate implementation of the corresponding
+ * module.
+ *
+ * \warning   MD2, MD4, MD5, ARC4, DES and SHA-1 are considered weak and their
+ *            use constitutes a security risk. If possible, we recommend
+ *            avoiding dependencies on them, and considering stronger message
+ *            digests and ciphers instead.
+ *
+ */
+//#define MBEDTLS_AES_ALT
+//#define MBEDTLS_ARC4_ALT
+//#define MBEDTLS_ARIA_ALT
+//#define MBEDTLS_BLOWFISH_ALT
+//#define MBEDTLS_CAMELLIA_ALT
+//#define MBEDTLS_CCM_ALT
+//#define MBEDTLS_CHACHA20_ALT
+//#define MBEDTLS_CHACHAPOLY_ALT
+//#define MBEDTLS_CMAC_ALT
+//#define MBEDTLS_DES_ALT
+//#define MBEDTLS_DHM_ALT
+//#define MBEDTLS_ECJPAKE_ALT
+//#define MBEDTLS_GCM_ALT
+//#define MBEDTLS_NIST_KW_ALT
+//#define MBEDTLS_MD2_ALT
+//#define MBEDTLS_MD4_ALT
+//#define MBEDTLS_MD5_ALT
+//#define MBEDTLS_POLY1305_ALT
+//#define MBEDTLS_RIPEMD160_ALT
+//#define MBEDTLS_RSA_ALT
+//#define MBEDTLS_SHA1_ALT
+//#define MBEDTLS_SHA256_ALT
+//#define MBEDTLS_SHA512_ALT
+//#define MBEDTLS_XTEA_ALT
+
+/*
+ * When replacing the elliptic curve module, pleace consider, that it is
+ * implemented with two .c files:
+ *      - ecp.c
+ *      - ecp_curves.c
+ * You can replace them very much like all the other MBEDTLS__MODULE_NAME__ALT
+ * macros as described above. The only difference is that you have to make sure
+ * that you provide functionality for both .c files.
+ */
+//#define MBEDTLS_ECP_ALT
+
+/**
+ * \def MBEDTLS_MD2_PROCESS_ALT
+ *
+ * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you
+ * alternate core implementation of symmetric crypto or hash function. Keep in
+ * mind that function prototypes should remain the same.
+ *
+ * This replaces only one function. The header file from mbed TLS is still
+ * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags.
+ *
+ * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will
+ * no longer provide the mbedtls_sha1_process() function, but it will still provide
+ * the other function (using your mbedtls_sha1_process() function) and the definition
+ * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible
+ * with this definition.
+ *
+ * \note Because of a signature change, the core AES encryption and decryption routines are
+ *       currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt,
+ *       respectively. When setting up alternative implementations, these functions should
+ *       be overriden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt
+ *       must stay untouched.
+ *
+ * \note If you use the AES_xxx_ALT macros, then is is recommended to also set
+ *       MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES
+ *       tables.
+ *
+ * Uncomment a macro to enable alternate implementation of the corresponding
+ * function.
+ *
+ * \warning   MD2, MD4, MD5, DES and SHA-1 are considered weak and their use
+ *            constitutes a security risk. If possible, we recommend avoiding
+ *            dependencies on them, and considering stronger message digests
+ *            and ciphers instead.
+ *
+ */
+//#define MBEDTLS_MD2_PROCESS_ALT
+//#define MBEDTLS_MD4_PROCESS_ALT
+//#define MBEDTLS_MD5_PROCESS_ALT
+//#define MBEDTLS_RIPEMD160_PROCESS_ALT
+//#define MBEDTLS_SHA1_PROCESS_ALT
+//#define MBEDTLS_SHA256_PROCESS_ALT
+//#define MBEDTLS_SHA512_PROCESS_ALT
+//#define MBEDTLS_DES_SETKEY_ALT
+//#define MBEDTLS_DES_CRYPT_ECB_ALT
+//#define MBEDTLS_DES3_CRYPT_ECB_ALT
+//#define MBEDTLS_AES_SETKEY_ENC_ALT
+//#define MBEDTLS_AES_SETKEY_DEC_ALT
+//#define MBEDTLS_AES_ENCRYPT_ALT
+//#define MBEDTLS_AES_DECRYPT_ALT
+//#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
+//#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
+//#define MBEDTLS_ECDSA_VERIFY_ALT
+//#define MBEDTLS_ECDSA_SIGN_ALT
+//#define MBEDTLS_ECDSA_GENKEY_ALT
+
+/**
+ * \def MBEDTLS_ECP_INTERNAL_ALT
+ *
+ * Expose a part of the internal interface of the Elliptic Curve Point module.
+ *
+ * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your
+ * alternative core implementation of elliptic curve arithmetic. Keep in mind
+ * that function prototypes should remain the same.
+ *
+ * This partially replaces one function. The header file from mbed TLS is still
+ * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation
+ * is still present and it is used for group structures not supported by the
+ * alternative.
+ *
+ * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT
+ * and implementing the following functions:
+ *      unsigned char mbedtls_internal_ecp_grp_capable(
+ *          const mbedtls_ecp_group *grp )
+ *      int  mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp )
+ *      void mbedtls_internal_ecp_deinit( const mbedtls_ecp_group *grp )
+ * The mbedtls_internal_ecp_grp_capable function should return 1 if the
+ * replacement functions implement arithmetic for the given group and 0
+ * otherwise.
+ * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_deinit are
+ * called before and after each point operation and provide an opportunity to
+ * implement optimized set up and tear down instructions.
+ *
+ * Example: In case you uncomment MBEDTLS_ECP_INTERNAL_ALT and
+ * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac
+ * function, but will use your mbedtls_internal_ecp_double_jac if the group is
+ * supported (your mbedtls_internal_ecp_grp_capable function returns 1 when
+ * receives it as an argument). If the group is not supported then the original
+ * implementation is used. The other functions and the definition of
+ * mbedtls_ecp_group and mbedtls_ecp_point will not change, so your
+ * implementation of mbedtls_internal_ecp_double_jac and
+ * mbedtls_internal_ecp_grp_capable must be compatible with this definition.
+ *
+ * Uncomment a macro to enable alternate implementation of the corresponding
+ * function.
+ */
+/* Required for all the functions in this section */
+//#define MBEDTLS_ECP_INTERNAL_ALT
+/* Support for Weierstrass curves with Jacobi representation */
+//#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
+//#define MBEDTLS_ECP_ADD_MIXED_ALT
+//#define MBEDTLS_ECP_DOUBLE_JAC_ALT
+//#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
+//#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
+/* Support for curves with Montgomery arithmetic */
+//#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
+//#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
+//#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT
+
+/**
+ * \def MBEDTLS_TEST_NULL_ENTROPY
+ *
+ * Enables testing and use of mbed TLS without any configured entropy sources.
+ * This permits use of the library on platforms before an entropy source has
+ * been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the
+ * MBEDTLS_ENTROPY_NV_SEED switches).
+ *
+ * WARNING! This switch MUST be disabled in production builds, and is suitable
+ * only for development.
+ * Enabling the switch negates any security provided by the library.
+ *
+ * Requires MBEDTLS_ENTROPY_C, MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
+ *
+ */
+//#define MBEDTLS_TEST_NULL_ENTROPY
+
+/**
+ * \def MBEDTLS_ENTROPY_HARDWARE_ALT
+ *
+ * Uncomment this macro to let mbed TLS use your own implementation of a
+ * hardware entropy collector.
+ *
+ * Your function must be called \c mbedtls_hardware_poll(), have the same
+ * prototype as declared in entropy_poll.h, and accept NULL as first argument.
+ *
+ * Uncomment to use your own hardware entropy collector.
+ */
+//#define MBEDTLS_ENTROPY_HARDWARE_ALT
+
+/**
+ * \def MBEDTLS_AES_ROM_TABLES
+ *
+ * Use precomputed AES tables stored in ROM.
+ *
+ * Uncomment this macro to use precomputed AES tables stored in ROM.
+ * Comment this macro to generate AES tables in RAM at runtime.
+ *
+ * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb
+ * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the
+ * initialization time before the first AES operation can be performed.
+ * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c
+ * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded
+ * performance if ROM access is slower than RAM access.
+ *
+ * This option is independent of \c MBEDTLS_AES_FEWER_TABLES.
+ *
+ */
+//#define MBEDTLS_AES_ROM_TABLES
+
+/**
+ * \def MBEDTLS_AES_FEWER_TABLES
+ *
+ * Use less ROM/RAM for AES tables.
+ *
+ * Uncommenting this macro omits 75% of the AES tables from
+ * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES)
+ * by computing their values on the fly during operations
+ * (the tables are entry-wise rotations of one another).
+ *
+ * Tradeoff: Uncommenting this reduces the RAM / ROM footprint
+ * by ~6kb but at the cost of more arithmetic operations during
+ * runtime. Specifically, one has to compare 4 accesses within
+ * different tables to 4 accesses with additional arithmetic
+ * operations within the same table. The performance gain/loss
+ * depends on the system and memory details.
+ *
+ * This option is independent of \c MBEDTLS_AES_ROM_TABLES.
+ *
+ */
+//#define MBEDTLS_AES_FEWER_TABLES
+
+/**
+ * \def MBEDTLS_CAMELLIA_SMALL_MEMORY
+ *
+ * Use less ROM for the Camellia implementation (saves about 768 bytes).
+ *
+ * Uncomment this macro to use less memory for Camellia.
+ */
+//#define MBEDTLS_CAMELLIA_SMALL_MEMORY
+
+/**
+ * \def MBEDTLS_CIPHER_MODE_CBC
+ *
+ * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
+ */
+#define MBEDTLS_CIPHER_MODE_CBC
+
+/**
+ * \def MBEDTLS_CIPHER_MODE_CFB
+ *
+ * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
+ */
+#define MBEDTLS_CIPHER_MODE_CFB
+
+/**
+ * \def MBEDTLS_CIPHER_MODE_CTR
+ *
+ * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
+ */
+#define MBEDTLS_CIPHER_MODE_CTR
+
+/**
+ * \def MBEDTLS_CIPHER_MODE_OFB
+ *
+ * Enable Output Feedback mode (OFB) for symmetric ciphers.
+ */
+#define MBEDTLS_CIPHER_MODE_OFB
+
+/**
+ * \def MBEDTLS_CIPHER_MODE_XTS
+ *
+ * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES.
+ */
+#define MBEDTLS_CIPHER_MODE_XTS
+
+/**
+ * \def MBEDTLS_CIPHER_NULL_CIPHER
+ *
+ * Enable NULL cipher.
+ * Warning: Only do so when you know what you are doing. This allows for
+ * encryption or channels without any security!
+ *
+ * Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable
+ * the following ciphersuites:
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA
+ *      MBEDTLS_TLS_RSA_WITH_NULL_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_NULL_SHA
+ *      MBEDTLS_TLS_RSA_WITH_NULL_MD5
+ *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA
+ *      MBEDTLS_TLS_PSK_WITH_NULL_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_NULL_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_NULL_SHA
+ *
+ * Uncomment this macro to enable the NULL cipher and ciphersuites
+ */
+//#define MBEDTLS_CIPHER_NULL_CIPHER
+
+/**
+ * \def MBEDTLS_CIPHER_PADDING_PKCS7
+ *
+ * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for
+ * specific padding modes in the cipher layer with cipher modes that support
+ * padding (e.g. CBC)
+ *
+ * If you disable all padding modes, only full blocks can be used with CBC.
+ *
+ * Enable padding modes in the cipher layer.
+ */
+#define MBEDTLS_CIPHER_PADDING_PKCS7
+#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
+#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
+#define MBEDTLS_CIPHER_PADDING_ZEROS
+
+/**
+ * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES
+ *
+ * Enable weak ciphersuites in SSL / TLS.
+ * Warning: Only do so when you know what you are doing. This allows for
+ * channels with virtually no security at all!
+ *
+ * This enables the following ciphersuites:
+ *      MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA
+ *
+ * Uncomment this macro to enable weak ciphersuites
+ *
+ * \warning   DES is considered a weak cipher and its use constitutes a
+ *            security risk. We recommend considering stronger ciphers instead.
+ */
+//#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES
+
+/**
+ * \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES
+ *
+ * Remove RC4 ciphersuites by default in SSL / TLS.
+ * This flag removes the ciphersuites based on RC4 from the default list as
+ * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to
+ * enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them
+ * explicitly.
+ *
+ * Uncomment this macro to remove RC4 ciphersuites by default.
+ */
+#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
+
+/**
+ * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED
+ *
+ * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve
+ * module.  By default all supported curves are enabled.
+ *
+ * Comment macros to disable the curve and functions for it
+ */
+#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
+#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
+#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
+#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
+#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
+#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
+#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
+#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
+#define MBEDTLS_ECP_DP_BP256R1_ENABLED
+#define MBEDTLS_ECP_DP_BP384R1_ENABLED
+#define MBEDTLS_ECP_DP_BP512R1_ENABLED
+#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
+#define MBEDTLS_ECP_DP_CURVE448_ENABLED
+
+/**
+ * \def MBEDTLS_ECP_NIST_OPTIM
+ *
+ * Enable specific 'modulo p' routines for each NIST prime.
+ * Depending on the prime and architecture, makes operations 4 to 8 times
+ * faster on the corresponding curve.
+ *
+ * Comment this macro to disable NIST curves optimisation.
+ */
+#define MBEDTLS_ECP_NIST_OPTIM
+
+/**
+ * \def MBEDTLS_ECP_RESTARTABLE
+ *
+ * Enable "non-blocking" ECC operations that can return early and be resumed.
+ *
+ * This allows various functions to pause by returning
+ * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module,
+ * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in
+ * order to further progress and eventually complete their operation. This is
+ * controlled through mbedtls_ecp_set_max_ops() which limits the maximum
+ * number of ECC operations a function may perform before pausing; see
+ * mbedtls_ecp_set_max_ops() for more information.
+ *
+ * This is useful in non-threaded environments if you want to avoid blocking
+ * for too long on ECC (and, hence, X.509 or SSL/TLS) operations.
+ *
+ * Uncomment this macro to enable restartable ECC computations.
+ *
+ * \note  This option only works with the default software implementation of
+ *        elliptic curve functionality. It is incompatible with
+ *        MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT and MBEDTLS_ECDSA_XXX_ALT.
+ */
+//#define MBEDTLS_ECP_RESTARTABLE
+
+/**
+ * \def MBEDTLS_ECDSA_DETERMINISTIC
+ *
+ * Enable deterministic ECDSA (RFC 6979).
+ * Standard ECDSA is "fragile" in the sense that lack of entropy when signing
+ * may result in a compromise of the long-term signing key. This is avoided by
+ * the deterministic variant.
+ *
+ * Requires: MBEDTLS_HMAC_DRBG_C
+ *
+ * Comment this macro to disable deterministic ECDSA.
+ */
+#define MBEDTLS_ECDSA_DETERMINISTIC
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
+ *
+ * Enable the PSK based ciphersuite modes in SSL / TLS.
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
+ */
+#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
+ *
+ * Enable the DHE-PSK based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_DHM_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
+ *
+ * \warning    Using DHE constitutes a security risk as it
+ *             is not possible to validate custom DH parameters.
+ *             If possible, it is recommended users should consider
+ *             preferring other methods of key exchange.
+ *             See dhm.h for more details.
+ *
+ */
+#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
+ *
+ * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_ECDH_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
+ */
+#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
+ *
+ * Enable the RSA-PSK based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
+ *           MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
+ */
+#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
+ *
+ * Enable the RSA-only based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
+ *           MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
+ */
+#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
+ *
+ * Enable the DHE-RSA based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
+ *           MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+ *
+ * \warning    Using DHE constitutes a security risk as it
+ *             is not possible to validate custom DH parameters.
+ *             If possible, it is recommended users should consider
+ *             preferring other methods of key exchange.
+ *             See dhm.h for more details.
+ *
+ */
+#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
+ *
+ * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
+ *           MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
+ */
+#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
+ *
+ * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C,
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
+ */
+#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
+ *
+ * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ */
+#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
+ *
+ * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS.
+ *
+ * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ */
+#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
+
+/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
+ *
+ * Enable the ECJPAKE based ciphersuite modes in SSL / TLS.
+ *
+ * \warning This is currently experimental. EC J-PAKE support is based on the
+ * Thread v1.0.0 specification; incompatible changes to the specification
+ * might still happen. For this reason, this is disabled by default.
+ *
+ * Requires: MBEDTLS_ECJPAKE_C
+ *           MBEDTLS_SHA256_C
+ *           MBEDTLS_ECP_DP_SECP256R1_ENABLED
+ *
+ * This enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
+ */
+//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
+
+/**
+ * \def MBEDTLS_PK_PARSE_EC_EXTENDED
+ *
+ * Enhance support for reading EC keys using variants of SEC1 not allowed by
+ * RFC 5915 and RFC 5480.
+ *
+ * Currently this means parsing the SpecifiedECDomain choice of EC
+ * parameters (only known groups are supported, not arbitrary domains, to
+ * avoid validation issues).
+ *
+ * Disable if you only need to support RFC 5915 + 5480 key formats.
+ */
+#define MBEDTLS_PK_PARSE_EC_EXTENDED
+
+/**
+ * \def MBEDTLS_ERROR_STRERROR_DUMMY
+ *
+ * Enable a dummy error function to make use of mbedtls_strerror() in
+ * third party libraries easier when MBEDTLS_ERROR_C is disabled
+ * (no effect when MBEDTLS_ERROR_C is enabled).
+ *
+ * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're
+ * not using mbedtls_strerror() or error_strerror() in your application.
+ *
+ * Disable if you run into name conflicts and want to really remove the
+ * mbedtls_strerror()
+ */
+#define MBEDTLS_ERROR_STRERROR_DUMMY
+
+/**
+ * \def MBEDTLS_GENPRIME
+ *
+ * Enable the prime-number generation code.
+ *
+ * Requires: MBEDTLS_BIGNUM_C
+ */
+#define MBEDTLS_GENPRIME
+
+/**
+ * \def MBEDTLS_FS_IO
+ *
+ * Enable functions that use the filesystem.
+ */
+//#define MBEDTLS_FS_IO
+
+/**
+ * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
+ *
+ * Do not add default entropy sources. These are the platform specific,
+ * mbedtls_timing_hardclock and HAVEGE based poll functions.
+ *
+ * This is useful to have more control over the added entropy sources in an
+ * application.
+ *
+ * Uncomment this macro to prevent loading of default entropy functions.
+ */
+//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
+
+/**
+ * \def MBEDTLS_NO_PLATFORM_ENTROPY
+ *
+ * Do not use built-in platform entropy functions.
+ * This is useful if your platform does not support
+ * standards like the /dev/urandom or Windows CryptoAPI.
+ *
+ * Uncomment this macro to disable the built-in platform entropy functions.
+ */
+#define MBEDTLS_NO_PLATFORM_ENTROPY
+
+/**
+ * \def MBEDTLS_ENTROPY_FORCE_SHA256
+ *
+ * Force the entropy accumulator to use a SHA-256 accumulator instead of the
+ * default SHA-512 based one (if both are available).
+ *
+ * Requires: MBEDTLS_SHA256_C
+ *
+ * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option
+ * if you have performance concerns.
+ *
+ * This option is only useful if both MBEDTLS_SHA256_C and
+ * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
+ */
+//#define MBEDTLS_ENTROPY_FORCE_SHA256
+
+/**
+ * \def MBEDTLS_ENTROPY_NV_SEED
+ *
+ * Enable the non-volatile (NV) seed file-based entropy source.
+ * (Also enables the NV seed read/write functions in the platform layer)
+ *
+ * This is crucial (if not required) on systems that do not have a
+ * cryptographic entropy source (in hardware or kernel) available.
+ *
+ * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C
+ *
+ * \note The read/write functions that are used by the entropy source are
+ *       determined in the platform layer, and can be modified at runtime and/or
+ *       compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used.
+ *
+ * \note If you use the default implementation functions that read a seedfile
+ *       with regular fopen(), please make sure you make a seedfile with the
+ *       proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at
+ *       least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from
+ *       and written to or you will get an entropy source error! The default
+ *       implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE
+ *       bytes from the file.
+ *
+ * \note The entropy collector will write to the seed file before entropy is
+ *       given to an external source, to update it.
+ */
+//#define MBEDTLS_ENTROPY_NV_SEED
+
+/**
+ * \def MBEDTLS_MEMORY_DEBUG
+ *
+ * Enable debugging of buffer allocator memory issues. Automatically prints
+ * (to stderr) all (fatal) messages on memory allocation issues. Enables
+ * function for 'debug output' of allocated memory.
+ *
+ * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
+ *
+ * Uncomment this macro to let the buffer allocator print out error messages.
+ */
+//#define MBEDTLS_MEMORY_DEBUG
+
+/**
+ * \def MBEDTLS_MEMORY_BACKTRACE
+ *
+ * Include backtrace information with each allocated block.
+ *
+ * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
+ *           GLIBC-compatible backtrace() an backtrace_symbols() support
+ *
+ * Uncomment this macro to include backtrace information
+ */
+//#define MBEDTLS_MEMORY_BACKTRACE
+
+/**
+ * \def MBEDTLS_PK_RSA_ALT_SUPPORT
+ *
+ * Support external private RSA keys (eg from a HSM) in the PK layer.
+ *
+ * Comment this macro to disable support for external private RSA keys.
+ */
+#define MBEDTLS_PK_RSA_ALT_SUPPORT
+
+/**
+ * \def MBEDTLS_PKCS1_V15
+ *
+ * Enable support for PKCS#1 v1.5 encoding.
+ *
+ * Requires: MBEDTLS_RSA_C
+ *
+ * This enables support for PKCS#1 v1.5 operations.
+ */
+#define MBEDTLS_PKCS1_V15
+
+/**
+ * \def MBEDTLS_PKCS1_V21
+ *
+ * Enable support for PKCS#1 v2.1 encoding.
+ *
+ * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C
+ *
+ * This enables support for RSAES-OAEP and RSASSA-PSS operations.
+ */
+#define MBEDTLS_PKCS1_V21
+
+/**
+ * \def MBEDTLS_RSA_NO_CRT
+ *
+ * Do not use the Chinese Remainder Theorem
+ * for the RSA private operation.
+ *
+ * Uncomment this macro to disable the use of CRT in RSA.
+ *
+ */
+//#define MBEDTLS_RSA_NO_CRT
+
+/**
+ * \def MBEDTLS_SELF_TEST
+ *
+ * Enable the checkup functions (*_self_test).
+ */
+#define MBEDTLS_SELF_TEST
+
+/**
+ * \def MBEDTLS_SHA256_SMALLER
+ *
+ * Enable an implementation of SHA-256 that has lower ROM footprint but also
+ * lower performance.
+ *
+ * The default implementation is meant to be a reasonnable compromise between
+ * performance and size. This version optimizes more aggressively for size at
+ * the expense of performance. Eg on Cortex-M4 it reduces the size of
+ * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about
+ * 30%.
+ *
+ * Uncomment to enable the smaller implementation of SHA256.
+ */
+//#define MBEDTLS_SHA256_SMALLER
+
+/**
+ * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
+ *
+ * Enable sending of alert messages in case of encountered errors as per RFC.
+ * If you choose not to send the alert messages, mbed TLS can still communicate
+ * with other servers, only debugging of failures is harder.
+ *
+ * The advantage of not sending alert messages, is that no information is given
+ * about reasons for failures thus preventing adversaries of gaining intel.
+ *
+ * Enable sending of all alert messages
+ */
+#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
+
+/**
+ * \def MBEDTLS_SSL_ASYNC_PRIVATE
+ *
+ * Enable asynchronous external private key operations in SSL. This allows
+ * you to configure an SSL connection to call an external cryptographic
+ * module to perform private key operations instead of performing the
+ * operation inside the library.
+ *
+ */
+//#define MBEDTLS_SSL_ASYNC_PRIVATE
+
+/**
+ * \def MBEDTLS_SSL_DEBUG_ALL
+ *
+ * Enable the debug messages in SSL module for all issues.
+ * Debug messages have been disabled in some places to prevent timing
+ * attacks due to (unbalanced) debugging function calls.
+ *
+ * If you need all error reporting you should enable this during debugging,
+ * but remove this for production servers that should log as well.
+ *
+ * Uncomment this macro to report all debug messages on errors introducing
+ * a timing side-channel.
+ *
+ */
+//#define MBEDTLS_SSL_DEBUG_ALL
+
+/** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC
+ *
+ * Enable support for Encrypt-then-MAC, RFC 7366.
+ *
+ * This allows peers that both support it to use a more robust protection for
+ * ciphersuites using CBC, providing deep resistance against timing attacks
+ * on the padding or underlying cipher.
+ *
+ * This only affects CBC ciphersuites, and is useless if none is defined.
+ *
+ * Requires: MBEDTLS_SSL_PROTO_TLS1    or
+ *           MBEDTLS_SSL_PROTO_TLS1_1  or
+ *           MBEDTLS_SSL_PROTO_TLS1_2
+ *
+ * Comment this macro to disable support for Encrypt-then-MAC
+ */
+#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
+
+/** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET
+ *
+ * Enable support for Extended Master Secret, aka Session Hash
+ * (draft-ietf-tls-session-hash-02).
+ *
+ * This was introduced as "the proper fix" to the Triple Handshake familiy of
+ * attacks, but it is recommended to always use it (even if you disable
+ * renegotiation), since it actually fixes a more fundamental issue in the
+ * original SSL/TLS design, and has implications beyond Triple Handshake.
+ *
+ * Requires: MBEDTLS_SSL_PROTO_TLS1    or
+ *           MBEDTLS_SSL_PROTO_TLS1_1  or
+ *           MBEDTLS_SSL_PROTO_TLS1_2
+ *
+ * Comment this macro to disable support for Extended Master Secret.
+ */
+#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
+
+/**
+ * \def MBEDTLS_SSL_FALLBACK_SCSV
+ *
+ * Enable support for FALLBACK_SCSV (draft-ietf-tls-downgrade-scsv-00).
+ *
+ * For servers, it is recommended to always enable this, unless you support
+ * only one version of TLS, or know for sure that none of your clients
+ * implements a fallback strategy.
+ *
+ * For clients, you only need this if you're using a fallback strategy, which
+ * is not recommended in the first place, unless you absolutely need it to
+ * interoperate with buggy (version-intolerant) servers.
+ *
+ * Comment this macro to disable support for FALLBACK_SCSV
+ */
+#define MBEDTLS_SSL_FALLBACK_SCSV
+
+/**
+ * \def MBEDTLS_SSL_HW_RECORD_ACCEL
+ *
+ * Enable hooking functions in SSL module for hardware acceleration of
+ * individual records.
+ *
+ * Uncomment this macro to enable hooking functions.
+ */
+//#define MBEDTLS_SSL_HW_RECORD_ACCEL
+
+/**
+ * \def MBEDTLS_SSL_CBC_RECORD_SPLITTING
+ *
+ * Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0.
+ *
+ * This is a countermeasure to the BEAST attack, which also minimizes the risk
+ * of interoperability issues compared to sending 0-length records.
+ *
+ * Comment this macro to disable 1/n-1 record splitting.
+ */
+#define MBEDTLS_SSL_CBC_RECORD_SPLITTING
+
+/**
+ * \def MBEDTLS_SSL_RENEGOTIATION
+ *
+ * Enable support for TLS renegotiation.
+ *
+ * The two main uses of renegotiation are (1) refresh keys on long-lived
+ * connections and (2) client authentication after the initial handshake.
+ * If you don't need renegotiation, it's probably better to disable it, since
+ * it has been associated with security issues in the past and is easy to
+ * misuse/misunderstand.
+ *
+ * Comment this to disable support for renegotiation.
+ *
+ * \note   Even if this option is disabled, both client and server are aware
+ *         of the Renegotiation Indication Extension (RFC 5746) used to
+ *         prevent the SSL renegotiation attack (see RFC 5746 Sect. 1).
+ *         (See \c mbedtls_ssl_conf_legacy_renegotiation for the
+ *          configuration of this extension).
+ *
+ */
+#define MBEDTLS_SSL_RENEGOTIATION
+
+/**
+ * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
+ *
+ * Enable support for receiving and parsing SSLv2 Client Hello messages for the
+ * SSL Server module (MBEDTLS_SSL_SRV_C).
+ *
+ * Uncomment this macro to enable support for SSLv2 Client Hello messages.
+ */
+//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
+
+/**
+ * \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
+ *
+ * Pick the ciphersuite according to the client's preferences rather than ours
+ * in the SSL Server module (MBEDTLS_SSL_SRV_C).
+ *
+ * Uncomment this macro to respect client's ciphersuite order
+ */
+//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
+
+/**
+ * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
+ *
+ * Enable support for RFC 6066 max_fragment_length extension in SSL.
+ *
+ * Comment this macro to disable support for the max_fragment_length extension
+ */
+#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
+
+/**
+ * \def MBEDTLS_SSL_PROTO_SSL3
+ *
+ * Enable support for SSL 3.0.
+ *
+ * Requires: MBEDTLS_MD5_C
+ *           MBEDTLS_SHA1_C
+ *
+ * Comment this macro to disable support for SSL 3.0
+ */
+//#define MBEDTLS_SSL_PROTO_SSL3
+
+/**
+ * \def MBEDTLS_SSL_PROTO_TLS1
+ *
+ * Enable support for TLS 1.0.
+ *
+ * Requires: MBEDTLS_MD5_C
+ *           MBEDTLS_SHA1_C
+ *
+ * Comment this macro to disable support for TLS 1.0
+ */
+#define MBEDTLS_SSL_PROTO_TLS1
+
+/**
+ * \def MBEDTLS_SSL_PROTO_TLS1_1
+ *
+ * Enable support for TLS 1.1 (and DTLS 1.0 if DTLS is enabled).
+ *
+ * Requires: MBEDTLS_MD5_C
+ *           MBEDTLS_SHA1_C
+ *
+ * Comment this macro to disable support for TLS 1.1 / DTLS 1.0
+ */
+#define MBEDTLS_SSL_PROTO_TLS1_1
+
+/**
+ * \def MBEDTLS_SSL_PROTO_TLS1_2
+ *
+ * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled).
+ *
+ * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C
+ *           (Depends on ciphersuites)
+ *
+ * Comment this macro to disable support for TLS 1.2 / DTLS 1.2
+ */
+#define MBEDTLS_SSL_PROTO_TLS1_2
+
+/**
+ * \def MBEDTLS_SSL_PROTO_DTLS
+ *
+ * Enable support for DTLS (all available versions).
+ *
+ * Enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0,
+ * and/or this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2.
+ *
+ * Requires: MBEDTLS_SSL_PROTO_TLS1_1
+ *        or MBEDTLS_SSL_PROTO_TLS1_2
+ *
+ * Comment this macro to disable support for DTLS
+ */
+#define MBEDTLS_SSL_PROTO_DTLS
+
+/**
+ * \def MBEDTLS_SSL_ALPN
+ *
+ * Enable support for RFC 7301 Application Layer Protocol Negotiation.
+ *
+ * Comment this macro to disable support for ALPN.
+ */
+#define MBEDTLS_SSL_ALPN
+
+/**
+ * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY
+ *
+ * Enable support for the anti-replay mechanism in DTLS.
+ *
+ * Requires: MBEDTLS_SSL_TLS_C
+ *           MBEDTLS_SSL_PROTO_DTLS
+ *
+ * \warning Disabling this is often a security risk!
+ * See mbedtls_ssl_conf_dtls_anti_replay() for details.
+ *
+ * Comment this to disable anti-replay in DTLS.
+ */
+#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
+
+/**
+ * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY
+ *
+ * Enable support for HelloVerifyRequest on DTLS servers.
+ *
+ * This feature is highly recommended to prevent DTLS servers being used as
+ * amplifiers in DoS attacks against other hosts. It should always be enabled
+ * unless you know for sure amplification cannot be a problem in the
+ * environment in which your server operates.
+ *
+ * \warning Disabling this can ba a security risk! (see above)
+ *
+ * Requires: MBEDTLS_SSL_PROTO_DTLS
+ *
+ * Comment this to disable support for HelloVerifyRequest.
+ */
+#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
+
+/**
+ * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
+ *
+ * Enable server-side support for clients that reconnect from the same port.
+ *
+ * Some clients unexpectedly close the connection and try to reconnect using the
+ * same source port. This needs special support from the server to handle the
+ * new connection securely, as described in section 4.2.8 of RFC 6347. This
+ * flag enables that support.
+ *
+ * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY
+ *
+ * Comment this to disable support for clients reusing the source port.
+ */
+#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
+
+/**
+ * \def MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+ *
+ * Enable support for a limit of records with bad MAC.
+ *
+ * See mbedtls_ssl_conf_dtls_badmac_limit().
+ *
+ * Requires: MBEDTLS_SSL_PROTO_DTLS
+ */
+#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
+
+/**
+ * \def MBEDTLS_SSL_SESSION_TICKETS
+ *
+ * Enable support for RFC 5077 session tickets in SSL.
+ * Client-side, provides full support for session tickets (maintainance of a
+ * session store remains the responsibility of the application, though).
+ * Server-side, you also need to provide callbacks for writing and parsing
+ * tickets, including authenticated encryption and key management. Example
+ * callbacks are provided by MBEDTLS_SSL_TICKET_C.
+ *
+ * Comment this macro to disable support for SSL session tickets
+ */
+#define MBEDTLS_SSL_SESSION_TICKETS
+
+/**
+ * \def MBEDTLS_SSL_EXPORT_KEYS
+ *
+ * Enable support for exporting key block and master secret.
+ * This is required for certain users of TLS, e.g. EAP-TLS.
+ *
+ * Comment this macro to disable support for key export
+ */
+#define MBEDTLS_SSL_EXPORT_KEYS
+
+/**
+ * \def MBEDTLS_SSL_SERVER_NAME_INDICATION
+ *
+ * Enable support for RFC 6066 server name indication (SNI) in SSL.
+ *
+ * Requires: MBEDTLS_X509_CRT_PARSE_C
+ *
+ * Comment this macro to disable support for server name indication in SSL
+ */
+#define MBEDTLS_SSL_SERVER_NAME_INDICATION
+
+/**
+ * \def MBEDTLS_SSL_TRUNCATED_HMAC
+ *
+ * Enable support for RFC 6066 truncated HMAC in SSL.
+ *
+ * Comment this macro to disable support for truncated HMAC in SSL
+ */
+#define MBEDTLS_SSL_TRUNCATED_HMAC
+
+/**
+ * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
+ *
+ * Fallback to old (pre-2.7), non-conforming implementation of the truncated
+ * HMAC extension which also truncates the HMAC key. Note that this option is
+ * only meant for a transitory upgrade period and is likely to be removed in
+ * a future version of the library.
+ *
+ * \warning The old implementation is non-compliant and has a security weakness
+ *          (2^80 brute force attack on the HMAC key used for a single,
+ *          uninterrupted connection). This should only be enabled temporarily
+ *          when (1) the use of truncated HMAC is essential in order to save
+ *          bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use
+ *          the fixed implementation yet (pre-2.7).
+ *
+ * \deprecated This option is deprecated and will likely be removed in a
+ *             future version of Mbed TLS.
+ *
+ * Uncomment to fallback to old, non-compliant truncated HMAC implementation.
+ *
+ * Requires: MBEDTLS_SSL_TRUNCATED_HMAC
+ */
+//#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
+
+/**
+ * \def MBEDTLS_THREADING_ALT
+ *
+ * Provide your own alternate threading implementation.
+ *
+ * Requires: MBEDTLS_THREADING_C
+ *
+ * Uncomment this to allow your own alternate threading implementation.
+ */
+//#define MBEDTLS_THREADING_ALT
+
+/**
+ * \def MBEDTLS_THREADING_PTHREAD
+ *
+ * Enable the pthread wrapper layer for the threading layer.
+ *
+ * Requires: MBEDTLS_THREADING_C
+ *
+ * Uncomment this to enable pthread mutexes.
+ */
+//#define MBEDTLS_THREADING_PTHREAD
+
+/**
+ * \def MBEDTLS_VERSION_FEATURES
+ *
+ * Allow run-time checking of compile-time enabled features. Thus allowing users
+ * to check at run-time if the library is for instance compiled with threading
+ * support via mbedtls_version_check_feature().
+ *
+ * Requires: MBEDTLS_VERSION_C
+ *
+ * Comment this to disable run-time checking and save ROM space
+ */
+#define MBEDTLS_VERSION_FEATURES
+
+/**
+ * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
+ *
+ * If set, the X509 parser will not break-off when parsing an X509 certificate
+ * and encountering an extension in a v1 or v2 certificate.
+ *
+ * Uncomment to prevent an error.
+ */
+//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
+
+/**
+ * \def MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
+ *
+ * If set, the X509 parser will not break-off when parsing an X509 certificate
+ * and encountering an unknown critical extension.
+ *
+ * \warning Depending on your PKI use, enabling this can be a security risk!
+ *
+ * Uncomment to prevent an error.
+ */
+//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
+
+/**
+ * \def MBEDTLS_X509_CHECK_KEY_USAGE
+ *
+ * Enable verification of the keyUsage extension (CA and leaf certificates).
+ *
+ * Disabling this avoids problems with mis-issued and/or misused
+ * (intermediate) CA and leaf certificates.
+ *
+ * \warning Depending on your PKI use, disabling this can be a security risk!
+ *
+ * Comment to skip keyUsage checking for both CA and leaf certificates.
+ */
+#define MBEDTLS_X509_CHECK_KEY_USAGE
+
+/**
+ * \def MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
+ *
+ * Enable verification of the extendedKeyUsage extension (leaf certificates).
+ *
+ * Disabling this avoids problems with mis-issued and/or misused certificates.
+ *
+ * \warning Depending on your PKI use, disabling this can be a security risk!
+ *
+ * Comment to skip extendedKeyUsage checking for certificates.
+ */
+#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
+
+/**
+ * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT
+ *
+ * Enable parsing and verification of X.509 certificates, CRLs and CSRS
+ * signed with RSASSA-PSS (aka PKCS#1 v2.1).
+ *
+ * Comment this macro to disallow using RSASSA-PSS in certificates.
+ */
+#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
+
+/**
+ * \def MBEDTLS_ZLIB_SUPPORT
+ *
+ * If set, the SSL/TLS module uses ZLIB to support compression and
+ * decompression of packet data.
+ *
+ * \warning TLS-level compression MAY REDUCE SECURITY! See for example the
+ * CRIME attack. Before enabling this option, you should examine with care if
+ * CRIME or similar exploits may be a applicable to your use case.
+ *
+ * \note Currently compression can't be used with DTLS.
+ *
+ * \deprecated This feature is deprecated and will be removed
+ *             in the next major revision of the library.
+ *
+ * Used in: library/ssl_tls.c
+ *          library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * This feature requires zlib library and headers to be present.
+ *
+ * Uncomment to enable use of ZLIB
+ */
+//#define MBEDTLS_ZLIB_SUPPORT
+/* \} name SECTION: mbed TLS feature support */
+
+/**
+ * \name SECTION: mbed TLS modules
+ *
+ * This section enables or disables entire modules in mbed TLS
+ * \{
+ */
+
+/**
+ * \def MBEDTLS_AESNI_C
+ *
+ * Enable AES-NI support on x86-64.
+ *
+ * Module:  library/aesni.c
+ * Caller:  library/aes.c
+ *
+ * Requires: MBEDTLS_HAVE_ASM
+ *
+ * This modules adds support for the AES-NI instructions on x86-64
+ */
+//#define MBEDTLS_AESNI_C
+
+/**
+ * \def MBEDTLS_AES_C
+ *
+ * Enable the AES block cipher.
+ *
+ * Module:  library/aes.c
+ * Caller:  library/cipher.c
+ *          library/pem.c
+ *          library/ctr_drbg.c
+ *
+ * This module enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
+ *
+ * PEM_PARSE uses AES for decrypting encrypted keys.
+ */
+#define MBEDTLS_AES_C
+
+/**
+ * \def MBEDTLS_ARC4_C
+ *
+ * Enable the ARCFOUR stream cipher.
+ *
+ * Module:  library/arc4.c
+ * Caller:  library/cipher.c
+ *
+ * This module enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
+ *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
+ *      MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
+ *
+ * \warning   ARC4 is considered a weak cipher and its use constitutes a
+ *            security risk. If possible, we recommend avoidng dependencies on
+ *            it, and considering stronger ciphers instead.
+ *
+ */
+#define MBEDTLS_ARC4_C
+
+/**
+ * \def MBEDTLS_ASN1_PARSE_C
+ *
+ * Enable the generic ASN1 parser.
+ *
+ * Module:  library/asn1.c
+ * Caller:  library/x509.c
+ *          library/dhm.c
+ *          library/pkcs12.c
+ *          library/pkcs5.c
+ *          library/pkparse.c
+ */
+#define MBEDTLS_ASN1_PARSE_C
+
+/**
+ * \def MBEDTLS_ASN1_WRITE_C
+ *
+ * Enable the generic ASN1 writer.
+ *
+ * Module:  library/asn1write.c
+ * Caller:  library/ecdsa.c
+ *          library/pkwrite.c
+ *          library/x509_create.c
+ *          library/x509write_crt.c
+ *          library/x509write_csr.c
+ */
+#define MBEDTLS_ASN1_WRITE_C
+
+/**
+ * \def MBEDTLS_BASE64_C
+ *
+ * Enable the Base64 module.
+ *
+ * Module:  library/base64.c
+ * Caller:  library/pem.c
+ *
+ * This module is required for PEM support (required by X.509).
+ */
+#define MBEDTLS_BASE64_C
+
+/**
+ * \def MBEDTLS_BIGNUM_C
+ *
+ * Enable the multi-precision integer library.
+ *
+ * Module:  library/bignum.c
+ * Caller:  library/dhm.c
+ *          library/ecp.c
+ *          library/ecdsa.c
+ *          library/rsa.c
+ *          library/rsa_internal.c
+ *          library/ssl_tls.c
+ *
+ * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support.
+ */
+#define MBEDTLS_BIGNUM_C
+
+/**
+ * \def MBEDTLS_BLOWFISH_C
+ *
+ * Enable the Blowfish block cipher.
+ *
+ * Module:  library/blowfish.c
+ */
+#define MBEDTLS_BLOWFISH_C
+
+/**
+ * \def MBEDTLS_CAMELLIA_C
+ *
+ * Enable the Camellia block cipher.
+ *
+ * Module:  library/camellia.c
+ * Caller:  library/cipher.c
+ *
+ * This module enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
+ */
+#define MBEDTLS_CAMELLIA_C
+
+/**
+ * \def MBEDTLS_ARIA_C
+ *
+ * Enable the ARIA block cipher.
+ *
+ * Module:  library/aria.c
+ * Caller:  library/cipher.c
+ *
+ * This module enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *
+ *      MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384
+ *      MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256
+ *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384
+ */
+//#define MBEDTLS_ARIA_C
+
+/**
+ * \def MBEDTLS_CCM_C
+ *
+ * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
+ *
+ * Module:  library/ccm.c
+ *
+ * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C
+ *
+ * This module enables the AES-CCM ciphersuites, if other requisites are
+ * enabled as well.
+ */
+#define MBEDTLS_CCM_C
+
+/**
+ * \def MBEDTLS_CERTS_C
+ *
+ * Enable the test certificates.
+ *
+ * Module:  library/certs.c
+ * Caller:
+ *
+ * This module is used for testing (ssl_client/server).
+ */
+#define MBEDTLS_CERTS_C
+
+/**
+ * \def MBEDTLS_CHACHA20_C
+ *
+ * Enable the ChaCha20 stream cipher.
+ *
+ * Module:  library/chacha20.c
+ */
+#define MBEDTLS_CHACHA20_C
+
+/**
+ * \def MBEDTLS_CHACHAPOLY_C
+ *
+ * Enable the ChaCha20-Poly1305 AEAD algorithm.
+ *
+ * Module:  library/chachapoly.c
+ *
+ * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C
+ */
+#define MBEDTLS_CHACHAPOLY_C
+
+/**
+ * \def MBEDTLS_CIPHER_C
+ *
+ * Enable the generic cipher layer.
+ *
+ * Module:  library/cipher.c
+ * Caller:  library/ssl_tls.c
+ *
+ * Uncomment to enable generic cipher wrappers.
+ */
+#define MBEDTLS_CIPHER_C
+
+/**
+ * \def MBEDTLS_CMAC_C
+ *
+ * Enable the CMAC (Cipher-based Message Authentication Code) mode for block
+ * ciphers.
+ *
+ * Module:  library/cmac.c
+ *
+ * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C
+ *
+ */
+//#define MBEDTLS_CMAC_C
+
+/**
+ * \def MBEDTLS_CTR_DRBG_C
+ *
+ * Enable the CTR_DRBG AES-based random generator.
+ * The CTR_DRBG generator uses AES-256 by default.
+ * To use AES-128 instead, enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY below.
+ *
+ * Module:  library/ctr_drbg.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_AES_C
+ *
+ * This module provides the CTR_DRBG AES random number generator.
+ */
+#define MBEDTLS_CTR_DRBG_C
+
+/**
+ * \def MBEDTLS_DEBUG_C
+ *
+ * Enable the debug functions.
+ *
+ * Module:  library/debug.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *          library/ssl_tls.c
+ *
+ * This module provides debugging functions.
+ */
+#ifndef MBEDTLS_NO_TRACE
+#define MBEDTLS_DEBUG_C
+#endif
+/**
+ * \def MBEDTLS_DES_C
+ *
+ * Enable the DES block cipher.
+ *
+ * Module:  library/des.c
+ * Caller:  library/pem.c
+ *          library/cipher.c
+ *
+ * This module enables the following ciphersuites (if other requisites are
+ * enabled as well):
+ *      MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
+ *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
+ *
+ * PEM_PARSE uses DES/3DES for decrypting encrypted keys.
+ *
+ * \warning   DES is considered a weak cipher and its use constitutes a
+ *            security risk. We recommend considering stronger ciphers instead.
+ */
+#define MBEDTLS_DES_C
+
+/**
+ * \def MBEDTLS_DHM_C
+ *
+ * Enable the Diffie-Hellman-Merkle module.
+ *
+ * Module:  library/dhm.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * This module is used by the following key exchanges:
+ *      DHE-RSA, DHE-PSK
+ *
+ * \warning    Using DHE constitutes a security risk as it
+ *             is not possible to validate custom DH parameters.
+ *             If possible, it is recommended users should consider
+ *             preferring other methods of key exchange.
+ *             See dhm.h for more details.
+ *
+ */
+#define MBEDTLS_DHM_C
+
+/**
+ * \def MBEDTLS_ECDH_C
+ *
+ * Enable the elliptic curve Diffie-Hellman library.
+ *
+ * Module:  library/ecdh.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * This module is used by the following key exchanges:
+ *      ECDHE-ECDSA, ECDHE-RSA, DHE-PSK
+ *
+ * Requires: MBEDTLS_ECP_C
+ */
+#define MBEDTLS_ECDH_C
+
+/**
+ * \def MBEDTLS_ECDSA_C
+ *
+ * Enable the elliptic curve DSA library.
+ *
+ * Module:  library/ecdsa.c
+ * Caller:
+ *
+ * This module is used by the following key exchanges:
+ *      ECDHE-ECDSA
+ *
+ * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C
+ */
+#define MBEDTLS_ECDSA_C
+
+/**
+ * \def MBEDTLS_ECJPAKE_C
+ *
+ * Enable the elliptic curve J-PAKE library.
+ *
+ * \warning This is currently experimental. EC J-PAKE support is based on the
+ * Thread v1.0.0 specification; incompatible changes to the specification
+ * might still happen. For this reason, this is disabled by default.
+ *
+ * Module:  library/ecjpake.c
+ * Caller:
+ *
+ * This module is used by the following key exchanges:
+ *      ECJPAKE
+ *
+ * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C
+ */
+//#define MBEDTLS_ECJPAKE_C
+
+/**
+ * \def MBEDTLS_ECP_C
+ *
+ * Enable the elliptic curve over GF(p) library.
+ *
+ * Module:  library/ecp.c
+ * Caller:  library/ecdh.c
+ *          library/ecdsa.c
+ *          library/ecjpake.c
+ *
+ * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED
+ */
+#define MBEDTLS_ECP_C
+
+/**
+ * \def MBEDTLS_ENTROPY_C
+ *
+ * Enable the platform-specific entropy code.
+ *
+ * Module:  library/entropy.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C
+ *
+ * This module provides a generic entropy pool
+ */
+#define MBEDTLS_ENTROPY_C
+
+/**
+ * \def MBEDTLS_ERROR_C
+ *
+ * Enable error code to error string conversion.
+ *
+ * Module:  library/error.c
+ * Caller:
+ *
+ * This module enables mbedtls_strerror().
+ */
+#define MBEDTLS_ERROR_C
+
+/**
+ * \def MBEDTLS_GCM_C
+ *
+ * Enable the Galois/Counter Mode (GCM) for AES.
+ *
+ * Module:  library/gcm.c
+ *
+ * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C
+ *
+ * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other
+ * requisites are enabled as well.
+ */
+#define MBEDTLS_GCM_C
+
+/**
+ * \def MBEDTLS_HAVEGE_C
+ *
+ * Enable the HAVEGE random generator.
+ *
+ * Warning: the HAVEGE random generator is not suitable for virtualized
+ *          environments
+ *
+ * Warning: the HAVEGE random generator is dependent on timing and specific
+ *          processor traits. It is therefore not advised to use HAVEGE as
+ *          your applications primary random generator or primary entropy pool
+ *          input. As a secondary input to your entropy pool, it IS able add
+ *          the (limited) extra entropy it provides.
+ *
+ * Module:  library/havege.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_TIMING_C
+ *
+ * Uncomment to enable the HAVEGE random generator.
+ */
+#define MBEDTLS_HAVEGE_C
+
+/**
+ * \def MBEDTLS_HKDF_C
+ *
+ * Enable the HKDF algorithm (RFC 5869).
+ *
+ * Module:  library/hkdf.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_MD_C
+ *
+ * This module adds support for the Hashed Message Authentication Code
+ * (HMAC)-based key derivation function (HKDF).
+ */
+#define MBEDTLS_HKDF_C
+
+/**
+ * \def MBEDTLS_HMAC_DRBG_C
+ *
+ * Enable the HMAC_DRBG random generator.
+ *
+ * Module:  library/hmac_drbg.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_MD_C
+ *
+ * Uncomment to enable the HMAC_DRBG random number geerator.
+ */
+#define MBEDTLS_HMAC_DRBG_C
+
+/**
+ * \def MBEDTLS_NIST_KW_C
+ *
+ * Enable the Key Wrapping mode for 128-bit block ciphers,
+ * as defined in NIST SP 800-38F. Only KW and KWP modes
+ * are supported. At the moment, only AES is approved by NIST.
+ *
+ * Module:  library/nist_kw.c
+ *
+ * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C
+ */
+//#define MBEDTLS_NIST_KW_C
+
+/**
+ * \def MBEDTLS_MD_C
+ *
+ * Enable the generic message digest layer.
+ *
+ * Module:  library/md.c
+ * Caller:
+ *
+ * Uncomment to enable generic message digest wrappers.
+ */
+#define MBEDTLS_MD_C
+
+/**
+ * \def MBEDTLS_MD2_C
+ *
+ * Enable the MD2 hash algorithm.
+ *
+ * Module:  library/md2.c
+ * Caller:
+ *
+ * Uncomment to enable support for (rare) MD2-signed X.509 certs.
+ *
+ * \warning   MD2 is considered a weak message digest and its use constitutes a
+ *            security risk. If possible, we recommend avoiding dependencies on
+ *            it, and considering stronger message digests instead.
+ *
+ */
+//#define MBEDTLS_MD2_C
+
+/**
+ * \def MBEDTLS_MD4_C
+ *
+ * Enable the MD4 hash algorithm.
+ *
+ * Module:  library/md4.c
+ * Caller:
+ *
+ * Uncomment to enable support for (rare) MD4-signed X.509 certs.
+ *
+ * \warning   MD4 is considered a weak message digest and its use constitutes a
+ *            security risk. If possible, we recommend avoiding dependencies on
+ *            it, and considering stronger message digests instead.
+ *
+ */
+//#define MBEDTLS_MD4_C
+
+/**
+ * \def MBEDTLS_MD5_C
+ *
+ * Enable the MD5 hash algorithm.
+ *
+ * Module:  library/md5.c
+ * Caller:  library/md.c
+ *          library/pem.c
+ *          library/ssl_tls.c
+ *
+ * This module is required for SSL/TLS up to version 1.1, and for TLS 1.2
+ * depending on the handshake parameters. Further, it is used for checking
+ * MD5-signed certificates, and for PBKDF1 when decrypting PEM-encoded
+ * encrypted keys.
+ *
+ * \warning   MD5 is considered a weak message digest and its use constitutes a
+ *            security risk. If possible, we recommend avoiding dependencies on
+ *            it, and considering stronger message digests instead.
+ *
+ */
+#define MBEDTLS_MD5_C
+
+/**
+ * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C
+ *
+ * Enable the buffer allocator implementation that makes use of a (stack)
+ * based buffer to 'allocate' dynamic memory. (replaces calloc() and free()
+ * calls)
+ *
+ * Module:  library/memory_buffer_alloc.c
+ *
+ * Requires: MBEDTLS_PLATFORM_C
+ *           MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS)
+ *
+ * Enable this module to enable the buffer memory allocator.
+ */
+//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
+
+/**
+ * \def MBEDTLS_NET_C
+ *
+ * Enable the TCP and UDP over IPv6/IPv4 networking routines.
+ *
+ * \note This module only works on POSIX/Unix (including Linux, BSD and OS X)
+ * and Windows. For other platforms, you'll want to disable it, and write your
+ * own networking callbacks to be passed to \c mbedtls_ssl_set_bio().
+ *
+ * \note See also our Knowledge Base article about porting to a new
+ * environment:
+ * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
+ *
+ * Module:  library/net_sockets.c
+ *
+ * This module provides networking routines.
+ */
+#define MBEDTLS_NET_C
+
+/**
+ * \def MBEDTLS_OID_C
+ *
+ * Enable the OID database.
+ *
+ * Module:  library/oid.c
+ * Caller:  library/asn1write.c
+ *          library/pkcs5.c
+ *          library/pkparse.c
+ *          library/pkwrite.c
+ *          library/rsa.c
+ *          library/x509.c
+ *          library/x509_create.c
+ *          library/x509_crl.c
+ *          library/x509_crt.c
+ *          library/x509_csr.c
+ *          library/x509write_crt.c
+ *          library/x509write_csr.c
+ *
+ * This modules translates between OIDs and internal values.
+ */
+#define MBEDTLS_OID_C
+
+/**
+ * \def MBEDTLS_PADLOCK_C
+ *
+ * Enable VIA Padlock support on x86.
+ *
+ * Module:  library/padlock.c
+ * Caller:  library/aes.c
+ *
+ * Requires: MBEDTLS_HAVE_ASM
+ *
+ * This modules adds support for the VIA PadLock on x86.
+ */
+//#define MBEDTLS_PADLOCK_C
+
+/**
+ * \def MBEDTLS_PEM_PARSE_C
+ *
+ * Enable PEM decoding / parsing.
+ *
+ * Module:  library/pem.c
+ * Caller:  library/dhm.c
+ *          library/pkparse.c
+ *          library/x509_crl.c
+ *          library/x509_crt.c
+ *          library/x509_csr.c
+ *
+ * Requires: MBEDTLS_BASE64_C
+ *
+ * This modules adds support for decoding / parsing PEM files.
+ */
+#define MBEDTLS_PEM_PARSE_C
+
+/**
+ * \def MBEDTLS_PEM_WRITE_C
+ *
+ * Enable PEM encoding / writing.
+ *
+ * Module:  library/pem.c
+ * Caller:  library/pkwrite.c
+ *          library/x509write_crt.c
+ *          library/x509write_csr.c
+ *
+ * Requires: MBEDTLS_BASE64_C
+ *
+ * This modules adds support for encoding / writing PEM files.
+ */
+#define MBEDTLS_PEM_WRITE_C
+
+/**
+ * \def MBEDTLS_PK_C
+ *
+ * Enable the generic public (asymetric) key layer.
+ *
+ * Module:  library/pk.c
+ * Caller:  library/ssl_tls.c
+ *          library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C
+ *
+ * Uncomment to enable generic public key wrappers.
+ */
+#define MBEDTLS_PK_C
+
+/**
+ * \def MBEDTLS_PK_PARSE_C
+ *
+ * Enable the generic public (asymetric) key parser.
+ *
+ * Module:  library/pkparse.c
+ * Caller:  library/x509_crt.c
+ *          library/x509_csr.c
+ *
+ * Requires: MBEDTLS_PK_C
+ *
+ * Uncomment to enable generic public key parse functions.
+ */
+#define MBEDTLS_PK_PARSE_C
+
+/**
+ * \def MBEDTLS_PK_WRITE_C
+ *
+ * Enable the generic public (asymetric) key writer.
+ *
+ * Module:  library/pkwrite.c
+ * Caller:  library/x509write.c
+ *
+ * Requires: MBEDTLS_PK_C
+ *
+ * Uncomment to enable generic public key write functions.
+ */
+#define MBEDTLS_PK_WRITE_C
+
+/**
+ * \def MBEDTLS_PKCS5_C
+ *
+ * Enable PKCS#5 functions.
+ *
+ * Module:  library/pkcs5.c
+ *
+ * Requires: MBEDTLS_MD_C
+ *
+ * This module adds support for the PKCS#5 functions.
+ */
+#define MBEDTLS_PKCS5_C
+
+/**
+ * \def MBEDTLS_PKCS11_C
+ *
+ * Enable wrapper for PKCS#11 smartcard support.
+ *
+ * Module:  library/pkcs11.c
+ * Caller:  library/pk.c
+ *
+ * Requires: MBEDTLS_PK_C
+ *
+ * This module enables SSL/TLS PKCS #11 smartcard support.
+ * Requires the presence of the PKCS#11 helper library (libpkcs11-helper)
+ */
+//#define MBEDTLS_PKCS11_C
+
+/**
+ * \def MBEDTLS_PKCS12_C
+ *
+ * Enable PKCS#12 PBE functions.
+ * Adds algorithms for parsing PKCS#8 encrypted private keys
+ *
+ * Module:  library/pkcs12.c
+ * Caller:  library/pkparse.c
+ *
+ * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C
+ * Can use:  MBEDTLS_ARC4_C
+ *
+ * This module enables PKCS#12 functions.
+ */
+#define MBEDTLS_PKCS12_C
+
+/**
+ * \def MBEDTLS_PLATFORM_C
+ *
+ * Enable the platform abstraction layer that allows you to re-assign
+ * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit().
+ *
+ * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT
+ * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned
+ * above to be specified at runtime or compile time respectively.
+ *
+ * \note This abstraction layer must be enabled on Windows (including MSYS2)
+ * as other module rely on it for a fixed snprintf implementation.
+ *
+ * Module:  library/platform.c
+ * Caller:  Most other .c files
+ *
+ * This module enables abstraction of common (libc) functions.
+ */
+#define MBEDTLS_PLATFORM_C
+
+/**
+ * \def MBEDTLS_POLY1305_C
+ *
+ * Enable the Poly1305 MAC algorithm.
+ *
+ * Module:  library/poly1305.c
+ * Caller:  library/chachapoly.c
+ */
+#define MBEDTLS_POLY1305_C
+
+/**
+ * \def MBEDTLS_RIPEMD160_C
+ *
+ * Enable the RIPEMD-160 hash algorithm.
+ *
+ * Module:  library/ripemd160.c
+ * Caller:  library/md.c
+ *
+ */
+#define MBEDTLS_RIPEMD160_C
+
+/**
+ * \def MBEDTLS_RSA_C
+ *
+ * Enable the RSA public-key cryptosystem.
+ *
+ * Module:  library/rsa.c
+ *          library/rsa_internal.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *          library/ssl_tls.c
+ *          library/x509.c
+ *
+ * This module is used by the following key exchanges:
+ *      RSA, DHE-RSA, ECDHE-RSA, RSA-PSK
+ *
+ * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C
+ */
+#define MBEDTLS_RSA_C
+
+/**
+ * \def MBEDTLS_SHA1_C
+ *
+ * Enable the SHA1 cryptographic hash algorithm.
+ *
+ * Module:  library/sha1.c
+ * Caller:  library/md.c
+ *          library/ssl_cli.c
+ *          library/ssl_srv.c
+ *          library/ssl_tls.c
+ *          library/x509write_crt.c
+ *
+ * This module is required for SSL/TLS up to version 1.1, for TLS 1.2
+ * depending on the handshake parameters, and for SHA1-signed certificates.
+ *
+ * \warning   SHA-1 is considered a weak message digest and its use constitutes
+ *            a security risk. If possible, we recommend avoiding dependencies
+ *            on it, and considering stronger message digests instead.
+ *
+ */
+#define MBEDTLS_SHA1_C
+
+/**
+ * \def MBEDTLS_SHA256_C
+ *
+ * Enable the SHA-224 and SHA-256 cryptographic hash algorithms.
+ *
+ * Module:  library/sha256.c
+ * Caller:  library/entropy.c
+ *          library/md.c
+ *          library/ssl_cli.c
+ *          library/ssl_srv.c
+ *          library/ssl_tls.c
+ *
+ * This module adds support for SHA-224 and SHA-256.
+ * This module is required for the SSL/TLS 1.2 PRF function.
+ */
+#define MBEDTLS_SHA256_C
+
+/**
+ * \def MBEDTLS_SHA512_C
+ *
+ * Enable the SHA-384 and SHA-512 cryptographic hash algorithms.
+ *
+ * Module:  library/sha512.c
+ * Caller:  library/entropy.c
+ *          library/md.c
+ *          library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * This module adds support for SHA-384 and SHA-512.
+ */
+#define MBEDTLS_SHA512_C
+
+/**
+ * \def MBEDTLS_SSL_CACHE_C
+ *
+ * Enable simple SSL cache implementation.
+ *
+ * Module:  library/ssl_cache.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_SSL_CACHE_C
+ */
+#define MBEDTLS_SSL_CACHE_C
+
+/**
+ * \def MBEDTLS_SSL_COOKIE_C
+ *
+ * Enable basic implementation of DTLS cookies for hello verification.
+ *
+ * Module:  library/ssl_cookie.c
+ * Caller:
+ */
+#define MBEDTLS_SSL_COOKIE_C
+
+/**
+ * \def MBEDTLS_SSL_TICKET_C
+ *
+ * Enable an implementation of TLS server-side callbacks for session tickets.
+ *
+ * Module:  library/ssl_ticket.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_CIPHER_C
+ */
+#define MBEDTLS_SSL_TICKET_C
+
+/**
+ * \def MBEDTLS_SSL_CLI_C
+ *
+ * Enable the SSL/TLS client code.
+ *
+ * Module:  library/ssl_cli.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_SSL_TLS_C
+ *
+ * This module is required for SSL/TLS client support.
+ */
+#define MBEDTLS_SSL_CLI_C
+
+/**
+ * \def MBEDTLS_SSL_SRV_C
+ *
+ * Enable the SSL/TLS server code.
+ *
+ * Module:  library/ssl_srv.c
+ * Caller:
+ *
+ * Requires: MBEDTLS_SSL_TLS_C
+ *
+ * This module is required for SSL/TLS server support.
+ */
+//#define MBEDTLS_SSL_SRV_C
+
+/**
+ * \def MBEDTLS_SSL_TLS_C
+ *
+ * Enable the generic SSL/TLS code.
+ *
+ * Module:  library/ssl_tls.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *
+ * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C
+ *           and at least one of the MBEDTLS_SSL_PROTO_XXX defines
+ *
+ * This module is required for SSL/TLS.
+ */
+#define MBEDTLS_SSL_TLS_C
+
+/**
+ * \def MBEDTLS_THREADING_C
+ *
+ * Enable the threading abstraction layer.
+ * By default mbed TLS assumes it is used in a non-threaded environment or that
+ * contexts are not shared between threads. If you do intend to use contexts
+ * between threads, you will need to enable this layer to prevent race
+ * conditions. See also our Knowledge Base article about threading:
+ * https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
+ *
+ * Module:  library/threading.c
+ *
+ * This allows different threading implementations (self-implemented or
+ * provided).
+ *
+ * You will have to enable either MBEDTLS_THREADING_ALT or
+ * MBEDTLS_THREADING_PTHREAD.
+ *
+ * Enable this layer to allow use of mutexes within mbed TLS
+ */
+//#define MBEDTLS_THREADING_C
+
+/**
+ * \def MBEDTLS_TIMING_C
+ *
+ * Enable the semi-portable timing interface.
+ *
+ * \note The provided implementation only works on POSIX/Unix (including Linux,
+ * BSD and OS X) and Windows. On other platforms, you can either disable that
+ * module and provide your own implementations of the callbacks needed by
+ * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide
+ * your own implementation of the whole module by setting
+ * \c MBEDTLS_TIMING_ALT in the current file.
+ *
+ * \note See also our Knowledge Base article about porting to a new
+ * environment:
+ * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
+ *
+ * Module:  library/timing.c
+ * Caller:  library/havege.c
+ *
+ * This module is used by the HAVEGE random number generator.
+ */
+#define MBEDTLS_TIMING_C
+
+/**
+ * \def MBEDTLS_VERSION_C
+ *
+ * Enable run-time version information.
+ *
+ * Module:  library/version.c
+ *
+ * This module provides run-time version information.
+ */
+#define MBEDTLS_VERSION_C
+
+/**
+ * \def MBEDTLS_X509_USE_C
+ *
+ * Enable X.509 core for using certificates.
+ *
+ * Module:  library/x509.c
+ * Caller:  library/x509_crl.c
+ *          library/x509_crt.c
+ *          library/x509_csr.c
+ *
+ * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C,
+ *           MBEDTLS_PK_PARSE_C
+ *
+ * This module is required for the X.509 parsing modules.
+ */
+#define MBEDTLS_X509_USE_C
+
+/**
+ * \def MBEDTLS_X509_CRT_PARSE_C
+ *
+ * Enable X.509 certificate parsing.
+ *
+ * Module:  library/x509_crt.c
+ * Caller:  library/ssl_cli.c
+ *          library/ssl_srv.c
+ *          library/ssl_tls.c
+ *
+ * Requires: MBEDTLS_X509_USE_C
+ *
+ * This module is required for X.509 certificate parsing.
+ */
+#define MBEDTLS_X509_CRT_PARSE_C
+
+/**
+ * \def MBEDTLS_X509_CRL_PARSE_C
+ *
+ * Enable X.509 CRL parsing.
+ *
+ * Module:  library/x509_crl.c
+ * Caller:  library/x509_crt.c
+ *
+ * Requires: MBEDTLS_X509_USE_C
+ *
+ * This module is required for X.509 CRL parsing.
+ */
+#define MBEDTLS_X509_CRL_PARSE_C
+
+/**
+ * \def MBEDTLS_X509_CSR_PARSE_C
+ *
+ * Enable X.509 Certificate Signing Request (CSR) parsing.
+ *
+ * Module:  library/x509_csr.c
+ * Caller:  library/x509_crt_write.c
+ *
+ * Requires: MBEDTLS_X509_USE_C
+ *
+ * This module is used for reading X.509 certificate request.
+ */
+#define MBEDTLS_X509_CSR_PARSE_C
+
+/**
+ * \def MBEDTLS_X509_CREATE_C
+ *
+ * Enable X.509 core for creating certificates.
+ *
+ * Module:  library/x509_create.c
+ *
+ * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C
+ *
+ * This module is the basis for creating X.509 certificates and CSRs.
+ */
+#define MBEDTLS_X509_CREATE_C
+
+/**
+ * \def MBEDTLS_X509_CRT_WRITE_C
+ *
+ * Enable creating X.509 certificates.
+ *
+ * Module:  library/x509_crt_write.c
+ *
+ * Requires: MBEDTLS_X509_CREATE_C
+ *
+ * This module is required for X.509 certificate creation.
+ */
+#define MBEDTLS_X509_CRT_WRITE_C
+
+/**
+ * \def MBEDTLS_X509_CSR_WRITE_C
+ *
+ * Enable creating X.509 Certificate Signing Requests (CSR).
+ *
+ * Module:  library/x509_csr_write.c
+ *
+ * Requires: MBEDTLS_X509_CREATE_C
+ *
+ * This module is required for X.509 certificate request writing.
+ */
+#define MBEDTLS_X509_CSR_WRITE_C
+
+/**
+ * \def MBEDTLS_XTEA_C
+ *
+ * Enable the XTEA block cipher.
+ *
+ * Module:  library/xtea.c
+ * Caller:
+ */
+#define MBEDTLS_XTEA_C
+
+/* \} name SECTION: mbed TLS modules */
+
+/**
+ * \name SECTION: Module configuration options
+ *
+ * This section allows for the setting of module specific sizes and
+ * configuration options. The default values are already present in the
+ * relevant header files and should suffice for the regular use cases.
+ *
+ * Our advice is to enable options and change their values here
+ * only if you have a good reason and know the consequences.
+ *
+ * Please check the respective header file for documentation on these
+ * parameters (to prevent duplicate documentation).
+ * \{
+ */
+
+/* MPI / BIGNUM options */
+//#define MBEDTLS_MPI_WINDOW_SIZE            6 /**< Maximum windows size used. */
+//#define MBEDTLS_MPI_MAX_SIZE            1024 /**< Maximum number of bytes for usable MPIs. */
+
+/* CTR_DRBG options */
+//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN               48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
+//#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL        10000 /**< Interval before reseed is performed by default */
+//#define MBEDTLS_CTR_DRBG_MAX_INPUT                256 /**< Maximum number of additional input bytes */
+//#define MBEDTLS_CTR_DRBG_MAX_REQUEST             1024 /**< Maximum number of requested bytes per call */
+//#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT           384 /**< Maximum size of (re)seed buffer */
+//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY              /**< Use 128-bit key for CTR_DRBG - may reduce security (see ctr_drbg.h) */
+
+/* HMAC_DRBG options */
+//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL   10000 /**< Interval before reseed is performed by default */
+//#define MBEDTLS_HMAC_DRBG_MAX_INPUT           256 /**< Maximum number of additional input bytes */
+//#define MBEDTLS_HMAC_DRBG_MAX_REQUEST        1024 /**< Maximum number of requested bytes per call */
+//#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT      384 /**< Maximum size of (re)seed buffer */
+
+/* ECP options */
+//#define MBEDTLS_ECP_MAX_BITS             521 /**< Maximum bit size of groups */
+//#define MBEDTLS_ECP_WINDOW_SIZE            6 /**< Maximum window size used */
+//#define MBEDTLS_ECP_FIXED_POINT_OPTIM      1 /**< Enable fixed-point speed-up */
+
+/* Entropy options */
+//#define MBEDTLS_ENTROPY_MAX_SOURCES                20 /**< Maximum number of sources supported */
+//#define MBEDTLS_ENTROPY_MAX_GATHER                128 /**< Maximum amount requested from entropy sources */
+//#define MBEDTLS_ENTROPY_MIN_HARDWARE               32 /**< Default minimum number of bytes required for the hardware entropy source mbedtls_hardware_poll() before entropy is released */
+
+/* Memory buffer allocator options */
+//#define MBEDTLS_MEMORY_ALIGN_MULTIPLE      4 /**< Align on multiples of this value */
+
+/* Platform options */
+//#define MBEDTLS_PLATFORM_STD_MEM_HDR   <stdlib.h> /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */
+//#define MBEDTLS_PLATFORM_STD_CALLOC        calloc /**< Default allocator to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_FREE            free /**< Default free to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_EXIT            exit /**< Default exit to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_TIME            time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
+//#define MBEDTLS_PLATFORM_STD_FPRINTF      fprintf /**< Default fprintf to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_PRINTF        printf /**< Default printf to use, can be undefined */
+/* Note: your snprintf must correclty zero-terminate the buffer! */
+//#define MBEDTLS_PLATFORM_STD_SNPRINTF    snprintf /**< Default snprintf to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS       0 /**< Default exit value to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE       1 /**< Default exit value to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ   mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE  mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
+//#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE  "seedfile" /**< Seed file to read/write with default implementation */
+
+/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */
+/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */
+//#define MBEDTLS_PLATFORM_CALLOC_MACRO        calloc /**< Default allocator macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_FREE_MACRO            free /**< Default free macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_EXIT_MACRO            exit /**< Default exit macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_TIME_MACRO            time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
+//#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO       time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
+//#define MBEDTLS_PLATFORM_FPRINTF_MACRO      fprintf /**< Default fprintf macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_PRINTF_MACRO        printf /**< Default printf macro to use, can be undefined */
+/* Note: your snprintf must correclty zero-terminate the buffer! */
+//#define MBEDTLS_PLATFORM_SNPRINTF_MACRO    snprintf /**< Default snprintf macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO   mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
+//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO  mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
+
+/* SSL Cache options */
+//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT       86400 /**< 1 day  */
+//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES      50 /**< Maximum entries in cache */
+
+/* SSL options */
+
+/** \def MBEDTLS_SSL_MAX_CONTENT_LEN
+ *
+ * Maximum fragment length in bytes.
+ *
+ * Determines the size of both the incoming and outgoing TLS I/O buffers.
+ *
+ * Uncommenting MBEDTLS_SSL_IN_CONTENT_LEN and/or MBEDTLS_SSL_OUT_CONTENT_LEN
+ * will override this length by setting maximum incoming and/or outgoing
+ * fragment length, respectively.
+ */
+//#define MBEDTLS_SSL_MAX_CONTENT_LEN             16384
+
+/** \def MBEDTLS_SSL_IN_CONTENT_LEN
+ *
+ * Maximum incoming fragment length in bytes.
+ *
+ * Uncomment to set the size of the inward TLS buffer independently of the
+ * outward buffer.
+ */
+//#define MBEDTLS_SSL_IN_CONTENT_LEN              16384
+
+/** \def MBEDTLS_SSL_OUT_CONTENT_LEN
+ *
+ * Maximum outgoing fragment length in bytes.
+ *
+ * Uncomment to set the size of the outward TLS buffer independently of the
+ * inward buffer.
+ *
+ * It is possible to save RAM by setting a smaller outward buffer, while keeping
+ * the default inward 16384 byte buffer to conform to the TLS specification.
+ *
+ * The minimum required outward buffer size is determined by the handshake
+ * protocol's usage. Handshaking will fail if the outward buffer is too small.
+ * The specific size requirement depends on the configured ciphers and any
+ * certificate data which is sent during the handshake.
+ *
+ * For absolute minimum RAM usage, it's best to enable
+ * MBEDTLS_SSL_MAX_FRAGMENT_LENGTH and reduce MBEDTLS_SSL_MAX_CONTENT_LEN. This
+ * reduces both incoming and outgoing buffer sizes. However this is only
+ * guaranteed if the other end of the connection also supports the TLS
+ * max_fragment_len extension. Otherwise the connection may fail.
+ */
+//#define MBEDTLS_SSL_OUT_CONTENT_LEN             16384
+
+/** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING
+ *
+ * Maximum number of heap-allocated bytes for the purpose of
+ * DTLS handshake message reassembly and future message buffering.
+ *
+ * This should be at least 9/8 * MBEDTLSSL_IN_CONTENT_LEN
+ * to account for a reassembled handshake message of maximum size,
+ * together with its reassembly bitmap.
+ *
+ * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default)
+ * should be sufficient for all practical situations as it allows
+ * to reassembly a large handshake message (such as a certificate)
+ * while buffering multiple smaller handshake messages.
+ *
+ */
+//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING             32768
+
+//#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME     86400 /**< Lifetime of session tickets (if enabled) */
+//#define MBEDTLS_PSK_MAX_LEN               32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */
+//#define MBEDTLS_SSL_COOKIE_TIMEOUT        60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
+
+/**
+ * Complete list of ciphersuites to use, in order of preference.
+ *
+ * \warning No dependency checking is done on that field! This option can only
+ * be used to restrict the set of available ciphersuites. It is your
+ * responsibility to make sure the needed modules are active.
+ *
+ * Use this to save a few hundred bytes of ROM (default ordering of all
+ * available ciphersuites) and a few to a few hundred bytes of RAM.
+ *
+ * The value below is only an example, not the default.
+ */
+//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
+
+/* X509 options */
+//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA   8   /**< Maximum number of intermediate CAs in a verification chain. */
+//#define MBEDTLS_X509_MAX_FILE_PATH_LEN     512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
+
+/**
+ * Allow SHA-1 in the default TLS configuration for certificate signing.
+ * Without this build-time option, SHA-1 support must be activated explicitly
+ * through mbedtls_ssl_conf_cert_profile. Turning on this option is not
+ * recommended because of it is possible to generate SHA-1 collisions, however
+ * this may be safe for legacy infrastructure where additional controls apply.
+ *
+ * \warning   SHA-1 is considered a weak message digest and its use constitutes
+ *            a security risk. If possible, we recommend avoiding dependencies
+ *            on it, and considering stronger message digests instead.
+ *
+ */
+/*+\BUG\wj\2020.2.19\调试SSL中加入SHA1否则证书验证不过*/
+#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
+/*-\BUG\wj\2020.2.19\调试SSL中加入SHA1否则证书验证不过*/
+/**
+ * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
+ * signature and ciphersuite selection. Without this build-time option, SHA-1
+ * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes.
+ * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by
+ * default. At the time of writing, there is no practical attack on the use
+ * of SHA-1 in handshake signatures, hence this option is turned on by default
+ * to preserve compatibility with existing peers, but the general
+ * warning applies nonetheless:
+ *
+ * \warning   SHA-1 is considered a weak message digest and its use constitutes
+ *            a security risk. If possible, we recommend avoiding dependencies
+ *            on it, and considering stronger message digests instead.
+ *
+ */
+#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
+
+/**
+ * Uncomment the macro to let mbed TLS use your alternate implementation of
+ * mbedtls_platform_zeroize(). This replaces the default implementation in
+ * platform_util.c.
+ *
+ * mbedtls_platform_zeroize() is a widely used function across the library to
+ * zero a block of memory. The implementation is expected to be secure in the
+ * sense that it has been written to prevent the compiler from removing calls
+ * to mbedtls_platform_zeroize() as part of redundant code elimination
+ * optimizations. However, it is difficult to guarantee that calls to
+ * mbedtls_platform_zeroize() will not be optimized by the compiler as older
+ * versions of the C language standards do not provide a secure implementation
+ * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to
+ * configure their own implementation of mbedtls_platform_zeroize(), for
+ * example by using directives specific to their compiler, features from newer
+ * C standards (e.g using memset_s() in C11) or calling a secure memset() from
+ * their system (e.g explicit_bzero() in BSD).
+ */
+//#define MBEDTLS_PLATFORM_ZEROIZE_ALT
+
+/**
+ * Uncomment the macro to let Mbed TLS use your alternate implementation of
+ * mbedtls_platform_gmtime_r(). This replaces the default implementation in
+ * platform_util.c.
+ *
+ * gmtime() is not a thread-safe function as defined in the C standard. The
+ * library will try to use safer implementations of this function, such as
+ * gmtime_r() when available. However, if Mbed TLS cannot identify the target
+ * system, the implementation of mbedtls_platform_gmtime_r() will default to
+ * using the standard gmtime(). In this case, calls from the library to
+ * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex
+ * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the
+ * library are also guarded with this mutex to avoid race conditions. However,
+ * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will
+ * unconditionally use the implementation for mbedtls_platform_gmtime_r()
+ * supplied at compile time.
+ */
+//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
+
+/* \} name SECTION: Customisation configuration options */
+
+/* Target and application specific configurations
+ *
+ * Allow user to override any previous default.
+ *
+ */
+#if defined(MBEDTLS_USER_CONFIG_FILE)
+#include MBEDTLS_USER_CONFIG_FILE
+#endif
+
+#include "check_config.h"
+
+#endif /* MBEDTLS_CONFIG_H */

+ 307 - 0
bsp/air724/sdk/components/net_inc/md5.h

@@ -0,0 +1,307 @@
+/**
+ * \file md5.h
+ *
+ * \brief MD5 message digest algorithm (hash function)
+ *
+ * \warning   MD5 is considered a weak message digest and its use constitutes a
+ *            security risk. We recommend considering stronger message
+ *            digests instead.
+ */
+/*
+ *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of mbed TLS (https://tls.mbed.org)
+ */
+#ifndef MBEDTLS_MD5_H
+#define MBEDTLS_MD5_H
+
+#if !defined(MBEDTLS_CONFIG_FILE)
+#include "config.h"
+#else
+#include MBEDTLS_CONFIG_FILE
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* MBEDTLS_ERR_MD5_HW_ACCEL_FAILED is deprecated and should not be used. */
+#define MBEDTLS_ERR_MD5_HW_ACCEL_FAILED                   -0x002F  /**< MD5 hardware accelerator failed */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(MBEDTLS_MD5_ALT)
+// Regular implementation
+//
+
+/**
+ * \brief          MD5 context structure
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+typedef struct mbedtls_md5_context
+{
+    uint32_t total[2];          /*!< number of bytes processed  */
+    uint32_t state[4];          /*!< intermediate digest state  */
+    unsigned char buffer[64];   /*!< data block being processed */
+}
+mbedtls_md5_context;
+
+#else  /* MBEDTLS_MD5_ALT */
+#include "md5_alt.h"
+#endif /* MBEDTLS_MD5_ALT */
+
+/**
+ * \brief          Initialize MD5 context
+ *
+ * \param ctx      MD5 context to be initialized
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+void mbedtls_md5_init( mbedtls_md5_context *ctx );
+
+/**
+ * \brief          Clear MD5 context
+ *
+ * \param ctx      MD5 context to be cleared
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+void mbedtls_md5_free( mbedtls_md5_context *ctx );
+
+/**
+ * \brief          Clone (the state of) an MD5 context
+ *
+ * \param dst      The destination context
+ * \param src      The context to be cloned
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+void mbedtls_md5_clone( mbedtls_md5_context *dst,
+                        const mbedtls_md5_context *src );
+
+/**
+ * \brief          MD5 context setup
+ *
+ * \param ctx      context to be initialized
+ *
+ * \return         0 if successful
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx );
+
+/**
+ * \brief          MD5 process buffer
+ *
+ * \param ctx      MD5 context
+ * \param input    buffer holding the data
+ * \param ilen     length of the input data
+ *
+ * \return         0 if successful
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_md5_update_ret( mbedtls_md5_context *ctx,
+                            const unsigned char *input,
+                            size_t ilen );
+
+/**
+ * \brief          MD5 final digest
+ *
+ * \param ctx      MD5 context
+ * \param output   MD5 checksum result
+ *
+ * \return         0 if successful
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx,
+                            unsigned char output[16] );
+
+/**
+ * \brief          MD5 process data block (internal use only)
+ *
+ * \param ctx      MD5 context
+ * \param data     buffer holding one block of data
+ *
+ * \return         0 if successful
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
+                                  const unsigned char data[64] );
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#define MBEDTLS_DEPRECATED      __attribute__((deprecated))
+#else
+#define MBEDTLS_DEPRECATED
+#endif
+/**
+ * \brief          MD5 context setup
+ *
+ * \deprecated     Superseded by mbedtls_md5_starts_ret() in 2.7.0
+ *
+ * \param ctx      context to be initialized
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_md5_starts( mbedtls_md5_context *ctx );
+
+/**
+ * \brief          MD5 process buffer
+ *
+ * \deprecated     Superseded by mbedtls_md5_update_ret() in 2.7.0
+ *
+ * \param ctx      MD5 context
+ * \param input    buffer holding the data
+ * \param ilen     length of the input data
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_md5_update( mbedtls_md5_context *ctx,
+                                            const unsigned char *input,
+                                            size_t ilen );
+
+/**
+ * \brief          MD5 final digest
+ *
+ * \deprecated     Superseded by mbedtls_md5_finish_ret() in 2.7.0
+ *
+ * \param ctx      MD5 context
+ * \param output   MD5 checksum result
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_md5_finish( mbedtls_md5_context *ctx,
+                                            unsigned char output[16] );
+
+/**
+ * \brief          MD5 process data block (internal use only)
+ *
+ * \deprecated     Superseded by mbedtls_internal_md5_process() in 2.7.0
+ *
+ * \param ctx      MD5 context
+ * \param data     buffer holding one block of data
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_md5_process( mbedtls_md5_context *ctx,
+                                             const unsigned char data[64] );
+
+#undef MBEDTLS_DEPRECATED
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
+
+/**
+ * \brief          Output = MD5( input buffer )
+ *
+ * \param input    buffer holding the data
+ * \param ilen     length of the input data
+ * \param output   MD5 checksum result
+ *
+ * \return         0 if successful
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_md5_ret( const unsigned char *input,
+                     size_t ilen,
+                     unsigned char output[16] );
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#define MBEDTLS_DEPRECATED      __attribute__((deprecated))
+#else
+#define MBEDTLS_DEPRECATED
+#endif
+/**
+ * \brief          Output = MD5( input buffer )
+ *
+ * \deprecated     Superseded by mbedtls_md5_ret() in 2.7.0
+ *
+ * \param input    buffer holding the data
+ * \param ilen     length of the input data
+ * \param output   MD5 checksum result
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_md5( const unsigned char *input,
+                                     size_t ilen,
+                                     unsigned char output[16] );
+
+#undef MBEDTLS_DEPRECATED
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
+
+/**
+ * \brief          Checkup routine
+ *
+ * \return         0 if successful, or 1 if the test failed
+ *
+ * \warning        MD5 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+int mbedtls_md5_self_test( int verbose );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* mbedtls_md5.h */

+ 325 - 0
bsp/air724/sdk/components/net_inc/sha1.h

@@ -0,0 +1,325 @@
+/**
+ * \file sha1.h
+ *
+ * \brief This file contains SHA-1 definitions and functions.
+ *
+ * The Secure Hash Algorithm 1 (SHA-1) cryptographic hash function is defined in
+ * <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
+ *
+ * \warning   SHA-1 is considered a weak message digest and its use constitutes
+ *            a security risk. We recommend considering stronger message
+ *            digests instead.
+ */
+/*
+ *  Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
+ *  SPDX-License-Identifier: Apache-2.0
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *  not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  This file is part of Mbed TLS (https://tls.mbed.org)
+ */
+#ifndef MBEDTLS_SHA1_H
+#define MBEDTLS_SHA1_H
+
+#if !defined(MBEDTLS_CONFIG_FILE)
+#include "config.h"
+#else
+#include MBEDTLS_CONFIG_FILE
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED is deprecated and should not be used. */
+#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED                  -0x0035  /**< SHA-1 hardware accelerator failed */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(MBEDTLS_SHA1_ALT)
+// Regular implementation
+//
+
+/**
+ * \brief          The SHA-1 context structure.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ */
+typedef struct mbedtls_sha1_context
+{
+    uint32_t total[2];          /*!< The number of Bytes processed.  */
+    uint32_t state[5];          /*!< The intermediate digest state.  */
+    unsigned char buffer[64];   /*!< The data block being processed. */
+}
+mbedtls_sha1_context;
+
+#else  /* MBEDTLS_SHA1_ALT */
+#include "sha1_alt.h"
+#endif /* MBEDTLS_SHA1_ALT */
+
+/**
+ * \brief          This function initializes a SHA-1 context.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context to initialize.
+ *
+ */
+void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
+
+/**
+ * \brief          This function clears a SHA-1 context.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context to clear.
+ *
+ */
+void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
+
+/**
+ * \brief          This function clones the state of a SHA-1 context.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param dst      The SHA-1 context to clone to.
+ * \param src      The SHA-1 context to clone from.
+ *
+ */
+void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
+                         const mbedtls_sha1_context *src );
+
+/**
+ * \brief          This function starts a SHA-1 checksum calculation.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context to initialize.
+ *
+ * \return         \c 0 on success.
+ *
+ */
+int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
+
+/**
+ * \brief          This function feeds an input buffer into an ongoing SHA-1
+ *                 checksum calculation.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param input    The buffer holding the input data.
+ * \param ilen     The length of the input data.
+ *
+ * \return         \c 0 on success.
+ */
+int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
+                             const unsigned char *input,
+                             size_t ilen );
+
+/**
+ * \brief          This function finishes the SHA-1 operation, and writes
+ *                 the result to the output buffer.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param output   The SHA-1 checksum result.
+ *
+ * \return         \c 0 on success.
+ */
+int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
+                             unsigned char output[20] );
+
+/**
+ * \brief          SHA-1 process data block (internal use only).
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param data     The data block being processed.
+ *
+ * \return         \c 0 on success.
+ *
+ */
+int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
+                                   const unsigned char data[64] );
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#define MBEDTLS_DEPRECATED      __attribute__((deprecated))
+#else
+#define MBEDTLS_DEPRECATED
+#endif
+/**
+ * \brief          This function starts a SHA-1 checksum calculation.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \deprecated     Superseded by mbedtls_sha1_starts_ret() in 2.7.0.
+ *
+ * \param ctx      The SHA-1 context to initialize.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
+
+/**
+ * \brief          This function feeds an input buffer into an ongoing SHA-1
+ *                 checksum calculation.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \deprecated     Superseded by mbedtls_sha1_update_ret() in 2.7.0.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param input    The buffer holding the input data.
+ * \param ilen     The length of the input data.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
+                                             const unsigned char *input,
+                                             size_t ilen );
+
+/**
+ * \brief          This function finishes the SHA-1 operation, and writes
+ *                 the result to the output buffer.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \deprecated     Superseded by mbedtls_sha1_finish_ret() in 2.7.0.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param output   The SHA-1 checksum result.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
+                                             unsigned char output[20] );
+
+/**
+ * \brief          SHA-1 process data block (internal use only).
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \deprecated     Superseded by mbedtls_internal_sha1_process() in 2.7.0.
+ *
+ * \param ctx      The SHA-1 context.
+ * \param data     The data block being processed.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
+                                              const unsigned char data[64] );
+
+#undef MBEDTLS_DEPRECATED
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
+
+/**
+ * \brief          This function calculates the SHA-1 checksum of a buffer.
+ *
+ *                 The function allocates the context, performs the
+ *                 calculation, and frees the context.
+ *
+ *                 The SHA-1 result is calculated as
+ *                 output = SHA-1(input buffer).
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \param input    The buffer holding the input data.
+ * \param ilen     The length of the input data.
+ * \param output   The SHA-1 checksum result.
+ *
+ * \return         \c 0 on success.
+ *
+ */
+int mbedtls_sha1_ret( const unsigned char *input,
+                      size_t ilen,
+                      unsigned char output[20] );
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#define MBEDTLS_DEPRECATED      __attribute__((deprecated))
+#else
+#define MBEDTLS_DEPRECATED
+#endif
+/**
+ * \brief          This function calculates the SHA-1 checksum of a buffer.
+ *
+ *                 The function allocates the context, performs the
+ *                 calculation, and frees the context.
+ *
+ *                 The SHA-1 result is calculated as
+ *                 output = SHA-1(input buffer).
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \deprecated     Superseded by mbedtls_sha1_ret() in 2.7.0
+ *
+ * \param input    The buffer holding the input data.
+ * \param ilen     The length of the input data.
+ * \param output   The SHA-1 checksum result.
+ *
+ */
+MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
+                                      size_t ilen,
+                                      unsigned char output[20] );
+
+#undef MBEDTLS_DEPRECATED
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
+
+/**
+ * \brief          The SHA-1 checkup routine.
+ *
+ * \warning        SHA-1 is considered a weak message digest and its use
+ *                 constitutes a security risk. We recommend considering
+ *                 stronger message digests instead.
+ *
+ * \return         \c 0 on success.
+ * \return         \c 1 on failure.
+ *
+ */
+int mbedtls_sha1_self_test( int verbose );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* mbedtls_sha1.h */

+ 140 - 0
bsp/air724/sdk/components/newlib/include/_ansi.h

@@ -0,0 +1,140 @@
+/* Provide support for both ANSI and non-ANSI environments.  */
+
+/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be
+   relied upon to have it's intended meaning.  Therefore we must use our own
+   concoction: _HAVE_STDC.  Always use _HAVE_STDC instead of __STDC__ in newlib
+   sources!
+
+   To get a strict ANSI C environment, define macro __STRICT_ANSI__.  This will
+   "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
+   files aren't affected).  */
+
+#ifndef	_ANSIDECL_H_
+#define	_ANSIDECL_H_
+
+#include <newlib.h>
+#include <sys/config.h>
+
+/* First try to figure out whether we really are in an ANSI C environment.  */
+/* FIXME: This probably needs some work.  Perhaps sys/config.h can be
+   prevailed upon to give us a clue.  */
+
+#ifdef __STDC__
+#define _HAVE_STDC
+#endif
+
+/*  ISO C++.  */
+
+#ifdef __cplusplus
+#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
+#ifdef _HAVE_STD_CXX
+#define _BEGIN_STD_C namespace std { extern "C" {
+#define _END_STD_C  } }
+#else
+#define _BEGIN_STD_C extern "C" {
+#define _END_STD_C  }
+#endif
+#if __GNUC_PREREQ (3, 3)
+#define _NOTHROW __attribute__ ((__nothrow__))
+#else
+#define _NOTHROW throw()
+#endif
+#endif
+#else
+#define _BEGIN_STD_C
+#define _END_STD_C
+#define _NOTHROW
+#endif
+
+#ifdef _HAVE_STDC
+#define	_PTR		void *
+#define	_AND		,
+#define	_NOARGS		void
+#define	_CONST		const
+#define	_VOLATILE	volatile
+#define	_SIGNED		signed
+#define	_DOTS		, ...
+#define _VOID void
+#ifdef __CYGWIN__
+#define	_EXFUN_NOTHROW(name, proto)	__cdecl name proto _NOTHROW
+#define	_EXFUN(name, proto)		__cdecl name proto
+#define	_EXPARM(name, proto)		(* __cdecl name) proto
+#define	_EXFNPTR(name, proto)		(__cdecl * name) proto
+#else
+#define	_EXFUN_NOTHROW(name, proto)	name proto _NOTHROW
+#define	_EXFUN(name, proto)		name proto
+#define _EXPARM(name, proto)		(* name) proto
+#define _EXFNPTR(name, proto)		(* name) proto
+#endif
+#define	_DEFUN(name, arglist, args)	name(args)
+#define	_DEFUN_VOID(name)		name(_NOARGS)
+#define _CAST_VOID (void)
+#ifndef _LONG_DOUBLE
+#define _LONG_DOUBLE long double
+#endif
+#ifndef _PARAMS
+#define _PARAMS(paramlist)		paramlist
+#endif
+#else	
+#define	_PTR		char *
+#define	_AND		;
+#define	_NOARGS
+#define	_CONST
+#define	_VOLATILE
+#define	_SIGNED
+#define	_DOTS
+#define _VOID void
+#define	_EXFUN(name, proto)		name()
+#define	_EXFUN_NOTHROW(name, proto)	name()
+#define	_DEFUN(name, arglist, args)	name arglist args;
+#define	_DEFUN_VOID(name)		name()
+#define _CAST_VOID
+#define _LONG_DOUBLE double
+#ifndef _PARAMS
+#define _PARAMS(paramlist)		()
+#endif
+#endif
+
+/* Support gcc's __attribute__ facility.  */
+
+#ifdef __GNUC__
+#define _ATTRIBUTE(attrs) __attribute__ (attrs)
+#else
+#define _ATTRIBUTE(attrs)
+#endif
+
+/*  The traditional meaning of 'extern inline' for GCC is not
+  to emit the function body unless the address is explicitly
+  taken.  However this behaviour is changing to match the C99
+  standard, which uses 'extern inline' to indicate that the
+  function body *must* be emitted.  Likewise, a function declared
+  without either 'extern' or 'static' defaults to extern linkage
+  (C99 6.2.2p5), and the compiler may choose whether to use the
+  inline version or call the extern linkage version (6.7.4p6).
+  If we are using GCC, but do not have the new behaviour, we need
+  to use extern inline; if we are using a new GCC with the
+  C99-compatible behaviour, or a non-GCC compiler (which we will
+  have to hope is C99, since there is no other way to achieve the
+  effect of omitting the function if it isn't referenced) we use
+  'static inline', which c99 defines to mean more-or-less the same
+  as the Gnu C 'extern inline'.  */
+#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
+/* We're using GCC, but without the new C99-compatible behaviour.  */
+#define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
+#else
+/* We're using GCC in C99 mode, or an unknown compiler which
+  we just have to hope obeys the C99 semantics of inline.  */
+#define _ELIDABLE_INLINE static __inline__
+#endif
+
+#if __GNUC_PREREQ (3, 1)
+#define _NOINLINE		__attribute__ ((__noinline__))
+#define _NOINLINE_STATIC	_NOINLINE static
+#else
+/* On non-GNU compilers and GCC prior to version 3.1 the compiler can't be
+   trusted not to inline if it is static. */
+#define _NOINLINE
+#define _NOINLINE_STATIC
+#endif
+
+#endif /* _ANSIDECL_H_ */

+ 12 - 0
bsp/air724/sdk/components/newlib/include/_newlib_version.h

@@ -0,0 +1,12 @@
+/* _newlib_version.h.  Generated from _newlib_version.hin by configure.  */
+/* Version macros for internal and downstream use. */
+#ifndef _NEWLIB_VERSION_H__
+#define _NEWLIB_VERSION_H__ 1
+
+#define _NEWLIB_VERSION "2.5.0"
+#define __NEWLIB__ 2
+#define __NEWLIB_MINOR__ 5
+#define __NEWLIB_PATCHLEVEL__ 0
+
+#endif /* !_NEWLIB_VERSION_H__ */
+

+ 40 - 0
bsp/air724/sdk/components/newlib/include/_syslist.h

@@ -0,0 +1,40 @@
+/* internal use only -- mapping of "system calls" for libraries that lose
+   and only provide C names, so that we end up in violation of ANSI */
+#ifndef __SYSLIST_H
+#define __SYSLIST_H
+
+#ifdef MISSING_SYSCALL_NAMES
+#define _close close
+#define _execve execve
+#define _fcntl fcntl
+#define _fork fork
+#define _fstat fstat
+#define _getpid getpid
+#define _gettimeofday gettimeofday
+#define _isatty isatty
+#define _kill kill
+#define _link link
+#define _lseek lseek
+#define _mkdir mkdir
+#define _open open
+#define _read read
+#define _sbrk sbrk
+#define _stat stat
+#define _times times
+#define _unlink unlink
+#define _wait wait
+#define _write write
+#endif /* MISSING_SYSCALL_NAMES */
+
+#if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR
+/* If the system call interface is missing opendir, readdir, and
+   closedir, there is an implementation of these functions in
+   libc/posix that is implemented using open, getdents, and close. 
+   Note, these functions are currently not in the libc/syscalls
+   directory.  */
+#define _opendir opendir
+#define _readdir readdir
+#define _closedir closedir
+#endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */
+
+#endif /* !__SYSLIST_H_ */

+ 21 - 0
bsp/air724/sdk/components/newlib/include/alloca.h

@@ -0,0 +1,21 @@
+/* libc/include/alloca.h - Allocate memory on stack */
+
+/* Written 2000 by Werner Almesberger */
+/* Rearranged for general inclusion by stdlib.h.
+   2001, Corinna Vinschen <vinschen@redhat.com> */
+
+#ifndef _NEWLIB_ALLOCA_H
+#define _NEWLIB_ALLOCA_H
+
+#include "_ansi.h"
+#include <sys/reent.h>
+
+#undef alloca
+
+#ifdef __GNUC__
+#define alloca(size) __builtin_alloca(size)
+#else
+void * _EXFUN(alloca,(size_t));
+#endif
+
+#endif

+ 69 - 0
bsp/air724/sdk/components/newlib/include/ar.h

@@ -0,0 +1,69 @@
+/*	$NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $	*/
+
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Hugh Smith at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ar.h	8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _AR_H_
+#define	_AR_H_
+
+/* Pre-4BSD archives had these magic numbers in them. */
+#define	OARMAG1	0177555
+#define	OARMAG2	0177545
+
+#define	ARMAG		"!<arch>\n"	/* ar "magic number" */
+#define	SARMAG		8		/* strlen(ARMAG); */
+
+#define	AR_EFMT1	"#1/"		/* extended format #1 */
+
+struct ar_hdr {
+	char ar_name[16];		/* name */
+	char ar_date[12];		/* modification time */
+	char ar_uid[6];			/* user id */
+	char ar_gid[6];			/* group id */
+	char ar_mode[8];		/* octal file permissions */
+	char ar_size[10];		/* size in bytes */
+#define	ARFMAG	"`\n"
+	char ar_fmag[2];		/* consistency check */
+};
+
+#endif /* !_AR_H_ */

+ 33 - 0
bsp/air724/sdk/components/newlib/include/argz.h

@@ -0,0 +1,33 @@
+/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#ifndef _ARGZ_H_
+#define _ARGZ_H_
+
+#include <errno.h>
+#include <sys/types.h>
+
+#include "_ansi.h"
+
+_BEGIN_STD_C
+
+/* The newlib implementation of these functions assumes that sizeof(char) == 1. */
+error_t argz_create (char *const argv[], char **argz, size_t *argz_len);
+error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len);
+size_t argz_count (const char *argz, size_t argz_len);
+void argz_extract (char *argz, size_t argz_len, char **argv);
+void argz_stringify (char *argz, size_t argz_len, int sep);
+error_t argz_add (char **argz, size_t *argz_len, const char *str);
+error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep);
+error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len);
+error_t argz_delete (char **argz, size_t *argz_len, char *entry);
+error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry);
+char * argz_next (char *argz, size_t argz_len, const char *entry);
+error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count);
+
+_END_STD_C
+
+#endif /* _ARGZ_H_ */

+ 52 - 0
bsp/air724/sdk/components/newlib/include/assert.h

@@ -0,0 +1,52 @@
+/*
+	assert.h
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "_ansi.h"
+
+#undef assert
+
+#ifdef NDEBUG           /* required by ANSI standard */
+# define assert(__e) ((void)0)
+#else
+__attribute__((__noreturn__)) void osiPanic(void);
+/*+\NEW\zhuwangbin\2020.4.2\Ìí¼ÓAT*exinfoÖ¸Áî*/
+extern void osiPanicInfoFuncLineSet(const char *func, int line);
+# define assert(__e) do {if(__e) {((void)0);} else {osiPanicInfoFuncLineSet(__FUNCTION__,__LINE__);osiPanic();}}while(0)
+/*-\NEW\zhuwangbin\2020.4.2\Ìí¼ÓAT*exinfoÖ¸Áî*/
+# ifndef __ASSERT_FUNC
+  /* Use g++'s demangled names in C++.  */
+#  if defined __cplusplus && defined __GNUC__
+#   define __ASSERT_FUNC __PRETTY_FUNCTION__
+
+  /* C99 requires the use of __func__.  */
+#  elif __STDC_VERSION__ >= 199901L
+#   define __ASSERT_FUNC __func__
+
+  /* Older versions of gcc don't have __func__ but can use __FUNCTION__.  */
+#  elif __GNUC__ >= 2
+#   define __ASSERT_FUNC __FUNCTION__
+
+  /* failed to detect __func__ support.  */
+#  else
+#   define __ASSERT_FUNC ((char *) 0)
+#  endif
+# endif /* !__ASSERT_FUNC */
+#endif /* !NDEBUG */
+
+void _EXFUN(__assert, (const char *, int, const char *)
+	    _ATTRIBUTE ((__noreturn__)));
+void _EXFUN(__assert_func, (const char *, int, const char *, const char *)
+	    _ATTRIBUTE ((__noreturn__)));
+
+#if __STDC_VERSION__ >= 201112L && !defined __cplusplus
+# define static_assert _Static_assert
+#endif
+
+#ifdef __cplusplus
+}
+#endif

+ 153 - 0
bsp/air724/sdk/components/newlib/include/complex.h

@@ -0,0 +1,153 @@
+/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
+
+/*
+ * Written by Matthias Drochner.
+ * Public domain.
+ */
+
+#ifndef	_COMPLEX_H
+#define	_COMPLEX_H
+
+#define complex _Complex
+#define _Complex_I 1.0fi
+#define I _Complex_I
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
+
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+/* 7.3.5.1 The ccos functions */
+double complex ccos(double complex);
+float complex ccosf(float complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+
+/* 7.3.5.1 The ctan functions */
+double complex ctan(double complex);
+float complex ctanf(float complex);
+
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+
+/* 7.3.6.3 The catanh functions */
+double complex catanh(double complex);
+float complex catanhf(float complex);
+
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
+float complex cexpf(float complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+/*#ifndef __LIBM0_SOURCE__ */
+/* avoid conflict with historical cabs(struct complex) */
+/* double cabs(double complex) __RENAME(__c99_cabs);
+   float cabsf(float complex) __RENAME(__c99_cabsf);
+   #endif
+*/
+long double cabsl(long double complex) ;
+double cabs(double complex) ;
+float cabsf(float complex) ;
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */ 
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+#if __GNU_VISIBLE
+double complex clog10(double complex);
+float complex clog10f(float complex);
+#endif
+
+#if defined(__CYGWIN__)
+long double complex cacosl(long double complex);
+long double complex ccosl(long double complex);
+long double complex csinl(long double complex);
+long double complex ctanl(long double complex);
+long double complex cacoshl(long double complex);
+long double complex casinhl(long double complex);
+long double complex catanhl(long double complex);
+long double complex ccoshl(long double complex);
+long double complex csinhl(long double complex);
+long double complex ctanhl(long double complex);
+long double complex cexpl(long double complex);
+long double complex cpowl(long double complex, long double complex);
+long double complex conjl(long double complex);
+long double complex cprojl(long double complex);
+#if __GNU_VISIBLE
+long double complex clog10l(long double complex);
+#endif
+#endif /* __CYGWIN__ */
+
+__END_DECLS
+
+#endif	/* ! _COMPLEX_H */

+ 30 - 0
bsp/air724/sdk/components/newlib/include/cpio.h

@@ -0,0 +1,30 @@
+/* POSIX.1 symbolic constants for c_mode field of cpio archive format */
+
+#ifndef _CPIO_H
+#define _CPIO_H
+
+#define	C_IRUSR		0000400	/* Read by owner */
+#define	C_IWUSR		0000200	/* Write by owner */
+#define	C_IXUSR		0000100	/* Execute by owner */
+#define	C_IRGRP		0000040	/* Read by group */
+#define	C_IWGRP		0000020	/* Write by group */
+#define	C_IXGRP		0000010	/* Execute by group */
+#define	C_IROTH		0000004	/* Read by others */
+#define	C_IWOTH		0000002	/* Write by others */
+#define	C_IXOTH		0000001	/* Execute by others */
+#define	C_ISUID		0004000	/* Set user ID */
+#define	C_ISGID		0002000	/* Set group ID */
+#define	C_ISVTX		0001000	/* On directories, restricted deletion flag */
+
+#define	C_ISDIR		0040000	/* Directory */
+#define	C_ISFIFO	0010000	/* FIFO */
+#define	C_ISREG		0100000	/* Regular file */
+#define	C_ISBLK		0060000	/* Block special */
+#define	C_ISCHR		0020000	/* Character special */
+#define	C_ISCTG		0110000	/* Reserved */
+#define	C_ISLNK		0120000	/* Symbolic link */
+#define	C_ISSOCK	0140000	/* Socket */
+
+#define	MAGIC		"070707"
+
+#endif /* _CPIO_H */

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio