console.c 1.0 KB

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