xref: /netbsd-src/sys/dev/hpc/video_subr.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: video_subr.h,v 1.5 2008/04/28 20:23:48 martin Exp $	*/
2659f65e0Such 
3659f65e0Such /*-
4659f65e0Such  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5659f65e0Such  * All rights reserved.
6659f65e0Such  *
7659f65e0Such  * This code is derived from software contributed to The NetBSD Foundation
8659f65e0Such  * by UCHIYAMA Yasushi.
9659f65e0Such  *
10659f65e0Such  * Redistribution and use in source and binary forms, with or without
11659f65e0Such  * modification, are permitted provided that the following conditions
12659f65e0Such  * are met:
13659f65e0Such  * 1. Redistributions of source code must retain the above copyright
14659f65e0Such  *    notice, this list of conditions and the following disclaimer.
15659f65e0Such  * 2. Redistributions in binary form must reproduce the above copyright
16659f65e0Such  *    notice, this list of conditions and the following disclaimer in the
17659f65e0Such  *    documentation and/or other materials provided with the distribution.
18659f65e0Such  *
19659f65e0Such  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20659f65e0Such  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21659f65e0Such  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22659f65e0Such  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23659f65e0Such  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24659f65e0Such  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25659f65e0Such  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26659f65e0Such  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27659f65e0Such  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28659f65e0Such  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29659f65e0Such  * POSSIBILITY OF SUCH DAMAGE.
30659f65e0Such  */
31659f65e0Such 
32659f65e0Such #define LEGAL_CLUT_INDEX(x)	((x) >= 0 && (x) <= 255)
33659f65e0Such #define RGB24(r, g, b)		((((r) << 16) & 0x00ff0000) |		\
34659f65e0Such 				 (((g) << 8) & 0x0000ff00) |		\
35659f65e0Such 				 (((b)) & 0x000000ff))
36659f65e0Such 
37659f65e0Such int cmap_work_alloc(u_int8_t **, u_int8_t **, u_int8_t **, u_int32_t **, int);
38659f65e0Such void cmap_work_free(u_int8_t *, u_int8_t *, u_int8_t *, u_int32_t *);
39659f65e0Such void rgb24_compose(u_int32_t *, u_int8_t *, u_int8_t *, u_int8_t *, int);
40659f65e0Such void rgb24_decompose(u_int32_t *, u_int8_t *, u_int8_t *, u_int8_t *, int);
41659f65e0Such 
42659f65e0Such /* debug function */
43659f65e0Such struct video_chip;
44659f65e0Such struct video_chip {
45659f65e0Such 	void *vc_v; /* CPU/chipset dependent goo */
46659f65e0Such 
47659f65e0Such 	vaddr_t vc_fbvaddr;
48659f65e0Such 	paddr_t vc_fbpaddr;
49659f65e0Such 	size_t vc_fbsize;
50659f65e0Such 	int vc_fbdepth;
51659f65e0Such 	int vc_fbwidth;
52659f65e0Such 	int vc_fbheight;
53b596bfa2Such 	int vc_reverse;
54659f65e0Such 
55659f65e0Such 	void (*vc_drawline)(struct video_chip *, int, int, int, int);
56659f65e0Such 	void (*vc_drawdot)(struct video_chip *, int, int);
57659f65e0Such };
58659f65e0Such 
59659f65e0Such void video_attach_drawfunc(struct video_chip *);
60659f65e0Such void video_line(struct video_chip *, int, int, int, int);
61659f65e0Such void video_dot(struct video_chip *, int, int);
62659f65e0Such void video_calibration_pattern(struct video_chip *);
63659f65e0Such int video_reverse_color(void);
64