aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-03-04 08:43:06 -0700
committerTom Rini <trini@konsulko.com>2022-03-09 20:46:01 -0500
commiteea3e3288bb60a739e134b271fcaf9ae16f13c76 (patch)
treee8b7de2137998bcbd78a4f276ca8417d3adcfcf6
parentadc7fd3f9ccbe9bb4322f2278433ec417df87350 (diff)
downloadu-boot-eea3e3288bb60a739e134b271fcaf9ae16f13c76.zip
u-boot-eea3e3288bb60a739e134b271fcaf9ae16f13c76.tar.gz
u-boot-eea3e3288bb60a739e134b271fcaf9ae16f13c76.tar.bz2
event: Add a command
Add a command to show the available events. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--MAINTAINERS1
-rw-r--r--cmd/Kconfig8
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/event.c27
-rw-r--r--include/event.h3
5 files changed, 40 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 2786ada..6e5c022 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -812,6 +812,7 @@ F: scripts/env2string.awk
EVENTS
M: Simon Glass <sjg@chromium.org>
S: Maintained
+F: cmd/event.c
F: common/event.c
F: include/event.h
F: test/common/event.c
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 7790cf3..d2aa06a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2376,6 +2376,14 @@ config CMD_DIAG
available tests and running either all the tests, or specific tests
identified by name.
+config CMD_EVENT
+ bool "event - Show information about events"
+ default y if EVENT_DEBUG
+ help
+ This enables the 'event' command which provides information about
+ events and event-handler routines. This can help to device event
+ hadling.
+
config CMD_IRQ
bool "irq - Show information about interrupts"
depends on !ARM && !MIPS && !RISCV && !SH
diff --git a/cmd/Makefile b/cmd/Makefile
index 166c652..0d2b2ee 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_CMD_DIAG) += diag.o
endif
obj-$(CONFIG_CMD_ADTIMG) += adtimg.o
obj-$(CONFIG_CMD_ABOOTIMG) += abootimg.o
+obj-$(CONFIG_CMD_EVENT) += event.o
obj-$(CONFIG_CMD_EXTENSION) += extension_board.o
obj-$(CONFIG_CMD_ECHO) += echo.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
diff --git a/cmd/event.c b/cmd/event.c
new file mode 100644
index 0000000..9cac202
--- /dev/null
+++ b/cmd/event.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Command-line access to events
+ *
+ * Copyright 2021 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <event.h>
+
+static int do_event_list(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ event_show_spy_list();
+
+ return 0;
+}
+
+#ifdef CONFIG_SYS_LONGHELP
+static char event_help_text[] =
+ "event list - list event spies";
+#endif
+
+U_BOOT_CMD_WITH_SUBCMDS(event, "Events", event_help_text,
+ U_BOOT_SUBCMD_MKENT(list, 1, 1, do_event_list));
diff --git a/include/event.h b/include/event.h
index 78a4237..62e72a7 100644
--- a/include/event.h
+++ b/include/event.h
@@ -141,6 +141,9 @@ static inline const char *event_spy_id(struct evspy_info *spy)
int event_register(const char *id, enum event_t type, event_handler_t func,
void *ctx);
+/** event_show_spy_list( - Show a list of event spies */
+void event_show_spy_list(void);
+
#if CONFIG_IS_ENABLED(EVENT)
/**
* event_notify() - notify spies about an event