Home | History | Annotate | Line # | Download | only in dev
      1 /*	$NetBSD: nwb225reg.h,v 1.2 2026/09/20 11:52:56 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2026 Izumi Tsutsui.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     25  */
     26 
     27 #ifndef _NEWS68K_NWB225REG_H_
     28 #define _NEWS68K_NWB225REG_H_
     29 
     30 /* NWB-225 MMIO addresses */
     31 #define NWB225_KROM_BASE		0xf0600000UL
     32 #define NWB225_KROM_SIZE		0x00100000UL
     33 #define NWB225_RCONT_BASE		0xf0700000UL
     34 #define NWB225_RCONT_SIZE		0x00100000UL
     35 
     36 /*
     37  * ROP controller register/aperture offsets from NWB225_RCONT_BASE
     38  */
     39 
     40 /* Status: ROP status register */
     41 #define NWB225_STATUS			0x00080000UL
     42 #define  NWB225_STATUS_REQ		0x0001
     43 #define  NWB225_STATUS_EXEC		0x0002
     44 #define  NWB225_STATUS_BUSY		(NWB225_STATUS_EXEC | NWB225_STATUS_REQ)
     45 #define  NWB225_STATUS_DISPVER		0x00e0
     46 #define  NWB225_STATUS_DISPVER_SHIFT	5
     47 #define  NWB225_STATUS_4PLANE		0x0080
     48 
     49 /* Command-address flags: A13 Set Shift / A14 Execute */
     50 #define NWB225_ROP_ADDR_FLAG_SET_SHIFT	0x00002000UL
     51 #define NWB225_ROP_ADDR_FLAG_EXECUTE	0x00004000UL
     52 
     53 /* Command-addresses: COPY and FILL */
     54 #define NWB225_ROP_COPY_XR_YR		0x00060300UL
     55 #define NWB225_ROP_COPY_XF_YR		0x00060310UL
     56 #define NWB225_ROP_COPY_XR_YF		0x00060320UL
     57 #define NWB225_ROP_COPY_XF_YF		0x00060330UL
     58 #define NWB225_ROP_CONST_FILL		0x000603b0UL
     59 
     60 /* Parameter-addresses: rectangles of COPY, FILL, and HWRITE */
     61 /* y must be in the range 0..NWB225_FB_HEIGHT - 1 */
     62 #define NWB225_DST_ADDR(y)		(0x00008000UL | 2UL * (y))
     63 #define NWB225_SRC_ADDR(y)		(0x00020000UL | 2UL * (y))
     64 /* h must be in the range 1..NWB225_FB_HEIGHT */
     65 #define NWB225_HWRITE_LIMIT(h)		(0x00040000UL | 2UL * ((h) - 1))
     66 #define NWB225_ROP_LIMIT(h)		(0x00050000UL | 2UL * ((h) - 1))
     67 
     68 /* Parameter-addresses: ROP func of COPY, FILL, and HWRITE */
     69 /* p must be in the range 0..7 and less than dc_nplanes */
     70 #define NWB225_ROP_FUNC(p)		(0x00060730UL | 2UL * (p))
     71 
     72 /* Parameter-addresses: for host data of HWRITE */
     73 #define NWB225_HWRITE_DATA		0x00070230UL
     74 #define NWB225_HWRITE_BITS_PER_WORD	16
     75 
     76 #define NWB225_PLANE_CTRL		0x000a0000UL
     77 #define NWB225_PLANE_CTRL_SHIFT		8
     78 
     79 #define NWB225_CTL_SELECT		0x000c0000UL
     80 #define NWB225_PAL_INDEX		0x000c0000UL
     81 #define NWB225_PAL_DATA			0x000c0002UL
     82 #define NWB225_CTL_DATA			0x000c0004UL
     83 #define NWB225_INIT_BASE		0x000e0000UL
     84 
     85 /* Fixed hardware geometry used by the NWB-225 NEWS-OS/PROM setup */
     86 #define NWB225_FB_WIDTH			2048
     87 #define NWB225_FB_HEIGHT		1024
     88 #define NWB225_VIS_WIDTH		1280
     89 #define NWB225_VIS_HEIGHT		1024
     90 
     91 /* NEWS-OS KROM glyph and text-cell geometry */
     92 #define NWB225_FONT_WIDTH		12
     93 #define NWB225_FONT_HEIGHT		24
     94 #define NWB225_CELL_WIDTH		16
     95 #define NWB225_CELL_HEIGHT		30
     96 #define NWB225_GLYPH_YOFFSET		4
     97 
     98 #define NWB225_KROM_ASCII_FIRST		0x20
     99 #define NWB225_KROM_ASCII_LAST		0x7e
    100 #define NWB225_KROM_ROWBYTES		4
    101 #define NWB225_KROM_ASCII_MASK		0xfff0
    102 #define NWB225_TEXT_COLS		80
    103 #define NWB225_TEXT_ROWS		33
    104 #define NWB225_TEXT_XORIGIN		0
    105 #define NWB225_TEXT_YORIGIN		8
    106 
    107 #endif /* _NEWS68K_NWB225REG_H_ */
    108