wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 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 |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 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 | |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 24 | #ifndef _STDIO_DEV_H_ |
| 25 | #define _STDIO_DEV_H_ |
| 26 | |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 27 | #include <linux/list.h> |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 28 | |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 29 | /* |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 30 | * STDIO DEVICES |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */ |
| 34 | #define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */ |
| 35 | #define DEV_FLAGS_SYSTEM 0x80000000 /* Device is a system device */ |
| 36 | #define DEV_EXT_VIDEO 0x00000001 /* Video extensions supported */ |
| 37 | |
wdenk | 47cd00f | 2003-03-06 13:39:27 +0000 | [diff] [blame] | 38 | /* Device information */ |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 39 | struct stdio_dev { |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 40 | int flags; /* Device flags: input/output/system */ |
| 41 | int ext; /* Supported extensions */ |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 42 | char name[16]; /* Device name */ |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 43 | |
| 44 | /* GENERAL functions */ |
| 45 | |
| 46 | int (*start) (void); /* To start the device */ |
| 47 | int (*stop) (void); /* To stop the device */ |
| 48 | |
| 49 | /* OUTPUT functions */ |
| 50 | |
| 51 | void (*putc) (const char c); /* To put a char */ |
| 52 | void (*puts) (const char *s); /* To put a string (accelerator) */ |
| 53 | |
| 54 | /* INPUT functions */ |
| 55 | |
| 56 | int (*tstc) (void); /* To test if a char is ready... */ |
| 57 | int (*getc) (void); /* To get that char */ |
| 58 | |
| 59 | /* Other functions */ |
| 60 | |
| 61 | void *priv; /* Private extensions */ |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 62 | struct list_head list; |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 63 | }; |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 64 | |
| 65 | /* |
| 66 | * VIDEO EXTENSIONS |
| 67 | */ |
| 68 | #define VIDEO_FORMAT_RGB_INDEXED 0x0000 |
| 69 | #define VIDEO_FORMAT_RGB_DIRECTCOLOR 0x0001 |
| 70 | #define VIDEO_FORMAT_YUYV_4_4_4 0x0010 |
| 71 | #define VIDEO_FORMAT_YUYV_4_2_2 0x0011 |
| 72 | |
| 73 | typedef struct { |
| 74 | void *address; /* Address of framebuffer */ |
| 75 | ushort width; /* Horizontal resolution */ |
| 76 | ushort height; /* Vertical resolution */ |
| 77 | uchar format; /* Format */ |
| 78 | uchar colors; /* Colors number or color depth */ |
| 79 | void (*setcolreg) (int, int, int, int); |
| 80 | void (*getcolreg) (int, void *); |
| 81 | } video_ext_t; |
| 82 | |
| 83 | /* |
| 84 | * VARIABLES |
| 85 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 86 | extern struct stdio_dev *stdio_devices[]; |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 87 | extern char *stdio_names[MAX_FILES]; |
| 88 | |
| 89 | /* |
| 90 | * PROTOTYPES |
| 91 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 92 | int stdio_register (struct stdio_dev * dev); |
| 93 | int stdio_init (void); |
Jean-Christophe PLAGNIOL-VILLARD | 7e3be7c | 2009-05-16 12:14:55 +0200 | [diff] [blame] | 94 | void stdio_print_current_devices(void); |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 95 | #ifdef CONFIG_SYS_STDIO_DEREGISTER |
Mike Frysinger | d7be305 | 2010-10-20 07:18:03 -0400 | [diff] [blame] | 96 | int stdio_deregister(const char *devname); |
Jean-Christophe PLAGNIOL-VILLARD | fea91ed | 2008-12-02 21:58:04 +0100 | [diff] [blame] | 97 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 98 | struct list_head* stdio_get_list(void); |
Mike Frysinger | d7be305 | 2010-10-20 07:18:03 -0400 | [diff] [blame] | 99 | struct stdio_dev* stdio_get_by_name(const char* name); |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 100 | struct stdio_dev* stdio_clone(struct stdio_dev *dev); |
Jean-Christophe PLAGNIOL-VILLARD | c1de7a6 | 2008-08-31 04:24:55 +0200 | [diff] [blame] | 101 | |
Jean-Christophe PLAGNIOL-VILLARD | 4f57289 | 2009-02-22 15:49:28 +0100 | [diff] [blame] | 102 | #ifdef CONFIG_ARM_DCC_MULTI |
| 103 | int drv_arm_dcc_init(void); |
| 104 | #endif |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 105 | #ifdef CONFIG_LCD |
| 106 | int drv_lcd_init (void); |
| 107 | #endif |
| 108 | #ifdef CONFIG_VFD |
| 109 | int drv_vfd_init (void); |
| 110 | #endif |
wdenk | a6c7ad2 | 2002-12-03 21:28:10 +0000 | [diff] [blame] | 111 | #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 112 | int drv_video_init (void); |
| 113 | #endif |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 114 | #ifdef CONFIG_KEYBOARD |
| 115 | int drv_keyboard_init (void); |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 116 | #endif |
wdenk | 232c150 | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 117 | #ifdef CONFIG_USB_TTY |
| 118 | int drv_usbtty_init (void); |
| 119 | #endif |
wdenk | 68ceb29 | 2004-08-02 21:11:11 +0000 | [diff] [blame] | 120 | #ifdef CONFIG_NETCONSOLE |
| 121 | int drv_nc_init (void); |
| 122 | #endif |
Mike Frysinger | 36ea8e9 | 2008-10-11 21:51:20 -0400 | [diff] [blame] | 123 | #ifdef CONFIG_JTAG_CONSOLE |
| 124 | int drv_jtag_console_init (void); |
| 125 | #endif |
wdenk | e831ad5 | 2002-10-17 21:52:26 +0000 | [diff] [blame] | 126 | |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 127 | #endif |