[PATCH 16/17] fileio: lspci candidate command

Joel Sherrill joel at rtems.org
Wed Mar 9 22:25:01 UTC 2016


From: Joel Sherrill <joel.sherrill at oarcorp.com>

---
 testsuites/samples/fileio/Makefile.am  |  2 +-
 testsuites/samples/fileio/init.c       |  5 +++-
 testsuites/samples/fileio/main_lspci.c | 43 ++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 testsuites/samples/fileio/main_lspci.c

diff --git a/testsuites/samples/fileio/Makefile.am b/testsuites/samples/fileio/Makefile.am
index bf88273..6e67e42 100644
--- a/testsuites/samples/fileio/Makefile.am
+++ b/testsuites/samples/fileio/Makefile.am
@@ -1,5 +1,5 @@
 rtems_tests_PROGRAMS = fileio
-fileio_SOURCES = init.c system.h
+fileio_SOURCES = init.c system.h main_lspci.c
 
 dist_rtems_tests_DATA = fileio.doc
 
diff --git a/testsuites/samples/fileio/init.c b/testsuites/samples/fileio/init.c
index 07ec2c6..ca3527d 100644
--- a/testsuites/samples/fileio/init.c
+++ b/testsuites/samples/fileio/init.c
@@ -1291,8 +1291,11 @@ static rtems_shell_alias_t Shell_USERECHO_Alias = {
   "userecho"                 /* alias */
 };
 
+extern rtems_shell_cmd_t Shell_LSPCI_Command;
 
-#define CONFIGURE_SHELL_USER_COMMANDS &Shell_USERCMD_Command
+#define CONFIGURE_SHELL_USER_COMMANDS \
+    &Shell_USERCMD_Command, \
+    &Shell_LSPCI_Command
 #define CONFIGURE_SHELL_USER_ALIASES &Shell_USERECHO_Alias
 #define CONFIGURE_SHELL_COMMANDS_INIT
 #define CONFIGURE_SHELL_COMMANDS_ALL
diff --git a/testsuites/samples/fileio/main_lspci.c b/testsuites/samples/fileio/main_lspci.c
new file mode 100644
index 0000000..564b701
--- /dev/null
+++ b/testsuites/samples/fileio/main_lspci.c
@@ -0,0 +1,43 @@
+/**
+ * @brief lspci command
+ *
+ * This file is a simple wrapper for the pci_dump() method and provides
+ * a simple lspci command.
+ */
+
+/*  COPYRIGHT (c) 2016.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#include <rtems.h>
+#include <rtems/shell.h>
+
+extern void pci_dump(FILE *f);
+
+int main_lspci(
+  int    argc,
+  char **argv
+);
+
+int main_lspci(
+  int    argc,
+  char **argv
+)
+{
+  pci_dump( NULL );
+
+  return 0;
+}
+
+rtems_shell_cmd_t Shell_LSPCI_Command = {
+  "lspci",                                         /* name */
+  "lspci",                                         /* usage */
+  "user",                                          /* topic */
+  main_lspci,                                      /* command */
+  NULL,                                            /* alias */
+  NULL                                             /* next */
+};
-- 
1.8.3.1



More information about the devel mailing list