Browse Source

update:luavm消耗较多的情况下,打印提醒一下

alienwalker 3 năm trước cách đây
mục cha
commit
8e5c52da75
3 tập tin đã thay đổi với 19 bổ sung2 xóa
  1. 10 0
      luat/modules/luat_lib_rtos.c
  2. 6 1
      luat/modules/luat_lib_spi.c
  3. 3 1
      luat/modules/luat_lib_uart.c

+ 10 - 0
luat/modules/luat_lib_rtos.c

@@ -24,6 +24,16 @@ rtos.receive(-1)
 static int l_rtos_receive(lua_State *L) {
     rtos_msg_t msg;
     int re;
+#ifdef LUAT_USE_MEMORY_OPTIMIZATION_CODE_MMAP
+    size_t total = 0;
+    size_t used = 0;
+    size_t max_used = 0;
+    luat_meminfo_luavm(&total, &used, &max_used);
+    if ( (used * 100) >= (total * 90))
+    {
+    	LLOGD("luavm use very much ram! used %d, total %d",used, total);
+    }
+#endif
     re = luat_msgbus_get(&msg, luaL_checkinteger(L, 1));
     if (!re) {
         //LLOGD("rtos_msg got, invoke it handler=%08X", msg.handler);

+ 6 - 1
luat/modules/luat_lib_spi.c

@@ -756,12 +756,17 @@ static const rotable_Reg_t reg_spi[] =
     { "full",              ROREG_INT(1)},
     //@const half number 半双工
     { "half",              ROREG_INT(0)},
-
+	//@const SPI_0 number SPI0
     { "SPI_0",             ROREG_INT(0)},
+	//@const SPI_1 number SPI1
     { "SPI_1",             ROREG_INT(1)},
+	//@const SPI_2 number SPI2
     { "SPI_2",             ROREG_INT(2)},
+	//@const SPI_3 number SPI3
     { "SPI_3",             ROREG_INT(3)},
+	//@const SPI_4 number SPI4
     { "SPI_4",             ROREG_INT(4)},
+	//@const HSPI_0 number 高速SPI0,目前105专用
 	{ "HSPI_0",             ROREG_INT(5)},
 	{ NULL,                ROREG_INT(0) }
 };

+ 3 - 1
luat/modules/luat_lib_uart.c

@@ -438,9 +438,11 @@ static const rotable_Reg_t reg_uart[] =
 #ifdef LUAT_FORCE_WIN32
     { "list",       ROREG_FUNC(l_uart_list)},
 #endif
-    //校验位
+	//@const Odd number 奇校验,大小写兼容性
     { "Odd",        ROREG_INT(LUAT_PARITY_ODD)},
+	//@const Even number 偶校验,大小写兼容性
     { "Even",       ROREG_INT(LUAT_PARITY_EVEN)},
+	//@const None number 无校验,大小写兼容性
     { "None",       ROREG_INT(LUAT_PARITY_NONE)},
     //@const ODD number 奇校验
     { "ODD",        ROREG_INT(LUAT_PARITY_ODD)},