devices.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * (C) Copyright 2000
  3. * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <lists.h>
  24. #ifndef _DEVICES_H_
  25. #define _DEVICES_H_
  26. /*
  27. * CONSOLE DEVICES
  28. */
  29. #define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
  30. #define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */
  31. #define DEV_FLAGS_SYSTEM 0x80000000 /* Device is a system device */
  32. #define DEV_EXT_VIDEO 0x00000001 /* Video extensions supported */
  33. /* Device information */
  34. typedef struct {
  35. int flags; /* Device flags: input/output/system */
  36. int ext; /* Supported extensions */
  37. char name[16]; /* Device name */
  38. /* GENERAL functions */
  39. int (*start) (void); /* To start the device */
  40. int (*stop) (void); /* To stop the device */
  41. /* OUTPUT functions */
  42. void (*putc) (const char c); /* To put a char */
  43. void (*puts) (const char *s); /* To put a string (accelerator) */
  44. /* INPUT functions */
  45. int (*tstc) (void); /* To test if a char is ready... */
  46. int (*getc) (void); /* To get that char */
  47. /* Other functions */
  48. void *priv; /* Private extensions */
  49. } device_t;
  50. /*
  51. * VIDEO EXTENSIONS
  52. */
  53. #define VIDEO_FORMAT_RGB_INDEXED 0x0000
  54. #define VIDEO_FORMAT_RGB_DIRECTCOLOR 0x0001
  55. #define VIDEO_FORMAT_YUYV_4_4_4 0x0010
  56. #define VIDEO_FORMAT_YUYV_4_2_2 0x0011
  57. typedef struct {
  58. void *address; /* Address of framebuffer */
  59. ushort width; /* Horizontal resolution */
  60. ushort height; /* Vertical resolution */
  61. uchar format; /* Format */
  62. uchar colors; /* Colors number or color depth */
  63. void (*setcolreg) (int, int, int, int);
  64. void (*getcolreg) (int, void *);
  65. } video_ext_t;
  66. /*
  67. * VARIABLES
  68. */
  69. extern list_t devlist;
  70. extern device_t *stdio_devices[];
  71. extern char *stdio_names[MAX_FILES];
  72. /*
  73. * PROTOTYPES
  74. */
  75. int device_register (device_t * dev);
  76. int devices_init (void);
  77. int devices_done (void);
  78. int device_deregister(char *devname);
  79. #ifdef CONFIG_LCD
  80. int drv_lcd_init (void);
  81. #endif
  82. #ifdef CONFIG_VFD
  83. int drv_vfd_init (void);
  84. #endif
  85. #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
  86. int drv_video_init (void);
  87. #endif
  88. #ifdef CONFIG_KEYBOARD
  89. int drv_keyboard_init (void);
  90. #endif
  91. #ifdef CONFIG_USB_TTY
  92. int drv_usbtty_init (void);
  93. #endif
  94. #ifdef CONFIG_NETCONSOLE
  95. int drv_nc_init (void);
  96. #endif
  97. #endif /* _DEVICES_H_ */