hpcfbio.h revision 1.1.4.2 1 1.1.4.2 bouyer /* $NetBSD: hpcfbio.h,v 1.1.4.2 2001/03/12 13:30:06 bouyer Exp $ */
2 1.1.4.2 bouyer
3 1.1.4.2 bouyer /*-
4 1.1.4.2 bouyer * Copyright (c) 1999
5 1.1.4.2 bouyer * Shin Takemura and PocketBSD Project. All rights reserved.
6 1.1.4.2 bouyer *
7 1.1.4.2 bouyer * Redistribution and use in source and binary forms, with or without
8 1.1.4.2 bouyer * modification, are permitted provided that the following conditions
9 1.1.4.2 bouyer * are met:
10 1.1.4.2 bouyer * 1. Redistributions of source code must retain the above copyright
11 1.1.4.2 bouyer * notice, this list of conditions and the following disclaimer.
12 1.1.4.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.4.2 bouyer * notice, this list of conditions and the following disclaimer in the
14 1.1.4.2 bouyer * documentation and/or other materials provided with the distribution.
15 1.1.4.2 bouyer * 3. All advertising materials mentioning features or use of this software
16 1.1.4.2 bouyer * must display the following acknowledgement:
17 1.1.4.2 bouyer * This product includes software developed by the PocketBSD project
18 1.1.4.2 bouyer * and its contributors.
19 1.1.4.2 bouyer * 4. Neither the name of the project nor the names of its contributors
20 1.1.4.2 bouyer * may be used to endorse or promote products derived from this software
21 1.1.4.2 bouyer * without specific prior written permission.
22 1.1.4.2 bouyer *
23 1.1.4.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1.4.2 bouyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1.4.2 bouyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1.4.2 bouyer * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1.4.2 bouyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1.4.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1.4.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1.4.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1.4.2 bouyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1.4.2 bouyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1.4.2 bouyer * SUCH DAMAGE.
34 1.1.4.2 bouyer *
35 1.1.4.2 bouyer */
36 1.1.4.2 bouyer
37 1.1.4.2 bouyer #ifndef H_HPCFBIO
38 1.1.4.2 bouyer #define H_HPCFBIO
39 1.1.4.2 bouyer
40 1.1.4.2 bouyer #include <sys/types.h>
41 1.1.4.2 bouyer #include <sys/ioccom.h>
42 1.1.4.2 bouyer
43 1.1.4.2 bouyer #define HPCFB_MAXNAMELEN 32
44 1.1.4.2 bouyer #define HPCFB_DEFAULT_CONFIG 0
45 1.1.4.2 bouyer #define HPCFB_CURRENT_CONFIG -1
46 1.1.4.2 bouyer #define HPCFB_DEFAULT_UNIT 0
47 1.1.4.2 bouyer #define HPCFB_CURRENT_UNIT -1
48 1.1.4.2 bouyer
49 1.1.4.2 bouyer #define HPCFB_CLASS_UNKNOWN 0 /* unknown class */
50 1.1.4.2 bouyer #define HPCFB_CLASS_GRAYSCALE 1 /* gray scale (maybe monochrome)*/
51 1.1.4.2 bouyer #define HPCFB_CLASS_INDEXCOLOR 2 /* index color */
52 1.1.4.2 bouyer #define HPCFB_CLASS_RGBCOLOR 3 /* RGB color */
53 1.1.4.2 bouyer
54 1.1.4.2 bouyer #define HPCFB_ACCESS_CACHEABLE (1<<0) /* cacheable */
55 1.1.4.2 bouyer #define HPCFB_ACCESS_BYTE (1<<1) /* permit 8 bit access */
56 1.1.4.2 bouyer #define HPCFB_ACCESS_WORD (1<<2) /* permit 16 bit access */
57 1.1.4.2 bouyer #define HPCFB_ACCESS_3BYTE (1<<3) /* permit 3 bytes access */
58 1.1.4.2 bouyer #define HPCFB_ACCESS_DWORD (1<<4) /* permit 32 bit access */
59 1.1.4.2 bouyer #define HPCFB_ACCESS_5BYTE (1<<5) /* permit 5 bytes access */
60 1.1.4.2 bouyer #define HPCFB_ACCESS_6BYTE (1<<6) /* permit 6 bytes access */
61 1.1.4.2 bouyer #define HPCFB_ACCESS_7BYTE (1<<7) /* permit 7 bytes access */
62 1.1.4.2 bouyer #define HPCFB_ACCESS_QWORD (1<<8) /* permit 64 bit access */
63 1.1.4.2 bouyer #define HPCFB_ACCESS_9BYTE (1<<9) /* permit 9 bytes access */
64 1.1.4.2 bouyer #define HPCFB_ACCESS_10BYTE (1<<10) /* permit 10 bytes access */
65 1.1.4.2 bouyer #define HPCFB_ACCESS_11BYTE (1<<11) /* permit 11 bytes access */
66 1.1.4.2 bouyer #define HPCFB_ACCESS_12BYTE (1<<12) /* permit 12 bytes access */
67 1.1.4.2 bouyer #define HPCFB_ACCESS_13BYTE (1<<13) /* permit 13 bytes access */
68 1.1.4.2 bouyer #define HPCFB_ACCESS_14BYTE (1<<14) /* permit 14 bytes access */
69 1.1.4.2 bouyer #define HPCFB_ACCESS_15BYTE (1<<15) /* permit 15 bytes access */
70 1.1.4.2 bouyer #define HPCFB_ACCESS_OWORD (1<<16) /* permit 128 bit access */
71 1.1.4.2 bouyer
72 1.1.4.2 bouyer #define HPCFB_ACCESS_LSB_TO_MSB (1<<17) /* first pixel is at LSB side */
73 1.1.4.2 bouyer #define HPCFB_ACCESS_R_TO_L (1<<18) /* pixel order is right to left */
74 1.1.4.2 bouyer #define HPCFB_ACCESS_B_TO_T (1<<19) /* pixel order is bottom to top */
75 1.1.4.2 bouyer #define HPCFB_ACCESS_Y_TO_X (1<<20) /* pixel ordef is Y to X */
76 1.1.4.2 bouyer #define HPCFB_ACCESS_STATIC (1<<21) /* no translation table */
77 1.1.4.2 bouyer #define HPCFB_ACCESS_REVERSE (1<<22) /* value 0 means white */
78 1.1.4.2 bouyer #define HPCFB_ACCESS_PACK_BLANK (1<<23) /* pack has a blank at MSB */
79 1.1.4.2 bouyer #define HPCFB_ACCESS_PIXEL_BLANK (1<<24)/* pixel has a blank at MSB */
80 1.1.4.2 bouyer #define HPCFB_ACCESS_ALPHA_REVERSE (1<<25) /* alpha value 0 means thick */
81 1.1.4.2 bouyer
82 1.1.4.2 bouyer #define HPCFB_SWAP_BYTE (1<<0)
83 1.1.4.2 bouyer #define HPCFB_SWAP_WORD (1<<1)
84 1.1.4.2 bouyer #define HPCFB_SWAP_DWORD (1<<2)
85 1.1.4.2 bouyer #define HPCFB_SWAP_QWORD (1<<3)
86 1.1.4.2 bouyer
87 1.1.4.2 bouyer struct hpcfb_fbconf {
88 1.1.4.2 bouyer short hf_conf_index; /* configuration index */
89 1.1.4.2 bouyer short hf_nconfs; /* how many configurations */
90 1.1.4.2 bouyer
91 1.1.4.2 bouyer short hf_class; /* HPCFB_CLASS_* */
92 1.1.4.2 bouyer
93 1.1.4.2 bouyer char hf_name[HPCFB_MAXNAMELEN];
94 1.1.4.2 bouyer /* frame buffer name, null terminated*/
95 1.1.4.2 bouyer char hf_conf_name[HPCFB_MAXNAMELEN];
96 1.1.4.2 bouyer /* config name, null terminated */
97 1.1.4.2 bouyer
98 1.1.4.2 bouyer short hf_height; /* how many lines */
99 1.1.4.2 bouyer short hf_width; /* how many pixels in a line */
100 1.1.4.2 bouyer
101 1.1.4.2 bouyer u_long hf_baseaddr; /* frame buffer start address */
102 1.1.4.2 bouyer u_long hf_offset; /* frame buffer start offset for mmap*/
103 1.1.4.2 bouyer short hf_bytes_per_line; /**/
104 1.1.4.2 bouyer short hf_nplanes; /**/
105 1.1.4.2 bouyer long hf_bytes_per_plane; /**/
106 1.1.4.2 bouyer
107 1.1.4.2 bouyer short hf_pack_width; /* how many bits in a pack */
108 1.1.4.2 bouyer short hf_pixels_per_pack; /* how many pixels in a pack */
109 1.1.4.2 bouyer short hf_pixel_width; /* effective bits width */
110 1.1.4.2 bouyer
111 1.1.4.2 bouyer u_long hf_access_flags; /* HPCFB_ACCESS_* */
112 1.1.4.2 bouyer u_long hf_swap_flags; /* HPCFB_SWAP_* */
113 1.1.4.2 bouyer u_long hf_reg_offset; /* hardware register offset for mmap */
114 1.1.4.2 bouyer u_long hf_reserved[3];
115 1.1.4.2 bouyer
116 1.1.4.2 bouyer /*
117 1.1.4.2 bouyer * class dependend data
118 1.1.4.2 bouyer */
119 1.1.4.2 bouyer short hf_class_data_length;
120 1.1.4.2 bouyer union {
121 1.1.4.2 bouyer char hf_place_holder[128];
122 1.1.4.2 bouyer struct hf_gray_tag {
123 1.1.4.2 bouyer u_long hf_flags; /* reserved for future use */
124 1.1.4.2 bouyer } hf_gray;
125 1.1.4.2 bouyer struct hf_indexed_tag {
126 1.1.4.2 bouyer u_long hf_flags; /* reserved for future use */
127 1.1.4.2 bouyer } hf_indexed;
128 1.1.4.2 bouyer struct hf_rgb_tag {
129 1.1.4.2 bouyer u_long hf_flags; /* reserved for future use */
130 1.1.4.2 bouyer
131 1.1.4.2 bouyer short hf_red_width;
132 1.1.4.2 bouyer short hf_red_shift;
133 1.1.4.2 bouyer short hf_green_width;
134 1.1.4.2 bouyer short hf_green_shift;
135 1.1.4.2 bouyer short hf_blue_width;
136 1.1.4.2 bouyer short hf_blue_shift;
137 1.1.4.2 bouyer short hf_alpha_width;
138 1.1.4.2 bouyer short hf_alpha_shift;
139 1.1.4.2 bouyer } hf_rgb;
140 1.1.4.2 bouyer } hf_u;
141 1.1.4.2 bouyer
142 1.1.4.2 bouyer /*
143 1.1.4.2 bouyer * extended data for future use
144 1.1.4.2 bouyer */
145 1.1.4.2 bouyer int hf_ext_size; /* this value is 0 */
146 1.1.4.2 bouyer void *hf_ext_data; /* this value is NULL */
147 1.1.4.2 bouyer };
148 1.1.4.2 bouyer
149 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_UNKNOWN 0 /* unknown display type */
150 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_COLORCRT 1 /* color CRT */
151 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_COLORLCD 2 /* color LCD */
152 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_GRAYCRT 3 /* gray or mono CRT */
153 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_GRAYLCD 4 /* gray or mono LCD */
154 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_EXTERNAL 5 /* external output */
155 1.1.4.2 bouyer #define HPCFB_DSP_CLASS_VIDEO 6 /* external video output*/
156 1.1.4.2 bouyer
157 1.1.4.2 bouyer #define HPCFB_DSP_DPI_UNKNOWN 0
158 1.1.4.2 bouyer
159 1.1.4.2 bouyer struct hpcfb_dspconf {
160 1.1.4.2 bouyer short hd_unit_index; /* display unit index */
161 1.1.4.2 bouyer short hd_nunits; /* how many display units */
162 1.1.4.2 bouyer
163 1.1.4.2 bouyer short hd_class; /* HPCFB_DSP_CLASS_* */
164 1.1.4.2 bouyer char hd_name[HPCFB_MAXNAMELEN];
165 1.1.4.2 bouyer /* display name */
166 1.1.4.2 bouyer
167 1.1.4.2 bouyer unsigned long hd_op_flags;
168 1.1.4.2 bouyer unsigned long hd_reserved[3];
169 1.1.4.2 bouyer
170 1.1.4.2 bouyer short hd_conf_index; /* configuration index */
171 1.1.4.2 bouyer short hd_nconfs; /* how many configurations */
172 1.1.4.2 bouyer char hd_conf_name[HPCFB_MAXNAMELEN];
173 1.1.4.2 bouyer /* configuration name */
174 1.1.4.2 bouyer short hd_width;
175 1.1.4.2 bouyer short hd_height;
176 1.1.4.2 bouyer short hd_xdpi;
177 1.1.4.2 bouyer short hd_ydpi;
178 1.1.4.2 bouyer
179 1.1.4.2 bouyer };
180 1.1.4.2 bouyer
181 1.1.4.2 bouyer struct hpcfb_dsp_op {
182 1.1.4.2 bouyer short op;
183 1.1.4.2 bouyer long args[4];
184 1.1.4.2 bouyer short ext_size;
185 1.1.4.2 bouyer void *ext_arg;
186 1.1.4.2 bouyer };
187 1.1.4.2 bouyer
188 1.1.4.2 bouyer /*
189 1.1.4.2 bouyer * view port postion
190 1.1.4.2 bouyer * arg0 is x_offset
191 1.1.4.2 bouyer * arg1 is y_offset
192 1.1.4.2 bouyer */
193 1.1.4.2 bouyer #define HPCFB_DSP_OP_VIEW 0
194 1.1.4.2 bouyer
195 1.1.4.2 bouyer /*
196 1.1.4.2 bouyer * display settings
197 1.1.4.2 bouyer * arg0 is bright;
198 1.1.4.2 bouyer * arg1 is contrast;
199 1.1.4.2 bouyer */
200 1.1.4.2 bouyer #define HPCFB_DSP_OP_BRIGHT 1
201 1.1.4.2 bouyer
202 1.1.4.2 bouyer /*
203 1.1.4.2 bouyer * power state
204 1.1.4.2 bouyer * arg0 is power state
205 1.1.4.2 bouyer */
206 1.1.4.2 bouyer #define HPCFB_DSP_OP_POWER 2
207 1.1.4.2 bouyer #define HPCFB_DSP_PW_ON 0 /* full power */
208 1.1.4.2 bouyer #define HPCFB_DSP_PW_SAVE 10 /* power save mode, but not blank */
209 1.1.4.2 bouyer #define HPCFB_DSP_PW_CUT 20 /* power save mode, screen is blank */
210 1.1.4.2 bouyer #define HPCFB_DSP_PW_OFF 30 /* power off */
211 1.1.4.2 bouyer
212 1.1.4.2 bouyer /*
213 1.1.4.2 bouyer * output signal settings
214 1.1.4.2 bouyer * ext_arg is struct hpcfb_dsp_signal
215 1.1.4.2 bouyer */
216 1.1.4.2 bouyer #define HPCFB_DSP_OP_SIGNAL 3
217 1.1.4.2 bouyer #define HPCFB_DSP_SIG_H_SYNC_HIGH (1<<0)
218 1.1.4.2 bouyer #define HPCFB_DSP_SIG_V_SYNC_HIGH (1<<1)
219 1.1.4.2 bouyer #define HPCFB_DSP_SIG_C_SYNC_HIGH (1<<2)
220 1.1.4.2 bouyer #define HPCFB_DSP_SIG_SYNC_EXT (1<<3)
221 1.1.4.2 bouyer #define HPCFB_DSP_SIG_SYNC_GREEN (1<<4)
222 1.1.4.2 bouyer struct hpcfb_dsp_signal {
223 1.1.4.2 bouyer unsigned long flags;
224 1.1.4.2 bouyer long pixclock; /* pixel clock in pico seconds */
225 1.1.4.2 bouyer long left_margin; /* time from H sync to picture */
226 1.1.4.2 bouyer long right_margin; /* time from picture to H sync */
227 1.1.4.2 bouyer long upper_margin; /* time from V sync to picture */
228 1.1.4.2 bouyer long lower_margin; /* time from picture to V sync */
229 1.1.4.2 bouyer long hsync_len; /* length of H sync */
230 1.1.4.2 bouyer long vsync_len; /* length of V sync */
231 1.1.4.2 bouyer };
232 1.1.4.2 bouyer
233 1.1.4.2 bouyer #define HPCFBIO_GCONF _IOWR('H', 0, struct hpcfb_fbconf)
234 1.1.4.2 bouyer #define HPCFBIO_SCONF _IOW('H', 1, struct hpcfb_fbconf)
235 1.1.4.2 bouyer #define HPCFBIO_GDSPCONF _IOWR('H', 2, struct hpcfb_dspconf)
236 1.1.4.2 bouyer #define HPCFBIO_SDSPCONF _IOW('H', 3, struct hpcfb_dspconf)
237 1.1.4.2 bouyer #define HPCFBIO_GOP _IOR('H', 4, struct hpcfb_dsp_op)
238 1.1.4.2 bouyer #define HPCFBIO_SOP _IOWR('H', 5, struct hpcfb_dsp_op)
239 1.1.4.2 bouyer
240 1.1.4.2 bouyer #endif /* H_HPCFBIO */
241