xref: /openbsd/sys/arch/luna88k/dev/omrasops.h (revision 5faa2bc5)
1 /* $OpenBSD: omrasops.h,v 1.7 2021/09/25 21:34:21 aoyama Exp $ */
2 
3 /*
4  * Copyright (c) 2013 Kenji Aoyama
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * Helper macros
21  */
22 #define W(addr)  ((u_int32_t *)(addr))
23 #define P0(addr) ((u_int32_t *)((u_int8_t *)(addr) +  0x40000))
24 #define P1(addr) ((u_int32_t *)((u_int8_t *)(addr) +  0x80000))
25 #define P2(addr) ((u_int32_t *)((u_int8_t *)(addr) +  0xC0000))
26 #define P3(addr) ((u_int32_t *)((u_int8_t *)(addr) + 0x100000))
27 
28 /*
29  * Replacement Rules (rops) (derived from hp300)
30  */
31 #define RR_CLEAR	0x0
32 #define RR_COPY		0x3
33 
34 /*
35  * ROP function
36  *
37  * LUNA's frame buffer uses Hitachi HM53462 video RAM, which has raster
38  * (logic) operation, or ROP, function.  To use ROP function on LUNA, write
39  * a 32bit `mask' value to the specified address corresponding to each ROP
40  * logic.
41  *
42  * D: the data writing to the video RAM
43  * M: the data already stored on the video RAM
44  */
45 
46 /* operation		index	the video RAM contents will be */
47 #define ROP_ZERO	 0	/* all 0	*/
48 #define ROP_AND1	 1	/* D & M	*/
49 #define ROP_AND2	 2	/* ~D & M	*/
50 /* Not used on LUNA	 3			*/
51 #define ROP_AND3	 4	/* D & ~M	*/
52 #define ROP_THROUGH	 5	/* D		*/
53 #define ROP_EOR		 6	/* (~D & M) | (D & ~M)	*/
54 #define ROP_OR1		 7	/* D | M	*/
55 #define ROP_NOR		 8	/* ~D | ~M	*/
56 #define ROP_ENOR	 9	/* (D & M) | (~D & ~M)	*/
57 #define ROP_INV1	10	/* ~D		*/
58 #define ROP_OR2		11	/* ~D | M	*/
59 #define ROP_INV2	12	/* ~M		*/
60 #define ROP_OR3		13	/* D | ~M	*/
61 #define ROP_NAND	14	/* ~D | ~M	*/
62 #define ROP_ONE		15	/* all 1	*/
63