cmd_console.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * (C) Copyright 2000
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. /*
  8. * Boot support
  9. */
  10. #include <common.h>
  11. #include <command.h>
  12. #include <stdio_dev.h>
  13. extern void _do_coninfo (void);
  14. static int do_coninfo(cmd_tbl_t *cmd, int flag, int argc, char * const argv[])
  15. {
  16. int l;
  17. struct list_head *list = stdio_get_list();
  18. struct list_head *pos;
  19. struct stdio_dev *dev;
  20. /* Scan for valid output and input devices */
  21. puts ("List of available devices:\n");
  22. list_for_each(pos, list) {
  23. dev = list_entry(pos, struct stdio_dev, list);
  24. printf ("%-8s %08x %c%c%c ",
  25. dev->name,
  26. dev->flags,
  27. (dev->flags & DEV_FLAGS_SYSTEM) ? 'S' : '.',
  28. (dev->flags & DEV_FLAGS_INPUT) ? 'I' : '.',
  29. (dev->flags & DEV_FLAGS_OUTPUT) ? 'O' : '.');
  30. for (l = 0; l < MAX_FILES; l++) {
  31. if (stdio_devices[l] == dev) {
  32. printf ("%s ", stdio_names[l]);
  33. }
  34. }
  35. putc ('\n');
  36. }
  37. return 0;
  38. }
  39. /***************************************************/
  40. U_BOOT_CMD(
  41. coninfo, 3, 1, do_coninfo,
  42. "print console devices and information",
  43. ""
  44. );