stdio_dev.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * (C) Copyright 2000
  3. * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _STDIO_DEV_H_
  8. #define _STDIO_DEV_H_
  9. #include <linux/list.h>
  10. /*
  11. * STDIO DEVICES
  12. */
  13. #define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
  14. #define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */
  15. /* Device information */
  16. struct stdio_dev {
  17. int flags; /* Device flags: input/output/system */
  18. int ext; /* Supported extensions */
  19. char name[32]; /* Device name */
  20. /* GENERAL functions */
  21. int (*start)(struct stdio_dev *dev); /* To start the device */
  22. int (*stop)(struct stdio_dev *dev); /* To stop the device */
  23. /* OUTPUT functions */
  24. /* To put a char */
  25. void (*putc)(struct stdio_dev *dev, const char c);
  26. /* To put a string (accelerator) */
  27. void (*puts)(struct stdio_dev *dev, const char *s);
  28. /* INPUT functions */
  29. /* To test if a char is ready... */
  30. int (*tstc)(struct stdio_dev *dev);
  31. int (*getc)(struct stdio_dev *dev); /* To get that char */
  32. /* Other functions */
  33. void *priv; /* Private extensions */
  34. struct list_head list;
  35. };
  36. /*
  37. * VIDEO EXTENSIONS
  38. */
  39. #define VIDEO_FORMAT_RGB_INDEXED 0x0000
  40. #define VIDEO_FORMAT_RGB_DIRECTCOLOR 0x0001
  41. #define VIDEO_FORMAT_YUYV_4_4_4 0x0010
  42. #define VIDEO_FORMAT_YUYV_4_2_2 0x0011
  43. typedef struct {
  44. void *address; /* Address of framebuffer */
  45. ushort width; /* Horizontal resolution */
  46. ushort height; /* Vertical resolution */
  47. uchar format; /* Format */
  48. uchar colors; /* Colors number or color depth */
  49. void (*setcolreg) (int, int, int, int);
  50. void (*getcolreg) (int, void *);
  51. } video_ext_t;
  52. /*
  53. * VARIABLES
  54. */
  55. extern struct stdio_dev *stdio_devices[];
  56. extern char *stdio_names[MAX_FILES];
  57. /*
  58. * PROTOTYPES
  59. */
  60. int stdio_register (struct stdio_dev * dev);
  61. int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp);
  62. /**
  63. * stdio_init_tables() - set up stdio tables ready for devices
  64. *
  65. * This does not add any devices, but just prepares stdio for use.
  66. */
  67. int stdio_init_tables(void);
  68. /**
  69. * stdio_add_devices() - Add stdio devices to the table
  70. *
  71. * This makes calls to all the various subsystems that use stdio, to make
  72. * them register with stdio.
  73. */
  74. int stdio_add_devices(void);
  75. /**
  76. * stdio_init() - Sets up stdio ready for use
  77. *
  78. * This calls stdio_init_tables() and stdio_add_devices()
  79. */
  80. int stdio_init(void);
  81. void stdio_print_current_devices(void);
  82. #if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
  83. int stdio_deregister(const char *devname, int force);
  84. int stdio_deregister_dev(struct stdio_dev *dev, int force);
  85. #endif
  86. struct list_head* stdio_get_list(void);
  87. struct stdio_dev* stdio_get_by_name(const char* name);
  88. struct stdio_dev* stdio_clone(struct stdio_dev *dev);
  89. #ifdef CONFIG_LCD
  90. int drv_lcd_init (void);
  91. #endif
  92. #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
  93. int drv_video_init (void);
  94. #endif
  95. #ifdef CONFIG_KEYBOARD
  96. int drv_keyboard_init (void);
  97. #endif
  98. #ifdef CONFIG_USB_TTY
  99. int drv_usbtty_init (void);
  100. #endif
  101. #ifdef CONFIG_NETCONSOLE
  102. int drv_nc_init (void);
  103. #endif
  104. #ifdef CONFIG_JTAG_CONSOLE
  105. int drv_jtag_console_init (void);
  106. #endif
  107. #ifdef CONFIG_CBMEM_CONSOLE
  108. int cbmemc_init(void);
  109. #endif
  110. #endif