console.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000-2009
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #ifndef __CONSOLE_H
  7. #define __CONSOLE_H
  8. extern char console_buffer[];
  9. /* common/console.c */
  10. int console_init_f(void); /* Before relocation; uses the serial stuff */
  11. int console_init_r(void); /* After relocation; uses the console stuff */
  12. int console_assign(int file, const char *devname); /* Assign the console */
  13. int ctrlc(void);
  14. int had_ctrlc(void); /* have we had a Control-C since last clear? */
  15. void clear_ctrlc(void); /* clear the Control-C condition */
  16. int disable_ctrlc(int); /* 1 to disable, 0 to enable Control-C detect */
  17. int confirm_yesno(void); /* 1 if input is "y", "Y", "yes" or "YES" */
  18. /**
  19. * console_record_init() - set up the console recording buffers
  20. *
  21. * This should be called as soon as malloc() is available so that the maximum
  22. * amount of console output can be recorded.
  23. */
  24. int console_record_init(void);
  25. /**
  26. * console_record_reset() - reset the console recording buffers
  27. *
  28. * Removes any data in the buffers
  29. */
  30. void console_record_reset(void);
  31. /**
  32. * console_record_reset_enable() - reset and enable the console buffers
  33. *
  34. * This should be called to enable the console buffer.
  35. */
  36. void console_record_reset_enable(void);
  37. /**
  38. * console_record_readline() - Read a line from the console output
  39. *
  40. * This reads the next available line from the console output previously
  41. * recorded.
  42. *
  43. * @str: Place to put string
  44. * @maxlen: Maximum length of @str including nul terminator
  45. * @return length of string returned
  46. */
  47. int console_record_readline(char *str, int maxlen);
  48. /**
  49. * console_record_avail() - Get the number of available bytes in console output
  50. *
  51. * @return available bytes (0 if empty)
  52. */
  53. int console_record_avail(void);
  54. /**
  55. * console_announce_r() - print a U-Boot console on non-serial consoles
  56. *
  57. * When U-Boot starts up with a display it generally does not announce itself
  58. * on the display. The banner is instead emitted on the UART before relocation.
  59. * This function prints a banner on devices which (we assume) did not receive
  60. * it before relocation.
  61. *
  62. * @return 0 (meaning no errors)
  63. */
  64. int console_announce_r(void);
  65. /*
  66. * CONSOLE multiplexing.
  67. */
  68. #ifdef CONFIG_CONSOLE_MUX
  69. #include <iomux.h>
  70. #endif
  71. #endif