1*146d03e6Sandvar /* $NetBSD: hpcfbio.h,v 1.4 2022/04/08 10:27:04 andvar Exp $ */ 2659f65e0Such 3659f65e0Such /*- 4659f65e0Such * Copyright (c) 1999 5659f65e0Such * Shin Takemura and PocketBSD Project. All rights reserved. 6659f65e0Such * 7659f65e0Such * Redistribution and use in source and binary forms, with or without 8659f65e0Such * modification, are permitted provided that the following conditions 9659f65e0Such * are met: 10659f65e0Such * 1. Redistributions of source code must retain the above copyright 11659f65e0Such * notice, this list of conditions and the following disclaimer. 12659f65e0Such * 2. Redistributions in binary form must reproduce the above copyright 13659f65e0Such * notice, this list of conditions and the following disclaimer in the 14659f65e0Such * documentation and/or other materials provided with the distribution. 15659f65e0Such * 3. All advertising materials mentioning features or use of this software 16659f65e0Such * must display the following acknowledgement: 17659f65e0Such * This product includes software developed by the PocketBSD project 18659f65e0Such * and its contributors. 19659f65e0Such * 4. Neither the name of the project nor the names of its contributors 20659f65e0Such * may be used to endorse or promote products derived from this software 21659f65e0Such * without specific prior written permission. 22659f65e0Such * 23659f65e0Such * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24659f65e0Such * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25659f65e0Such * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26659f65e0Such * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27659f65e0Such * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28659f65e0Such * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29659f65e0Such * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30659f65e0Such * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31659f65e0Such * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32659f65e0Such * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33659f65e0Such * SUCH DAMAGE. 34659f65e0Such * 35659f65e0Such */ 36659f65e0Such 37659f65e0Such #ifndef H_HPCFBIO 38659f65e0Such #define H_HPCFBIO 39659f65e0Such 40659f65e0Such #include <sys/types.h> 41659f65e0Such #include <sys/ioccom.h> 42659f65e0Such 43659f65e0Such #define HPCFB_MAXNAMELEN 32 44659f65e0Such #define HPCFB_DEFAULT_CONFIG 0 45659f65e0Such #define HPCFB_CURRENT_CONFIG -1 46659f65e0Such #define HPCFB_DEFAULT_UNIT 0 47659f65e0Such #define HPCFB_CURRENT_UNIT -1 48659f65e0Such 49659f65e0Such #define HPCFB_CLASS_UNKNOWN 0 /* unknown class */ 50659f65e0Such #define HPCFB_CLASS_GRAYSCALE 1 /* gray scale (maybe monochrome)*/ 51659f65e0Such #define HPCFB_CLASS_INDEXCOLOR 2 /* index color */ 52659f65e0Such #define HPCFB_CLASS_RGBCOLOR 3 /* RGB color */ 53659f65e0Such 54659f65e0Such #define HPCFB_ACCESS_CACHEABLE (1<<0) /* cacheable */ 55659f65e0Such #define HPCFB_ACCESS_BYTE (1<<1) /* permit 8 bit access */ 56659f65e0Such #define HPCFB_ACCESS_WORD (1<<2) /* permit 16 bit access */ 57659f65e0Such #define HPCFB_ACCESS_3BYTE (1<<3) /* permit 3 bytes access */ 58659f65e0Such #define HPCFB_ACCESS_DWORD (1<<4) /* permit 32 bit access */ 59659f65e0Such #define HPCFB_ACCESS_5BYTE (1<<5) /* permit 5 bytes access */ 60659f65e0Such #define HPCFB_ACCESS_6BYTE (1<<6) /* permit 6 bytes access */ 61659f65e0Such #define HPCFB_ACCESS_7BYTE (1<<7) /* permit 7 bytes access */ 62659f65e0Such #define HPCFB_ACCESS_QWORD (1<<8) /* permit 64 bit access */ 63659f65e0Such #define HPCFB_ACCESS_9BYTE (1<<9) /* permit 9 bytes access */ 64659f65e0Such #define HPCFB_ACCESS_10BYTE (1<<10) /* permit 10 bytes access */ 65659f65e0Such #define HPCFB_ACCESS_11BYTE (1<<11) /* permit 11 bytes access */ 66659f65e0Such #define HPCFB_ACCESS_12BYTE (1<<12) /* permit 12 bytes access */ 67659f65e0Such #define HPCFB_ACCESS_13BYTE (1<<13) /* permit 13 bytes access */ 68659f65e0Such #define HPCFB_ACCESS_14BYTE (1<<14) /* permit 14 bytes access */ 69659f65e0Such #define HPCFB_ACCESS_15BYTE (1<<15) /* permit 15 bytes access */ 70659f65e0Such #define HPCFB_ACCESS_OWORD (1<<16) /* permit 128 bit access */ 71659f65e0Such 72659f65e0Such #define HPCFB_ACCESS_LSB_TO_MSB (1<<17) /* first pixel is at LSB side */ 73659f65e0Such #define HPCFB_ACCESS_R_TO_L (1<<18) /* pixel order is right to left */ 74659f65e0Such #define HPCFB_ACCESS_B_TO_T (1<<19) /* pixel order is bottom to top */ 75659f65e0Such #define HPCFB_ACCESS_Y_TO_X (1<<20) /* pixel ordef is Y to X */ 76659f65e0Such #define HPCFB_ACCESS_STATIC (1<<21) /* no translation table */ 77659f65e0Such #define HPCFB_ACCESS_REVERSE (1<<22) /* value 0 means white */ 78659f65e0Such #define HPCFB_ACCESS_PACK_BLANK (1<<23) /* pack has a blank at MSB */ 79659f65e0Such #define HPCFB_ACCESS_PIXEL_BLANK (1<<24)/* pixel has a blank at MSB */ 80659f65e0Such #define HPCFB_ACCESS_ALPHA_REVERSE (1<<25) /* alpha value 0 means thick */ 81659f65e0Such 8264b6b76aStakemura /* 8364b6b76aStakemura * These bits mean that pack data should be stored in reverse order on 8464b6b76aStakemura * memory. 8564b6b76aStakemura * 8664b6b76aStakemura * HPCFB_REVORDER_BYTE: 0x00 0x01 8764b6b76aStakemura * +----+-----+ 8864b6b76aStakemura * |7..0|15..8| 8964b6b76aStakemura * +----+-----+ 9064b6b76aStakemura * HPCFB_REVORDER_WORD: 0x00 0x02 9164b6b76aStakemura * +----+-----+----+----+ 9264b6b76aStakemura * |15..0 |31..15 | 9364b6b76aStakemura * +----+-----+----+----+ 9464b6b76aStakemura * HPCFB_REVORDER_DWORD: 0x00 0x04 9564b6b76aStakemura * +----+-----+----+----+----+----+----+----+ 9664b6b76aStakemura * |31..0 |63..32 | 9764b6b76aStakemura * +----+-----+----+----+----+----+----+----+ 9864b6b76aStakemura * HPCFB_REVORDER_QWORD: 0x00 0x08 9964b6b76aStakemura * +----+-----+----+----~----+----+----+----~----+ 10064b6b76aStakemura * |63..0 |127..64 | 10164b6b76aStakemura * +----+-----+----+----~----+----+----+----~----+ 10264b6b76aStakemura */ 10364b6b76aStakemura #define HPCFB_REVORDER_BYTE (1<<0) 10464b6b76aStakemura #define HPCFB_REVORDER_WORD (1<<1) 10564b6b76aStakemura #define HPCFB_REVORDER_DWORD (1<<2) 10664b6b76aStakemura #define HPCFB_REVORDER_QWORD (1<<3) 107659f65e0Such 108659f65e0Such struct hpcfb_fbconf { 109659f65e0Such short hf_conf_index; /* configuration index */ 110659f65e0Such short hf_nconfs; /* how many configurations */ 111659f65e0Such 112659f65e0Such short hf_class; /* HPCFB_CLASS_* */ 113659f65e0Such 114659f65e0Such char hf_name[HPCFB_MAXNAMELEN]; 115659f65e0Such /* frame buffer name, null terminated*/ 116659f65e0Such char hf_conf_name[HPCFB_MAXNAMELEN]; 117659f65e0Such /* config name, null terminated */ 118659f65e0Such 119659f65e0Such short hf_height; /* how many lines */ 120659f65e0Such short hf_width; /* how many pixels in a line */ 121659f65e0Such 122659f65e0Such u_long hf_baseaddr; /* frame buffer start address */ 123659f65e0Such u_long hf_offset; /* frame buffer start offset for mmap*/ 124659f65e0Such short hf_bytes_per_line; /**/ 125659f65e0Such short hf_nplanes; /**/ 126659f65e0Such long hf_bytes_per_plane; /**/ 127659f65e0Such 128659f65e0Such short hf_pack_width; /* how many bits in a pack */ 129659f65e0Such short hf_pixels_per_pack; /* how many pixels in a pack */ 130659f65e0Such short hf_pixel_width; /* effective bits width */ 131659f65e0Such 132659f65e0Such u_long hf_access_flags; /* HPCFB_ACCESS_* */ 13364b6b76aStakemura u_long hf_order_flags; /* HPCFB_REVORDER_* */ 134659f65e0Such u_long hf_reg_offset; /* hardware register offset for mmap */ 135659f65e0Such u_long hf_reserved[3]; 136659f65e0Such 137659f65e0Such /* 138e16cbc38Sandvar * class dependent data 139659f65e0Such */ 140659f65e0Such short hf_class_data_length; 141659f65e0Such union { 142659f65e0Such char hf_place_holder[128]; 143659f65e0Such struct hf_gray_tag { 144659f65e0Such u_long hf_flags; /* reserved for future use */ 145659f65e0Such } hf_gray; 146659f65e0Such struct hf_indexed_tag { 147659f65e0Such u_long hf_flags; /* reserved for future use */ 148659f65e0Such } hf_indexed; 149659f65e0Such struct hf_rgb_tag { 150659f65e0Such u_long hf_flags; /* reserved for future use */ 151659f65e0Such 152659f65e0Such short hf_red_width; 153659f65e0Such short hf_red_shift; 154659f65e0Such short hf_green_width; 155659f65e0Such short hf_green_shift; 156659f65e0Such short hf_blue_width; 157659f65e0Such short hf_blue_shift; 158659f65e0Such short hf_alpha_width; 159659f65e0Such short hf_alpha_shift; 160659f65e0Such } hf_rgb; 161659f65e0Such } hf_u; 162659f65e0Such 163659f65e0Such /* 164659f65e0Such * extended data for future use 165659f65e0Such */ 166659f65e0Such int hf_ext_size; /* this value is 0 */ 167659f65e0Such void *hf_ext_data; /* this value is NULL */ 168659f65e0Such }; 169659f65e0Such 170659f65e0Such #define HPCFB_DSP_CLASS_UNKNOWN 0 /* unknown display type */ 171659f65e0Such #define HPCFB_DSP_CLASS_COLORCRT 1 /* color CRT */ 172659f65e0Such #define HPCFB_DSP_CLASS_COLORLCD 2 /* color LCD */ 173659f65e0Such #define HPCFB_DSP_CLASS_GRAYCRT 3 /* gray or mono CRT */ 174659f65e0Such #define HPCFB_DSP_CLASS_GRAYLCD 4 /* gray or mono LCD */ 175659f65e0Such #define HPCFB_DSP_CLASS_EXTERNAL 5 /* external output */ 176659f65e0Such #define HPCFB_DSP_CLASS_VIDEO 6 /* external video output*/ 177659f65e0Such 178659f65e0Such #define HPCFB_DSP_DPI_UNKNOWN 0 179659f65e0Such 180659f65e0Such struct hpcfb_dspconf { 181659f65e0Such short hd_unit_index; /* display unit index */ 182659f65e0Such short hd_nunits; /* how many display units */ 183659f65e0Such 184659f65e0Such short hd_class; /* HPCFB_DSP_CLASS_* */ 185659f65e0Such char hd_name[HPCFB_MAXNAMELEN]; 186659f65e0Such /* display name */ 187659f65e0Such 188659f65e0Such unsigned long hd_op_flags; 189659f65e0Such unsigned long hd_reserved[3]; 190659f65e0Such 191659f65e0Such short hd_conf_index; /* configuration index */ 192659f65e0Such short hd_nconfs; /* how many configurations */ 193659f65e0Such char hd_conf_name[HPCFB_MAXNAMELEN]; 194659f65e0Such /* configuration name */ 195659f65e0Such short hd_width; 196659f65e0Such short hd_height; 197659f65e0Such short hd_xdpi; 198659f65e0Such short hd_ydpi; 199659f65e0Such 200659f65e0Such }; 201659f65e0Such 202659f65e0Such struct hpcfb_dsp_op { 203659f65e0Such short op; 204659f65e0Such long args[4]; 205659f65e0Such short ext_size; 206659f65e0Such void *ext_arg; 207659f65e0Such }; 208659f65e0Such 209659f65e0Such /* 210*146d03e6Sandvar * view port position 211659f65e0Such * arg0 is x_offset 212659f65e0Such * arg1 is y_offset 213659f65e0Such */ 214659f65e0Such #define HPCFB_DSP_OP_VIEW 0 215659f65e0Such 216659f65e0Such /* 217659f65e0Such * display settings 218659f65e0Such * arg0 is bright; 219659f65e0Such * arg1 is contrast; 220659f65e0Such */ 221659f65e0Such #define HPCFB_DSP_OP_BRIGHT 1 222659f65e0Such 223659f65e0Such /* 224659f65e0Such * power state 225659f65e0Such * arg0 is power state 226659f65e0Such */ 227659f65e0Such #define HPCFB_DSP_OP_POWER 2 228659f65e0Such #define HPCFB_DSP_PW_ON 0 /* full power */ 229659f65e0Such #define HPCFB_DSP_PW_SAVE 10 /* power save mode, but not blank */ 230659f65e0Such #define HPCFB_DSP_PW_CUT 20 /* power save mode, screen is blank */ 231659f65e0Such #define HPCFB_DSP_PW_OFF 30 /* power off */ 232659f65e0Such 233659f65e0Such /* 234659f65e0Such * output signal settings 235659f65e0Such * ext_arg is struct hpcfb_dsp_signal 236659f65e0Such */ 237659f65e0Such #define HPCFB_DSP_OP_SIGNAL 3 238659f65e0Such #define HPCFB_DSP_SIG_H_SYNC_HIGH (1<<0) 239659f65e0Such #define HPCFB_DSP_SIG_V_SYNC_HIGH (1<<1) 240659f65e0Such #define HPCFB_DSP_SIG_C_SYNC_HIGH (1<<2) 241659f65e0Such #define HPCFB_DSP_SIG_SYNC_EXT (1<<3) 242659f65e0Such #define HPCFB_DSP_SIG_SYNC_GREEN (1<<4) 243659f65e0Such struct hpcfb_dsp_signal { 244659f65e0Such unsigned long flags; 245659f65e0Such long pixclock; /* pixel clock in pico seconds */ 246659f65e0Such long left_margin; /* time from H sync to picture */ 247659f65e0Such long right_margin; /* time from picture to H sync */ 248659f65e0Such long upper_margin; /* time from V sync to picture */ 249659f65e0Such long lower_margin; /* time from picture to V sync */ 250659f65e0Such long hsync_len; /* length of H sync */ 251659f65e0Such long vsync_len; /* length of V sync */ 252659f65e0Such }; 253659f65e0Such 254659f65e0Such #define HPCFBIO_GCONF _IOWR('H', 0, struct hpcfb_fbconf) 255659f65e0Such #define HPCFBIO_SCONF _IOW('H', 1, struct hpcfb_fbconf) 256659f65e0Such #define HPCFBIO_GDSPCONF _IOWR('H', 2, struct hpcfb_dspconf) 257659f65e0Such #define HPCFBIO_SDSPCONF _IOW('H', 3, struct hpcfb_dspconf) 258659f65e0Such #define HPCFBIO_GOP _IOR('H', 4, struct hpcfb_dsp_op) 259659f65e0Such #define HPCFBIO_SOP _IOWR('H', 5, struct hpcfb_dsp_op) 260659f65e0Such 261659f65e0Such #endif /* H_HPCFBIO */ 262