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