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