xref: /netbsd-src/sys/arch/luna68k/dev/omrasopsvar.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /* $NetBSD: omrasopsvar.h,v 1.3 2014/10/04 16:58:17 tsutsui Exp $ */
2 /*
3  * Copyright (c) 2013 Kenji Aoyama
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /*
19  * Base addresses of LUNA's frame buffer
20  * XXX: We consider only 1bpp and 4bpp for now
21  */
22 
23 #define OMFB_PLANEMASK	0xB1040000	/* BMSEL register */
24 #define OMFB_FB_WADDR	0xB1080008	/* common plane */
25 #define OMFB_FB_RADDR	0xB10C0008	/* plane #0 */
26 #define OMFB_ROPFUNC	0xB12C0000	/* common ROP function */
27 
28 /*
29  * Helper macros
30  */
31 #define W(addr)  ((uint32_t *)(addr))
32 #define R(addr)  ((uint32_t *)((uint8_t *)(addr) +  0x40000))
33 #define P0(addr) ((uint32_t *)((uint8_t *)(addr) +  0x40000))
34 #define P1(addr) ((uint32_t *)((uint8_t *)(addr) +  0x80000))
35 #define P2(addr) ((uint32_t *)((uint8_t *)(addr) +  0xC0000))
36 #define P3(addr) ((uint32_t *)((uint8_t *)(addr) + 0x100000))
37 
38 /*
39  * ROP function
40  *
41  * LUNA's frame buffer uses Hitach HM53462 video RAM, which has raster
42  * (logic) operation, or ROP, function.  To use ROP function on LUNA, write
43  * a 32bit `mask' value to the specified address corresponding to each ROP
44  * logic.
45  *
46  * D: the data writing to the video RAM
47  * M: the data already stored on the video RAM
48  */
49 
50 /* operation		index	the video RAM contents will be */
51 #define ROP_ZERO	 0	/* all 0	*/
52 #define ROP_AND1	 1	/* D & M	*/
53 #define ROP_AND2	 2	/* ~D & M	*/
54 /* Not used on LUNA	 3			*/
55 #define ROP_AND3	 4	/* D & ~M	*/
56 #define ROP_THROUGH	 5	/* D		*/
57 #define ROP_EOR		 6	/* (~D & M) | (D & ~M)	*/
58 #define ROP_OR1		 7	/* D | M	*/
59 #define ROP_NOR		 8	/* ~D | ~M	*/
60 #define ROP_ENOR	 9	/* (D & M) | (~D & ~M)	*/
61 #define ROP_INV1	10	/* ~D		*/
62 #define ROP_OR2		11	/* ~D | M	*/
63 #define ROP_INV2	12	/* ~M		*/
64 #define ROP_OR3		13	/* D | ~M	*/
65 #define ROP_NAND	14	/* ~D | ~M	*/
66 #define ROP_ONE		15	/* all 1	*/
67 
68 int omrasops1_init(struct rasops_info *, int, int);
69 int omrasops4_init(struct rasops_info *, int, int);
70