Browse Source

change: 拆解cmux和shell为单独的component

Wendal Chen 4 years ago
parent
commit
78e42392d9
2 changed files with 9 additions and 4 deletions
  1. 3 4
      application/src/luat_log_air105.c
  2. 6 0
      xmake.lua

+ 3 - 4
application/src/luat_log_air105.c

@@ -25,14 +25,13 @@
 #include "luat_conf_bsp.h"
 #include "app_interface.h"
 
-extern uint8_t cmux_state;
-extern uint8_t cmux_log_state;
+extern luat_cmux_t cmux_ctx;
 
 void DBG_DirectOut(void *Data, uint32_t Len);
 
 void luat_nprint(char *s, size_t l) {
 #ifdef LUAT_USE_SHELL
-    if (cmux_state == 1 && cmux_log_state ==1){
+    if (cmux_ctx.state == 1 && cmux_ctx.log_state ==1){
         luat_cmux_write(LUAT_CMUX_CH_LOG,  CMUX_FRAME_UIH & ~ CMUX_CONTROL_PF,s, l);
     }else
 #endif
@@ -41,7 +40,7 @@ void luat_nprint(char *s, size_t l) {
 
 void luat_log_write(char *s, size_t l) {
 #ifdef LUAT_USE_SHELL
-    if (cmux_state == 1 && cmux_log_state ==1){
+    if (cmux_ctx.state == 1 && cmux_ctx.log_state ==1){
         luat_cmux_write(LUAT_CMUX_CH_LOG,  CMUX_FRAME_UIH & ~ CMUX_CONTROL_PF,s, l);
     }else
 #endif

+ 6 - 0
xmake.lua

@@ -326,6 +326,12 @@ if with_luatos then
 
     add_files(luatos.."components/io_queue/*.c")
     add_includedirs(luatos.."components/io_queue")
+
+    -- shell & cmux
+    add_includedirs(luatos.."components/shell",{public = true})
+    add_includedirs(luatos.."components/cmux",{public = true})
+    add_files(luatos.."components/shell/*.c")
+    add_files(luatos.."components/cmux/*.c")
 else
 
     add_files("Third_Party/vsprintf/*.c",{public = true})