Просмотр исходного кода

add: 添加usbapp库,添加授权声明,添加zlib关联

Wendal Chen 4 лет назад
Родитель
Сommit
6bc72e5ab6
32 измененных файлов с 779 добавлено и 19 удалено
  1. 23 0
      application/include/app_interface.h
  2. 21 0
      application/include/luat_conf_bsp.h
  3. 21 0
      application/src/luat_adc_air105.c
  4. 24 1
      application/src/luat_base_air105.c
  5. 21 0
      application/src/luat_camera_air105.c
  6. 21 0
      application/src/luat_crypto_air105.c
  7. 21 0
      application/src/luat_dac_air105.c
  8. 21 0
      application/src/luat_fs_air105.c
  9. 21 0
      application/src/luat_gpio_air105.c
  10. 21 0
      application/src/luat_i2c_air105.c
  11. 21 0
      application/src/luat_keyboard_air105.c
  12. 147 0
      application/src/luat_lib_usbapp.c
  13. 21 0
      application/src/luat_log_air105.c
  14. 21 0
      application/src/luat_malloc_air105.c
  15. 21 0
      application/src/luat_mcu_air105.c
  16. 21 0
      application/src/luat_msgbus_air105.c
  17. 21 0
      application/src/luat_otp_air105.c
  18. 21 0
      application/src/luat_pin_air105.c
  19. 20 0
      application/src/luat_pwm_air105.c
  20. 21 0
      application/src/luat_rtc_air105.c
  21. 21 0
      application/src/luat_sfd_onchip_air105.c
  22. 21 0
      application/src/luat_shell_air105.c
  23. 21 0
      application/src/luat_spi_air105.c
  24. 21 0
      application/src/luat_timer_air105.c
  25. 23 2
      application/src/luat_uart_air105.c
  26. 53 0
      application/src/luat_usb_app_air105.c
  27. 21 0
      application/src/luat_wdt_air105.c
  28. 10 11
      bsp/common/src/core_service.c
  29. 2 1
      bsp/usb/src/core_usb_stack.c
  30. 1 1
      project/air105/build_debug.bat
  31. 1 1
      project/air105/build_release.bat
  32. 34 2
      xmake.lua

+ 23 - 0
application/include/app_interface.h

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef __APP_INTERFACE_H__
 #define __APP_INTERFACE_H__
 #include "global_config.h"
@@ -20,5 +41,7 @@
 #include "core_rng.h"
 #include "core_task.h"
 #include "lfs.h"
+#include "usb_driver.h"
+#include "usb_hid.h"
 void FileSystem_Init(void);
 #endif

+ 21 - 0
application/include/luat_conf_bsp.h

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #ifndef LUAT_CONF_BSP
 #define LUAT_CONF_BSP

+ 21 - 0
application/src/luat_adc_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_adc.h"
 #include "luat_base.h"
 

+ 24 - 1
application/src/luat_base_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_msgbus.h"
 #include "luat_fs.h"
@@ -21,6 +42,7 @@ void lv_split_jpeg_init(void);
 #endif
 
 LUAMOD_API int luaopen_gtfont( lua_State *L );
+LUAMOD_API int luaopen_usbapp( lua_State *L );
 
 static const luaL_Reg loadedlibs[] = {
   {"_G", luaopen_base}, // _G
@@ -118,7 +140,7 @@ static const luaL_Reg loadedlibs[] = {
 #ifdef LUAT_USE_FATFS
   {"fatfs", luaopen_fatfs},           // 处理GNSS定位数据
 #endif
-#ifdef LUAT_USE_GNSS
+#ifdef LUAT_USE_LIBGNSS
   {"libgnss", luaopen_libgnss},           // 处理GNSS定位数据
 #endif
 #ifdef LUAT_USE_FS
@@ -169,6 +191,7 @@ static const luaL_Reg loadedlibs[] = {
 #ifdef LUAT_USE_ZLIB
   {"zlib", luaopen_zlib},
 #endif
+  {"usbapp", luaopen_usbapp},
   {NULL, NULL}
 };
 

+ 21 - 0
application/src/luat_camera_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "app_interface.h"
 #include "luat_base.h"
 

+ 21 - 0
application/src/luat_crypto_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_base.h"
 #include "luat_crypto.h"

+ 21 - 0
application/src/luat_dac_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_dac.h"
 #include "app_interface.h"

+ 21 - 0
application/src/luat_fs_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "app_interface.h"
 #include "luat_base.h"
 #include "luat_fs.h"

+ 21 - 0
application/src/luat_gpio_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_malloc.h"
 #include "luat_msgbus.h"

+ 21 - 0
application/src/luat_i2c_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_base.h"
 #include "luat_i2c.h"

+ 21 - 0
application/src/luat_keyboard_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_keyboard.h"
 

+ 147 - 0
application/src/luat_lib_usbapp.c

@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+/*
+@module  usbapp
+@summary USB功能操作
+@version 1.0
+@date    2022.01.17
+*/
+#include "luat_base.h"
+#include "luat_msgbus.h"
+#include "app_interface.h"
+
+static int l_usb_app_vhid_cb(lua_State *L, void* ptr) {
+    rtos_msg_t* msg = (rtos_msg_t*)lua_topointer(L, -1);
+    lua_getglobal(L, "sys_pub");
+    if (lua_isfunction(L, -1)) {
+        lua_pushstring(L, "USB_HID_INC");
+        lua_pushinteger(L, msg->arg1);
+        lua_call(L, 2, 0);
+    }
+    return 0;
+}
+
+int32_t luat_usb_app_vhid_cb(void *pData, void *pParam)
+{
+	//在这里把底层的HID消息转换为LUAT消息并上传,同时删除本注释
+    rtos_msg_t msg;
+    msg.handler = l_usb_app_vhid_cb;
+	switch((uint32_t)pParam)
+	{
+	case USB_HID_NOT_READY:
+	case USB_HID_READY:
+	case USB_HID_SEND_DONE:
+	    msg.arg1 = (uint32_t)pParam;
+        luat_msgbus_put(&msg, 0);
+		break;
+	}
+    return 0;
+}
+
+/*
+启动USB设备
+@api usbapp.start(id)
+@int 设备id,默认为0
+@return bool 成功返回true,否则返回false
+@usage
+-- 启动USB
+usbapp.start(0)
+*/
+static int l_usb_start(lua_State* L) {
+    luat_usb_app_start(USB_ID0);
+    lua_pushboolean(L, 1);
+    return 1;
+}
+
+/*
+关闭USB设备
+@api usbapp.stop(id)
+@int 设备id,默认为0
+@return bool 成功返回true,否则返回false
+@usage
+-- 关闭USB
+usbapp.stop(0)
+*/
+static int l_usb_stop(lua_State* L) {
+    luat_usb_app_stop(USB_ID0);
+    lua_pushboolean(L, 1);
+    return 1;
+}
+
+/*
+USB HID设备上传数据
+@api usbapp.vhid_upload(id, data)
+@int 设备id,默认为0
+@string 数据. 注意, HID的可用字符是有限制的, 基本上只有可见字符是支持的, 不支持的字符会替换为空格.
+@return bool 成功返回true,否则返回false
+@usage
+-- HID上传数据
+usbapp.vhid_upload(0, "1234") -- usb hid会模拟敲出1234
+*/
+static int l_usb_vhid_upload(lua_State* L) {
+    size_t len;
+    const char* data = luaL_checklstring(L, 2, &len);
+    if (len > 0) {
+        luat_usb_app_vhid_upload(USB_ID0, data, len);
+        lua_pushboolean(L, 1);
+    }
+    else {
+        lua_pushboolean(L, 0);
+    }
+    return 1;
+}
+
+/*
+USB HID设备取消上传数据
+@api usbapp.vhid_cancel_upload(id)
+@int 设备id,默认为0
+@return nil 无返回值
+@usage
+-- 取消上传数据,通常不需要
+usbapp.vhid_cancel_upload(0)
+*/
+static int l_usb_vhid_cancel_upload(lua_State* L) {
+    luat_usb_app_vhid_cancel_upload(USB_ID0);
+    return 0;
+}
+
+
+#include "rotable.h"
+static const rotable_Reg reg_usbapp[] =
+{
+    { "start",              l_usb_start,                0},
+    { "start",              l_usb_stop,                 0},
+    { "vhid_upload",        l_usb_vhid_upload,          0},
+    { "vhid_cancel_upload", l_usb_vhid_cancel_upload,   0},
+
+    { "HID_NOT_READY",      NULL,   USB_HID_NOT_READY},
+    { "HID_READY",          NULL,   USB_HID_READY},
+    { "HID_SEND_DONE",      NULL,   USB_HID_SEND_DONE},
+	{ NULL,        NULL,   0}
+};
+
+LUAMOD_API int luaopen_usbapp( lua_State *L ) {
+    luat_newlib(L, reg_usbapp);
+    return 1;
+}

+ 21 - 0
application/src/luat_log_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_log.h"
 #include "luat_cmux.h"

+ 21 - 0
application/src/luat_malloc_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 // 这个文件包含 系统heap和lua heap的默认实现
 

+ 21 - 0
application/src/luat_mcu_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_mcu.h"
 

+ 21 - 0
application/src/luat_msgbus_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_msgbus.h"
 

+ 21 - 0
application/src/luat_otp_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_otp.h"
 

+ 21 - 0
application/src/luat_pin_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "app_interface.h"
 #include "luat_base.h"
 

+ 20 - 0
application/src/luat_pwm_air105.c

@@ -1,3 +1,23 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
 
 #include "luat_base.h"
 #include "luat_pwm.h"

+ 21 - 0
application/src/luat_rtc_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_rtc.h"
 #include "app_interface.h"

+ 21 - 0
application/src/luat_sfd_onchip_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_sfd.h"
 

+ 21 - 0
application/src/luat_shell_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_base.h"
 #include "luat_shell.h"

+ 21 - 0
application/src/luat_spi_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 
 #include "luat_base.h"

+ 21 - 0
application/src/luat_timer_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_base.h"
 #include "luat_malloc.h"

+ 23 - 2
application/src/luat_uart_air105.c

@@ -1,10 +1,31 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "luat_base.h"
 #include "luat_malloc.h"
 #include "luat_msgbus.h"
 #include "luat_uart.h"
 
-#include "core_uart.h"
-#include "platform_define.h"
+#include "app_interface.h"
+
 
 #define LUAT_LOG_TAG "luat.uart"
 #include "luat_log.h"

+ 53 - 0
application/src/luat_usb_app_air105.c

@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "luat_base.h"
+#include "luat_malloc.h"
+#include "luat_msgbus.h"
+#include "app_interface.h"
+
+#define LUAT_LOG_TAG "luat.usbapp"
+#include "luat_log.h"
+
+int32_t luat_usb_app_vhid_cb(void *pData, void *pParam);
+
+//打开luatos内置usb device config,实现虚拟MSC,HID和串口的复合设备功能,串口收发见luat_uart
+void luat_usb_app_start(uint8_t usb_id)
+{
+	Core_USBDefaultDeviceStart(usb_id);
+	Core_VHIDInit(usb_id, luat_usb_app_vhid_cb);
+}
+
+void luat_usb_app_stop(uint8_t usb_id)
+{
+	USB_StackStop(usb_id);
+	USB_StackClearSetup(usb_id);
+}
+
+void luat_usb_app_vhid_upload(uint8_t usb_id, uint8_t *key_data, uint16_t len)
+{
+	Core_VHIDUploadData(usb_id, key_data, len);
+}
+
+void luat_usb_app_vhid_cancel_upload(uint8_t usb_id)
+{
+	Core_VHIDUploadStop(usb_id);
+}

+ 21 - 0
application/src/luat_wdt_air105.c

@@ -1,3 +1,24 @@
+/*
+ * Copyright (c) 2022 OpenLuat & AirM2M
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 
 #include "luat_base.h"
 #include "luat_wdt.h"

+ 10 - 11
bsp/common/src/core_service.c

@@ -113,7 +113,6 @@ typedef struct
 	uint64_t LCDDrawDoneByte;
 	uint32_t InitAllocMem;
 	uint32_t LastAllocMem;
-	uint8_t IsUSBOpen;
 	uint8_t SleepEnable;
 
 }Service_CtrlStruct;
@@ -869,16 +868,16 @@ void Core_VHIDInit(uint8_t USB_ID, CBFuncEx_t CB)
 void Core_VUartInit(uint8_t UartID, uint32_t BaudRate, uint8_t IsRxCacheEnable, uint8_t DataBits, uint8_t Parity, uint8_t StopBits, CBFuncEx_t CB)
 {
 	Virtual_UartCtrlStruct *pVUart = &prvLuatOS_VirtualUart[UartID];
-	switch(UartID)
-	{
-	case VIRTUAL_UART0:
-		if (!prvService.IsUSBOpen)
-		{
-			Core_USBDefaultDeviceStart(USB_ID0);
-			prvService.IsUSBOpen = 1;
-		}
-		break;
-	}
+//	switch(UartID)
+//	{
+//	case VIRTUAL_UART0:
+//		if (!prvService.IsUSBOpen)
+//		{
+//			Core_USBDefaultDeviceStart(USB_ID0);
+//			prvService.IsUSBOpen = 1;
+//		}
+//		break;
+//	}
 	if (CB)
 	{
 		pVUart->CB = CB;

+ 2 - 1
bsp/usb/src/core_usb_stack.c

@@ -311,10 +311,11 @@ void USB_StackClearSetup(uint8_t USB_ID)
 	for(i = 0; i < USB_EP_MAX; i++)
 	{
 		prvUSB_ResetEpCtrl(USB_ID, i);
-		prvUSBCore[USB_ID].pEpCtrl[i].CB = prvUSB_StackDummyEpCB;
+//		prvUSBCore[USB_ID].pEpCtrl[i].CB = prvUSB_StackDummyEpCB;
 	}
 	prvUSBCore[USB_ID].Ep0Stage = USB_EP0_STAGE_SETUP;
 	prvUSBCore[USB_ID].pEpCtrl[0].ForceZeroPacket = 1;
+	prvUSBCore[USB_ID].Setup.CB = prvUSB_StackDummyStateCB;
 }
 
 void USB_StackDeviceAfterDisconnect(uint8_t USB_ID)

+ 1 - 1
project/air105/build_debug.bat

@@ -13,7 +13,7 @@ if "%1" == "" (
 ) else (
     set make_target=%1
 )
-set CROSS_TOOL_WIN32_PATH=D:\gcc-arm-none-eabi-10.3-2021.10
+set CROSS_TOOL_WIN32_PATH=D:\gcc-arm-none-eabi-for-mcu
 set CROSS_TOOL_PATH=%CROSS_TOOL_WIN32_PATH:\=/%
 
 set PATH=%CROSS_TOOL_WIN32_PATH%\bin;%PATH%

+ 1 - 1
project/air105/build_release.bat

@@ -9,7 +9,7 @@ if !line!==2 set A=%%a
 )
 set /a CPU_LINE=%A%+%A%
 
-set CROSS_TOOL_WIN32_PATH=D:\gcc-arm-none-eabi-10.3-2021.10
+set CROSS_TOOL_WIN32_PATH=D:\gcc-arm-none-eabi-for-mcu
 set CROSS_TOOL_PATH=%CROSS_TOOL_WIN32_PATH:\=/%
 set PATH=%CROSS_TOOL_WIN32_PATH%\bin;%PATH%
 REM debug属性标记

+ 34 - 2
xmake.lua

@@ -93,6 +93,7 @@ target("lvgl")
 
     add_includedirs("application/include")
     add_includedirs("bsp/air105/include",{public = true})
+    add_includedirs("bsp/usb/include",{public = true})
     --add_includedirs("bsp/common",{public = true})
 	add_includedirs("bsp/common/include",{public = true})
     add_includedirs("bsp/cmsis/include",{public = true})
@@ -110,6 +111,34 @@ target("lvgl")
     set_targetdir("$(buildir)/lib")
 target_end()
 
+---//-----------------------------
+-- target("tflm")
+--     tfroot = "Third_Party/tflm-cmsis/"
+--     set_kind("static")
+--     set_languages("c99", "c++11")
+
+--     add_defines("CMSIS_NN=1")
+
+--     add_files(tfroot .. "tensorflow/**.c")
+--     add_files(tfroot .. "tensorflow/**.cc")
+--     add_files(tfroot .. "apps/person_detection/**.cc")
+    
+--     add_files(tfroot .. "third_party/**.c")
+
+--     add_includedirs(tfroot .. ".", 
+--     tfroot .. "third_party/ruy", 
+--     tfroot .. "third_party/kissfft", 
+--     tfroot .. "third_party/gemmlowp", 
+--     tfroot .. "third_party/flatbuffers/include",
+--     tfroot .. "third_party/cmsis/CMSIS/Core/Include",
+--     tfroot .. "third_party/cmsis/CMSIS/DSP/Include",
+--     tfroot .. "third_party/cmsis/CMSIS/NN/Include",
+--     tfroot .. "third_party/cmsis"
+--                         )
+
+-- target_end()
+---//-----------------------------
+
 target("app.elf")
     -- set kind
     set_kind("binary")
@@ -122,6 +151,8 @@ target("app.elf")
         local LVGL_CONF = conf_data:find("// #define LUAT_USE_LVGL\n")
         if LVGL_CONF == nil then target:add("deps", "lvgl") end
     end)
+
+    -- add_deps("tflm")
     
     -- add deps
     add_files("Third_Party/cm_backtrace/*.c",{public = true})
@@ -157,6 +188,7 @@ target("app.elf")
     add_includedirs("os/FreeRTOS_v10/include",{public = true})
 
     add_includedirs("bsp/cmsis/include",{public = true})
+    add_includedirs("bsp/usb/include",{public = true})
     add_includedirs("bsp/air105/chip/include",{public = true})
     add_includedirs("bsp/air105/include",{public = true})
 
@@ -218,8 +250,8 @@ target("app.elf")
     add_files(luatos.."components/mbedtls/library/*.c")
     add_includedirs(luatos.."components/mbedtls/include")
 
-    add_files(luatos.."luat/packages/zlib/*.c")
-    add_includedirs(luatos.."luat/packages/zlib")
+    add_files(luatos.."components/zlib/*.c")
+    add_includedirs(luatos.."components/zlib")
 
     add_files(luatos.."components/camera/*.c")
     add_includedirs(luatos.."components/camera")