10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_VISUAL_IO_H
28 #define _SYS_VISUAL_IO_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #define VIOC ('V' << 8)
37 #define VIOCF ('F' << 8)
38
39
40 /*
41 * Device Identification
42 *
43 * VIS_GETIDENTIFIER returns an identifier string to uniquely identify
44 * a device type used in the Solaris VISUAL environment. The identifier
45 * must be unique. We suggest the convention:
46 *
47 * <companysymbol><devicetype>
48 *
49 * for example: SUNWcg6
50 */
51
123
124 /*
125 * VIS_SETCMAP:
126 * VIS_GETCMAP:
127 * Set/Get the indicated color map entries. The index states the first
128 * color to be update and count specifies the number of entries to be
129 * updated from index. red, green, and blue are arrays of color
130 * values. The length of the arrays is count.
131 */
132 #define VIS_GETCMAP (VIOC|9)
133 #define VIS_PUTCMAP (VIOC|10)
134 struct vis_cmap {
135 int index; /* Index into colormap to start updating */
136 int count; /* Number of entries to update */
137 unsigned char *red; /* List of red values */
138 unsigned char *green; /* List of green values */
139 unsigned char *blue; /* List of blue values */
140 };
141
142
143 #ifdef _KERNEL
144 /*
145 * The following ioctls are used for communication between the layered
146 * device and the framebuffer. The layered driver calls the framebuffer
147 * with these ioctls.
148 *
149 * On machines that don't have a prom, kmdb uses the kernel to display
150 * characters. The kernel in turn will use the routines returned by
151 * VIS_DEVINIT to ask the framebuffer driver to display the data. The
152 * framebuffer driver CANNOT use any DDI services to display this data. It
153 * must just dump the data to the framebuffer. In particular, the mutex and
154 * copy routines do not work.
155 *
156 * On machines without a prom, the framebuffer driver must implement all
157 * of these ioctls to be a console. On machines with a prom, the
158 * framebuffer driver can set vis_devinit.polledio to NULL.
159 */
160 typedef short screen_pos_t;
161 typedef short screen_size_t;
162
163 /*
164 * Union of pixel depths
165 */
166 typedef union {
167 unsigned char mono; /* one-bit */
168 unsigned char four; /* four bit */
169 unsigned char eight; /* eight bit */
170 unsigned char twentyfour[3]; /* 24 bit */
171 } color_t;
172
173 /*
174 * VIS_DEVINIT:
175 * Initialize the framebuffer as a console device. The terminal emulator
176 * will provide the following structure to the device driver to be filled in.
177 * The driver is expected to fill it in.
178 *
179 * ioctl(fd, VIS_DEVINIT, struct vis_devinit *)
180 */
181 #define VIS_DEVINIT (VIOC|1)
182 #define VIS_CONS_REV 3 /* Console IO interface version */
183 /* Modes */
184 #define VIS_TEXT 0 /* Use text mode when displaying data */
185 #define VIS_PIXEL 1 /* Use pixel mode when displaying data */
186
187 /*
188 * VIS_DEVFINI:
189 * Tells the framebuffer that it is no longer being used as a console.
190 *
191 * ioctl(fd, VIS_DEVFINI, unused)
192 */
193 #define VIS_DEVFINI (VIOC|2)
194
195 /*
196 * VIS_CONSCURSOR:
197 * Display/Hide cursor on the screen. The layered driver uses this ioctl to
198 * display, hide, and move the cursor on the console. The framebuffer driver
199 * is expected to draw a cursor at position (col,row) of size width x height.
200 *
201 * ioctl(fd, VIS_CONSCURSOR, struct vis_conscursor *)
202 */
212 * by the driver during console initialization (see VIS_CONSDEVINIT above).
213 * The driver is expected to display the data at location (row,col). Width
214 * and height specify the size of the data.
215 *
216 * ioctl(fd, VIS_CONSDISPLAY, struct vis_consdisplay *)
217 */
218
219 #define VIS_CONSDISPLAY (VIOC|5)
220
221 /*
222 * VIS_CONSCOPY:
223 * Move data on the framebuffer. Used to scroll the screen by the terminal
224 * emulator or to move data by applications. The driver must copy the data
225 * specified by the rectangle (s_col,s_row),(e_col,e_row) to the location
226 * which starts at (t_col,t_row), handling overlapping copies correctly.
227 *
228 * ioctl(fd, VIS_CONSCOPY, struct vis_conscopy *)
229 */
230 #define VIS_CONSCOPY (VIOC|7)
231
232 struct vis_consdisplay {
233 screen_pos_t row; /* Row to display data at */
234 screen_pos_t col; /* Col to display data at */
235 screen_size_t width; /* Width of data */
236 screen_size_t height; /* Height of data */
237 unsigned char *data; /* Data to display */
238 unsigned char fg_color; /* Foreground color */
239 unsigned char bg_color; /* Background color */
240 };
241
242 struct vis_conscopy {
243 screen_pos_t s_row; /* Starting row */
244 screen_pos_t s_col; /* Starting col */
245 screen_pos_t e_row; /* Ending row */
246 screen_pos_t e_col; /* Ending col */
247 screen_pos_t t_row; /* Row to move to */
248 screen_pos_t t_col; /* Col to move to */
249 };
250
251 struct vis_conscursor {
267 struct vis_polledio_arg;
268 struct vis_modechg_arg;
269
270 /*
271 * Each software-console-capable frame buffer driver supplies these routines
272 * for I/O from "polled" contexts - kmdb, OBP, etc. No system services are
273 * available.
274 */
275 struct vis_polledio {
276 struct vis_polledio_arg *arg;
277 void (*display)(struct vis_polledio_arg *, struct vis_consdisplay *);
278 void (*copy)(struct vis_polledio_arg *, struct vis_conscopy *);
279 void (*cursor)(struct vis_polledio_arg *, struct vis_conscursor *);
280 };
281
282 struct vis_devinit; /* forward decl. for typedef */
283
284 typedef void (*vis_modechg_cb_t)(struct vis_modechg_arg *,
285 struct vis_devinit *);
286
287 struct vis_devinit {
288 /*
289 * This set of fields are used as parameters passed from the
290 * layered framebuffer driver to the terminal emulator.
291 */
292 int version; /* Console IO interface version */
293 screen_size_t width; /* Width of the device */
294 screen_size_t height; /* Height of the device */
295 screen_size_t linebytes; /* Bytes per scan line */
296 int depth; /* Device depth */
297 short mode; /* Mode to use when displaying data */
298 struct vis_polledio *polledio; /* Polled output routines */
299
300 /*
301 * The following fields are used as parameters passed from the
302 * terminal emulator to the underlying framebuffer driver.
303 */
304 vis_modechg_cb_t modechg_cb; /* Video mode change callback */
305 struct vis_modechg_arg *modechg_arg; /* Mode change cb arg */
306 };
307
308 #endif /* _KERNEL */
309
310 #ifdef __cplusplus
311 }
312 #endif
313
314 #endif /* !_SYS_VISUAL_IO_H */
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_VISUAL_IO_H
28 #define _SYS_VISUAL_IO_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #define VIOC ('V' << 8)
35 #define VIOCF ('F' << 8)
36
37
38 /*
39 * Device Identification
40 *
41 * VIS_GETIDENTIFIER returns an identifier string to uniquely identify
42 * a device type used in the Solaris VISUAL environment. The identifier
43 * must be unique. We suggest the convention:
44 *
45 * <companysymbol><devicetype>
46 *
47 * for example: SUNWcg6
48 */
49
121
122 /*
123 * VIS_SETCMAP:
124 * VIS_GETCMAP:
125 * Set/Get the indicated color map entries. The index states the first
126 * color to be update and count specifies the number of entries to be
127 * updated from index. red, green, and blue are arrays of color
128 * values. The length of the arrays is count.
129 */
130 #define VIS_GETCMAP (VIOC|9)
131 #define VIS_PUTCMAP (VIOC|10)
132 struct vis_cmap {
133 int index; /* Index into colormap to start updating */
134 int count; /* Number of entries to update */
135 unsigned char *red; /* List of red values */
136 unsigned char *green; /* List of green values */
137 unsigned char *blue; /* List of blue values */
138 };
139
140
141 #if defined(_KERNEL) || defined(_BOOT)
142 /*
143 * The following ioctls are used for communication between the layered
144 * device and the framebuffer. The layered driver calls the framebuffer
145 * with these ioctls.
146 *
147 * On machines that don't have a prom, kmdb uses the kernel to display
148 * characters. The kernel in turn will use the routines returned by
149 * VIS_DEVINIT to ask the framebuffer driver to display the data. The
150 * framebuffer driver CANNOT use any DDI services to display this data. It
151 * must just dump the data to the framebuffer. In particular, the mutex and
152 * copy routines do not work.
153 *
154 * On machines without a prom, the framebuffer driver must implement all
155 * of these ioctls to be a console. On machines with a prom, the
156 * framebuffer driver can set vis_devinit.polledio to NULL.
157 */
158 typedef short screen_pos_t;
159 typedef short screen_size_t;
160
161 /*
162 * Union of pixel depths
163 */
164 typedef union {
165 unsigned char mono; /* one-bit */
166 unsigned char four; /* four bit */
167 unsigned char eight; /* eight bit */
168 unsigned char sixteen[2]; /* 16 bit */
169 unsigned char twentyfour[3]; /* 24 bit */
170 } color_t;
171
172 /*
173 * VIS_DEVINIT:
174 * Initialize the framebuffer as a console device. The terminal emulator
175 * will provide the following structure to the device driver to be filled in.
176 * The driver is expected to fill it in.
177 *
178 * ioctl(fd, VIS_DEVINIT, struct vis_devinit *)
179 */
180 #define VIS_DEVINIT (VIOC|1)
181 #define VIS_CONS_REV 4 /* Console IO interface version */
182 /* Modes */
183 #define VIS_TEXT 0 /* Use text mode when displaying data */
184 #define VIS_PIXEL 1 /* Use pixel mode when displaying data */
185
186 /*
187 * VIS_DEVFINI:
188 * Tells the framebuffer that it is no longer being used as a console.
189 *
190 * ioctl(fd, VIS_DEVFINI, unused)
191 */
192 #define VIS_DEVFINI (VIOC|2)
193
194 /*
195 * VIS_CONSCURSOR:
196 * Display/Hide cursor on the screen. The layered driver uses this ioctl to
197 * display, hide, and move the cursor on the console. The framebuffer driver
198 * is expected to draw a cursor at position (col,row) of size width x height.
199 *
200 * ioctl(fd, VIS_CONSCURSOR, struct vis_conscursor *)
201 */
211 * by the driver during console initialization (see VIS_CONSDEVINIT above).
212 * The driver is expected to display the data at location (row,col). Width
213 * and height specify the size of the data.
214 *
215 * ioctl(fd, VIS_CONSDISPLAY, struct vis_consdisplay *)
216 */
217
218 #define VIS_CONSDISPLAY (VIOC|5)
219
220 /*
221 * VIS_CONSCOPY:
222 * Move data on the framebuffer. Used to scroll the screen by the terminal
223 * emulator or to move data by applications. The driver must copy the data
224 * specified by the rectangle (s_col,s_row),(e_col,e_row) to the location
225 * which starts at (t_col,t_row), handling overlapping copies correctly.
226 *
227 * ioctl(fd, VIS_CONSCOPY, struct vis_conscopy *)
228 */
229 #define VIS_CONSCOPY (VIOC|7)
230
231 /*
232 * VIS_CONSCLEAR:
233 * Clear the screen using provided color. Used on VIS_PIXEL mode.
234 *
235 * ioctl(fd, VIS_CONSCLEAR, struct vis_consclear *)
236 */
237 #define VIS_CONSCLEAR (VIOC|8)
238
239 struct vis_consclear {
240 unsigned char bg_color; /* Background color */
241 };
242
243 struct vis_consdisplay {
244 screen_pos_t row; /* Row to display data at */
245 screen_pos_t col; /* Col to display data at */
246 screen_size_t width; /* Width of data */
247 screen_size_t height; /* Height of data */
248 unsigned char *data; /* Data to display */
249 unsigned char fg_color; /* Foreground color */
250 unsigned char bg_color; /* Background color */
251 };
252
253 struct vis_conscopy {
254 screen_pos_t s_row; /* Starting row */
255 screen_pos_t s_col; /* Starting col */
256 screen_pos_t e_row; /* Ending row */
257 screen_pos_t e_col; /* Ending col */
258 screen_pos_t t_row; /* Row to move to */
259 screen_pos_t t_col; /* Col to move to */
260 };
261
262 struct vis_conscursor {
278 struct vis_polledio_arg;
279 struct vis_modechg_arg;
280
281 /*
282 * Each software-console-capable frame buffer driver supplies these routines
283 * for I/O from "polled" contexts - kmdb, OBP, etc. No system services are
284 * available.
285 */
286 struct vis_polledio {
287 struct vis_polledio_arg *arg;
288 void (*display)(struct vis_polledio_arg *, struct vis_consdisplay *);
289 void (*copy)(struct vis_polledio_arg *, struct vis_conscopy *);
290 void (*cursor)(struct vis_polledio_arg *, struct vis_conscursor *);
291 };
292
293 struct vis_devinit; /* forward decl. for typedef */
294
295 typedef void (*vis_modechg_cb_t)(struct vis_modechg_arg *,
296 struct vis_devinit *);
297
298 typedef uint32_t (*color_map_fn_t)(uint8_t color);
299
300 struct vis_devinit {
301 /*
302 * This set of fields are used as parameters passed from the
303 * layered framebuffer driver to the terminal emulator.
304 */
305 int version; /* Console IO interface version */
306 screen_size_t width; /* Width of the device */
307 screen_size_t height; /* Height of the device */
308 screen_size_t linebytes; /* Bytes per scan line */
309 int depth; /* Device depth */
310 color_map_fn_t color_map; /* Color map tem -> fb */
311 short mode; /* Mode to use when displaying data */
312 struct vis_polledio *polledio; /* Polled output routines */
313
314 /*
315 * The following fields are used as parameters passed from the
316 * terminal emulator to the underlying framebuffer driver.
317 */
318 vis_modechg_cb_t modechg_cb; /* Video mode change callback */
319 struct vis_modechg_arg *modechg_arg; /* Mode change cb arg */
320 };
321
322 #endif /* _KERNEL || _BOOT */
323
324 #ifdef __cplusplus
325 }
326 #endif
327
328 #endif /* !_SYS_VISUAL_IO_H */
|