From cd9d8bbfa94c528be0e58c027e7eea4516e59927 Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Fri, 13 Oct 2023 16:54:42 +0800 Subject: [PATCH 1/5] test case update follow the regualtor framework Signed-off-by: dulibo1 --- testing/drivertest/drivertest_regulator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/drivertest/drivertest_regulator.c b/testing/drivertest/drivertest_regulator.c index 4310fdf4877..212c6805acc 100644 --- a/testing/drivertest/drivertest_regulator.c +++ b/testing/drivertest/drivertest_regulator.c @@ -446,10 +446,8 @@ static void test_regulator_supply_4(FAR void **state) &g_fake_regulator); assert_false(NULL == g_fake_regulator.rdev); test = regulator_get(REGULATOR_ID); - assert_false(NULL == test); + assert_true(NULL == test); g_fake_regulator_supply.state = 0; - ret = regulator_enable(test); - assert_true(ret < 0); g_fake_regulator_supply.rdev = regulator_register( &g_fake_regulator_supply_desc, &g_fake_regulator_ops, @@ -457,7 +455,8 @@ static void test_regulator_supply_4(FAR void **state) assert_false(NULL == g_fake_regulator_supply.rdev); assert_int_equal(g_fake_regulator_supply.state, 0); assert_int_equal(g_fake_regulator.state, 0); - + test = regulator_get(REGULATOR_ID); + assert_false(NULL == test); while (cnt--) { ret = regulator_enable(test); @@ -499,6 +498,7 @@ static void test_regulator_mode(FAR void **state) int ret = 0; g_fake_regulator.lpmode = 0; + g_fake_regulator_desc.supply_name = NULL; g_fake_regulator.rdev = regulator_register(&g_fake_regulator_desc, &g_fake_regulator_ops, &g_fake_regulator); From 46768fc85d328a7220d983680c0ec224dd7dc275 Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Wed, 8 Nov 2023 11:14:54 +0800 Subject: [PATCH 2/5] gpio:add example for wakeup gpio type Signed-off-by: dulibo1 --- examples/gpio/gpio_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/gpio/gpio_main.c b/examples/gpio/gpio_main.c index 9793fbba40b..c097a265f3e 100644 --- a/examples/gpio/gpio_main.c +++ b/examples/gpio/gpio_main.c @@ -67,6 +67,12 @@ static void show_usage(FAR const char *progname) fprintf(stderr, "\t 8: GPIO_INTERRUPT_RISING_PIN\n"); fprintf(stderr, "\t 9: GPIO_INTERRUPT_FALLING_PIN\n"); fprintf(stderr, "\t10: GPIO_INTERRUPT_BOTH_PIN\n"); + fprintf(stderr, "\t11: GPIO_INTERRUPT_PIN_WAKEUP\n"); + fprintf(stderr, "\t12: GPIO_INTERRUPT_HIGH_PIN_WAKEUP\n"); + fprintf(stderr, "\t13: GPIO_INTERRUPT_LOW_PIN_WAKEUP\n"); + fprintf(stderr, "\t14: GPIO_INTERRUPT_RISING_PIN_WAKEUP\n"); + fprintf(stderr, "\t15: GPIO_INTERRUPT_FALLING_PIN_WAKEUP\n"); + fprintf(stderr, "\t16: GPIO_INTERRUPT_BOTH_PIN_WAKEUP\n"); } /**************************************************************************** @@ -308,6 +314,12 @@ int main(int argc, FAR char *argv[]) case GPIO_INTERRUPT_RISING_PIN: case GPIO_INTERRUPT_FALLING_PIN: case GPIO_INTERRUPT_BOTH_PIN: + case GPIO_INTERRUPT_PIN_WAKEUP: + case GPIO_INTERRUPT_HIGH_PIN_WAKEUP: + case GPIO_INTERRUPT_LOW_PIN_WAKEUP: + case GPIO_INTERRUPT_RISING_PIN_WAKEUP: + case GPIO_INTERRUPT_FALLING_PIN_WAKEUP: + case GPIO_INTERRUPT_BOTH_PIN_WAKEUP: { printf(" Interrupt pin: Value=%u\n", invalue); From b295d5de91e65bc885518a1b11ea64c3a5158deb Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Tue, 7 Nov 2023 09:53:22 +0800 Subject: [PATCH 3/5] batterydump:move to system dir Signed-off-by: dulibo1 --- {testing => system}/batterydump/Kconfig | 12 ++++++------ {testing => system}/batterydump/Make.defs | 6 +++--- {testing => system}/batterydump/Makefile | 10 +++++----- {testing => system}/batterydump/batterydump.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) rename {testing => system}/batterydump/Kconfig (70%) rename {testing => system}/batterydump/Make.defs (88%) rename {testing => system}/batterydump/Makefile (81%) rename {testing => system}/batterydump/batterydump.c (99%) diff --git a/testing/batterydump/Kconfig b/system/batterydump/Kconfig similarity index 70% rename from testing/batterydump/Kconfig rename to system/batterydump/Kconfig index 61d9b16e758..1e8e87ca20c 100644 --- a/testing/batterydump/Kconfig +++ b/system/batterydump/Kconfig @@ -3,26 +3,26 @@ # see the file kconfig-language.txt in the NuttX tools repository. # # -config TESTING_BATTERYDUMP - tristate "Battery dump for test" +config SYSTEM_BATTERYDUMP + tristate "Battery dump system tool" default n ---help--- Enable the battery dump -if TESTING_BATTERYDUMP +if SYSTEM_BATTERYDUMP -config TESTING_BATTERYDUMP_PROGNAME +config SYSTEM_BATTERYDUMP_PROGNAME string "Program name" default "batterydump" ---help--- This is the name of the program that will be used when the NSH ELF program is installed. -config TESTING_BATTERYDUMP_PRIORITY +config SYSTEM_BATTERYDUMP_PRIORITY int "Battery dump task priority" default 100 -config TESTING_BATTERYDUMP_STACKSIZE +config SYSTEM_BATTERYDUMP_STACKSIZE int "Battery dump stack size" default DEFAULT_TASK_STACKSIZE diff --git a/testing/batterydump/Make.defs b/system/batterydump/Make.defs similarity index 88% rename from testing/batterydump/Make.defs rename to system/batterydump/Make.defs index 4f5db37fd06..07126ab10bd 100644 --- a/testing/batterydump/Make.defs +++ b/system/batterydump/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/testing/batterydump/Make.defs +# apps/system/batterydump/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,6 +18,6 @@ # ############################################################################ -ifneq ($(CONFIG_TESTING_BATTERYDUMP),) -CONFIGURED_APPS += $(APPDIR)/testing/batterydump +ifneq ($(CONFIG_SYSTEM_BATTERYDUMP),) +CONFIGURED_APPS += $(APPDIR)/system/batterydump endif diff --git a/testing/batterydump/Makefile b/system/batterydump/Makefile similarity index 81% rename from testing/batterydump/Makefile rename to system/batterydump/Makefile index 00549b141c3..5f4a4a1ad08 100644 --- a/testing/batterydump/Makefile +++ b/system/batterydump/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/testing/batterydump/Makefile +# apps/system/batterydump/Makefile # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -20,10 +20,10 @@ include $(APPDIR)/Make.defs -PROGNAME = $(CONFIG_TESTING_BATTERYDUMP_PROGNAME) -PRIORITY = $(CONFIG_TESTING_BATTERYDUMP_PRIORITY) -STACKSIZE = $(CONFIG_TESTING_BATTERYDUMP_STACKSIZE) -MODULE = $(CONFIG_TESTING_BATTERYDUMP) +PROGNAME = $(CONFIG_SYSTEM_BATTERYDUMP_PROGNAME) +PRIORITY = $(CONFIG_SYSTEM_BATTERYDUMP_PRIORITY) +STACKSIZE = $(CONFIG_SYSTEM_BATTERYDUMP_STACKSIZE) +MODULE = $(CONFIG_SYSTEM_BATTERYDUMP) MAINSRC = batterydump.c diff --git a/testing/batterydump/batterydump.c b/system/batterydump/batterydump.c similarity index 99% rename from testing/batterydump/batterydump.c rename to system/batterydump/batterydump.c index 7ef02faa674..0649c0f6c3f 100644 --- a/testing/batterydump/batterydump.c +++ b/system/batterydump/batterydump.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/testing/batterydump/batterydump.c + * apps/system/batterydump/batterydump.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with From 23dd23373d7f13dadefb7063a17209d858c4e6b7 Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Mon, 4 Dec 2023 20:55:03 +0800 Subject: [PATCH 4/5] drivertest:add include file depended by cmocka from the cmocka.h: * These headers or their equivalents MUST be included prior to including * this header file. * @code * #include * #include * #include * #include * @endcode Signed-off-by: dulibo1 Signed-off-by: buxiasen --- testing/drivertest/drivertest_pm_runtime.c | 4 +++- testing/drivertest/drivertest_regulator.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/testing/drivertest/drivertest_pm_runtime.c b/testing/drivertest/drivertest_pm_runtime.c index 11e6ae66e42..9e80a0f4288 100644 --- a/testing/drivertest/drivertest_pm_runtime.c +++ b/testing/drivertest/drivertest_pm_runtime.c @@ -28,8 +28,10 @@ #include #include #include +#include +#include +#include #include -#include #include #include diff --git a/testing/drivertest/drivertest_regulator.c b/testing/drivertest/drivertest_regulator.c index 212c6805acc..aa53a693eee 100644 --- a/testing/drivertest/drivertest_regulator.c +++ b/testing/drivertest/drivertest_regulator.c @@ -28,8 +28,10 @@ #include #include #include +#include +#include +#include #include -#include #include #include From b20f023ab7e88960502910d62ae462d9d3555101 Mon Sep 17 00:00:00 2001 From: dulibo1 Date: Mon, 11 Mar 2024 18:27:37 +0800 Subject: [PATCH 5/5] pmconfig:fix coverity scan issue which is unsigned_compare Signed-off-by: dulibo1 --- nshlib/nsh_syscmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c index ac14c79ce5d..8ff9211e64b 100644 --- a/nshlib/nsh_syscmds.c +++ b/nshlib/nsh_syscmds.c @@ -290,7 +290,7 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) if (argc == 4) { ctrl.domain = atoi(argv[3]); - if (ctrl.domain < 0 || ctrl.domain >= CONFIG_PM_NDOMAINS) + if (ctrl.domain >= CONFIG_PM_NDOMAINS) { nsh_error(vtbl, g_fmtargrange, argv[3]); return ERROR;