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