2 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 * Author: Chris G. Demetriou
7 * Permission to use, copy, modify and distribute this software and
8 * its documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
15 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie the
25 * rights to redistribute these changes.
27 * Copyright (c) 2000 Andrew Miklic
35 #define MAX_NUM_GFB_CARDS 16
37 #define GFB_UNIT(dev) minor(dev)
38 #define GFB_MKMINOR(unit) (unit)
39 #define BIT_REVERSE(byte) \
40 ((((byte) & 0x01) << 7) | \
41 (((byte) & 0x02) << 5) | \
42 (((byte) & 0x04) << 3) | \
43 (((byte) & 0x08) << 1) | \
44 (((byte) & 0x10) >> 1) | \
45 (((byte) & 0x20) >> 3) | \
46 (((byte) & 0x40) >> 5) | \
47 (((byte) & 0x80) >> 7))
48 #define probe_done(adp) ((adp)->va_flags & V_ADP_PROBED)
49 #define init_done(adp) ((adp)->va_flags & V_ADP_INITIALIZED)
50 #define config_done(adp) ((adp)->va_flags & V_ADP_REGISTERED)
58 vi_get_info_t gfb_get_info;
59 /*vi_query_mode_t gfb_query_mode;*/
60 vi_set_mode_t gfb_set_mode;
61 vi_save_font_t gfb_save_font;
62 vi_load_font_t gfb_load_font;
63 vi_show_font_t gfb_show_font;
64 vi_save_palette_t gfb_save_palette;
65 vi_load_palette_t gfb_load_palette;
66 vi_save_state_t gfb_save_state;
67 vi_load_state_t gfb_load_state;
68 vi_read_hw_cursor_t gfb_read_hw_cursor;
69 vi_set_hw_cursor_t gfb_set_hw_cursor;
70 vi_set_hw_cursor_shape_t gfb_set_hw_cursor_shape;
73 vi_set_border_t gfb_set_border;
74 vi_set_win_org_t gfb_set_win_org;
75 vi_fill_rect_t gfb_fill_rect;
76 vi_bitblt_t gfb_bitblt;
79 vi_save_cursor_palette_t gfb_save_cursor_palette;
80 vi_load_cursor_palette_t gfb_load_cursor_palette;
87 typedef void gfb_ramdac_init_t(struct gfb_softc *);
88 typedef u_int8_t gfb_ramdac_rd_t(struct gfb_softc *, u_int);
89 typedef void gfb_ramdac_wr_t(struct gfb_softc *, u_int, u_int8_t);
90 typedef void gfb_ramdac_intr_t(struct gfb_softc *);
91 typedef int gfb_ramdac_save_palette_t(video_adapter_t *, video_color_palette_t *);
92 typedef int gfb_ramdac_load_palette_t(video_adapter_t *, video_color_palette_t *);
93 typedef int gfb_ramdac_save_cursor_palette_t(video_adapter_t *, struct fbcmap *);
94 typedef int gfb_ramdac_load_cursor_palette_t(video_adapter_t *, struct fbcmap *);
95 typedef int gfb_ramdac_read_hw_cursor_t(video_adapter_t *, int *, int *);
96 typedef int gfb_ramdac_set_hw_cursor_t(video_adapter_t *, int, int);
97 typedef int gfb_ramdac_set_hw_cursor_shape_t(video_adapter_t *, int, int, int, int);
98 typedef int gfb_builtin_save_palette_t(video_adapter_t *, video_color_palette_t *);
99 typedef int gfb_builtin_load_palette_t(video_adapter_t *, video_color_palette_t *);
100 typedef int gfb_builtin_save_cursor_palette_t(video_adapter_t *, struct fbcmap *);
101 typedef int gfb_builtin_load_cursor_palette_t(video_adapter_t *, struct fbcmap *);
102 typedef int gfb_builtin_read_hw_cursor_t(video_adapter_t *, int *, int *);
103 typedef int gfb_builtin_set_hw_cursor_t(video_adapter_t *, int, int);
104 typedef int gfb_builtin_set_hw_cursor_shape_t(video_adapter_t *, int, int, int, int);
107 u_int16_t cols; /* Columns */
108 u_int16_t hfp; /* Horizontal Front Porch */
109 u_int16_t hsync; /* Horizontal Sync */
110 u_int16_t hbp; /* Horizontal Back Porch */
111 u_int16_t rows; /* Rows */
112 u_int16_t vfp; /* Vertical Front Porch */
113 u_int16_t vsync; /* Vertical Sync */
114 u_int16_t vbp; /* Vertical Back Porch */
115 u_int32_t dotclock; /* Dot Clock */
121 u_char data[256 * 32];
125 char *name; /* name for this board type */
126 char *ramdac_name; /* name for this RAMDAC */
128 struct gfb_font fonts[4];
129 video_color_palette_t palette;
130 struct fbcmap cursor_palette;
131 gfb_ramdac_init_t *ramdac_init;
132 gfb_ramdac_rd_t *ramdac_rd;
133 gfb_ramdac_wr_t *ramdac_wr;
134 gfb_ramdac_intr_t *ramdac_intr;
135 gfb_ramdac_save_palette_t *ramdac_save_palette;
136 gfb_ramdac_load_palette_t *ramdac_load_palette;
137 gfb_ramdac_save_cursor_palette_t *ramdac_save_cursor_palette;
138 gfb_ramdac_load_cursor_palette_t *ramdac_load_cursor_palette;
139 gfb_ramdac_read_hw_cursor_t *ramdac_read_hw_cursor;
140 gfb_ramdac_set_hw_cursor_t *ramdac_set_hw_cursor;
141 gfb_ramdac_set_hw_cursor_shape_t *ramdac_set_hw_cursor_shape;
142 gfb_builtin_save_palette_t *builtin_save_palette;
143 gfb_builtin_load_palette_t *builtin_load_palette;
144 gfb_builtin_save_cursor_palette_t *builtin_save_cursor_palette;
145 gfb_builtin_load_cursor_palette_t *builtin_load_cursor_palette;
146 gfb_builtin_read_hw_cursor_t *builtin_read_hw_cursor;
147 gfb_builtin_set_hw_cursor_t *builtin_set_hw_cursor;
148 gfb_builtin_set_hw_cursor_shape_t *builtin_set_hw_cursor_shape;
151 struct video_adapter;
154 typedef struct gfb_softc {
155 char *driver_name; /* name for this driver */
156 struct video_adapter *adp;
157 struct genfb_softc *gensc;
158 struct gfb_conf *gfbc;
159 bus_space_handle_t bhandle;
160 bus_space_tag_t btag;
161 bus_space_handle_t regs;
163 struct resource *irq;
164 struct resource *res;
165 u_int8_t rev; /* GFB revision */
168 struct cdevsw *cdevsw;
172 #endif /* _FB_GFB_H_ */