Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef _IPXE_CONSOLE_H
  2. #define _IPXE_CONSOLE_H
  3. #include <ipxe/tables.h>
  4. /** @file
  5. *
  6. * User interaction.
  7. *
  8. * Various console devices can be selected via the build options
  9. * CONSOLE_FIRMWARE, CONSOLE_SERIAL etc. The console functions
  10. * putchar(), getchar() and iskey() delegate to the individual console
  11. * drivers.
  12. *
  13. */
  14. FILE_LICENCE ( GPL2_OR_LATER );
  15. /**
  16. * A console driver
  17. *
  18. * Defines the functions that implement a particular console type.
  19. * Must be made part of the console drivers table by using
  20. * #__console_driver.
  21. *
  22. * @note Consoles that cannot be used before their initialisation
  23. * function has completed should set #disabled=1 initially. This
  24. * allows other console devices to still be used to print out early
  25. * debugging messages.
  26. *
  27. */
  28. struct console_driver {
  29. /** Console is disabled.
  30. *
  31. * The console's putchar(), getchar() and iskey() methods will
  32. * not be called while #disabled==1. Typically the console's
  33. * initialisation functions will set #disabled=0 upon
  34. * completion.
  35. *
  36. */
  37. int disabled;
  38. /** Write a character to the console.
  39. *
  40. * @v character Character to be written
  41. * @ret None -
  42. * @err None -
  43. *
  44. */
  45. void ( *putchar ) ( int character );
  46. /** Read a character from the console.
  47. *
  48. * @v None -
  49. * @ret character Character read
  50. * @err None -
  51. *
  52. * If no character is available to be read, this method will
  53. * block. The character read should not be echoed back to the
  54. * console.
  55. *
  56. */
  57. int ( *getchar ) ( void );
  58. /** Check for available input.
  59. *
  60. * @v None -
  61. * @ret True Input is available
  62. * @ret False Input is not available
  63. * @err None -
  64. *
  65. * This should return True if a subsequent call to getchar()
  66. * will not block.
  67. *
  68. */
  69. int ( *iskey ) ( void );
  70. };
  71. /** Console driver table */
  72. #define CONSOLES __table ( struct console_driver, "consoles" )
  73. /**
  74. * Mark a <tt> struct console_driver </tt> as being part of the
  75. * console drivers table.
  76. *
  77. * Use as e.g.
  78. *
  79. * @code
  80. *
  81. * struct console_driver my_console __console_driver = {
  82. * .putchar = my_putchar,
  83. * .getchar = my_getchar,
  84. * .iskey = my_iskey,
  85. * };
  86. *
  87. * @endcode
  88. *
  89. */
  90. #define __console_driver __table_entry ( CONSOLES, 01 )
  91. /* Function prototypes */
  92. extern void putchar ( int character );
  93. extern int getchar ( void );
  94. extern int iskey ( void );
  95. extern int getkey ( unsigned long timeout );
  96. #endif /* _IPXE_CONSOLE_H */