From 4f20921e601f3c90578013824041d364d3be25b6 Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 28 Nov 2020 16:58:45 +0800 Subject: [PATCH] [smart] Disable sys log in default --- bsp/qemu-vexpress-a9/drivers/automac.h | 15 --------------- components/lwp/lwp_syscall.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 bsp/qemu-vexpress-a9/drivers/automac.h diff --git a/bsp/qemu-vexpress-a9/drivers/automac.h b/bsp/qemu-vexpress-a9/drivers/automac.h deleted file mode 100644 index 5f08b79a41..0000000000 --- a/bsp/qemu-vexpress-a9/drivers/automac.h +++ /dev/null @@ -1,15 +0,0 @@ - -#ifndef __MAC_AUTO_GENERATE_H__ -#define __MAC_AUTO_GENERATE_H__ - -/* Automatically generated file; DO NOT EDIT. */ -/* mac configure file for RT-Thread qemu */ - -#define AUTOMAC0 0x52 -#define AUTOMAC1 0x54 -#define AUTOMAC2 0x00 -#define AUTOMAC3 0x28 -#define AUTOMAC4 0xae -#define AUTOMAC5 0xeb - -#endif diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c index 481d510017..fb89fce9ce 100644 --- a/components/lwp/lwp_syscall.c +++ b/components/lwp/lwp_syscall.c @@ -813,11 +813,28 @@ void sys_exit_critical(void) } /* syscall: "sys_log" ret: "int" args: "const char*" "size" */ +static int __sys_log_enable = 0; +static int sys_log_enable(int argc, char** argv) +{ + if (argc == 1) + { + rt_kprintf("sys_log = %d\n", __sys_log_enable); + return 0; + } + else + { + __sys_log_enable = atoi(argv[1]); + } + + return 0; +} +MSH_CMD_EXPORT_ALIAS(sys_log_enable, sys_log, sys_log 1(enable)/0(disable)); + int sys_log(const char* log, int size) { rt_device_t console = rt_console_get_device(); - if (console) rt_device_write(console, -1, log, size); + if (console && __sys_log_enable) rt_device_write(console, -1, log, size); return 0; } -- Gitee