stdio_dev.h 3.3 KB

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