1 /*        $NetBSD: video.h,v 1.10 2023/03/25 21:51:12 andvar Exp $    */
2 
3 /*
4  * Copyright (c) 1995 Leo Weppelman.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef _MACHINE_VIDEO_H
29 #define _MACHINE_VIDEO_H
30 /*
31  * Access to circuitry for video
32  */
33 
34 #define   VIDEO     ((struct video *)AD_VIDEO)
35 
36 struct video {
37     volatile        char      vdb[14];  /* sparsely filled                */
38     volatile        u_short vd_line_wide;         /* Falcon line word distance        */
39     volatile        u_short vd_vert_wrap;         /* Falcon line length                       */
40     volatile        char      vd_fill0[45];       /* filler                         */
41     volatile        u_short   vd_st_rgb[16];      /* RGB for simultaneous colors          (ST)*/
42     volatile        u_char    vd_st_res;          /* ST resolution                  */
43     volatile        char      vd_fill1; /* filler                         */
44     volatile        u_short   vd_tt_res;          /* TT-resolution mode                       */
45     volatile        u_char  vd_ste_hscroll;       /* MEGA STe hor bitwise scroll              */
46     volatile        u_short vd_fal_res; /* Falcon resolution                        */
47     volatile        char    vd_fill2[23];
48     volatile        u_short vd_h_hold_cnt;        /* Falcon horizontal hold counter   */
49     volatile        u_short vd_h_hold_tim;        /* Falcon horizontal hold timer     */
50     volatile        u_short vd_h_bord_beg;  /* Falcon horizontal border begin   */
51     volatile        u_short vd_h_bord_end;        /* Falcon horizontal border end     */
52     volatile        u_short vd_h_dis_beg;         /* Falcon horizontal display begin  */
53     volatile        u_short vd_h_dis_end;         /* Falcon horizontal display end    */
54     volatile        u_short vd_h_ss;    /* Falcon horizontal SS             */
55     volatile    u_short vd_h_fs;        /* Falcon horizontal FS                     */
56     volatile        u_short vd_h_hh;    /* Falcon horizontal HH                     */
57     volatile        char    vd_fill3[13];
58     volatile        u_short vd_v_freq_cnt;        /* Falcon vertical frequency count  */
59     volatile        u_short vd_v_freq_tim;        /* Falcon vertical frequency timer  */
60     volatile        u_short vd_v_bord_beg;        /* Falcon vertical border begin     */
61     volatile        u_short vd_v_bord_end;        /* Falcon vertical border end       */
62     volatile        u_short vd_v_dis_beg;         /* Falcon vertical display begin    */
63     volatile        u_short vd_v_dis_end;         /* Falcon vertical display end      */
64     volatile        u_short vd_v_ss;    /* Falcon vertical SS               */
65     volatile        char    vd_fill4[17];
66     volatile        u_short vd_fal_ctrl;          /* Falcon video control                     */
67     volatile        u_short vd_fal_mode;          /* Falcon video mode                      */
68     volatile        char    vd_fill5[315];
69     volatile        u_short vd_tt_rgb[256];       /* RGB for simultaneous TT colors   */
70     volatile        char      vd_fill6[4608];
71     volatile        u_long  vd_fal_rgb[256];/* RGB for Falcon colors            */
72 };
73 
74 #define   vd_ramh             vdb[ 1]   /* base address Video RAM, high byte    */
75 #define   vd_ramm             vdb[ 3]   /* base address Video RAM, mid byte     */
76 #define   vd_raml             vdb[13]   /* base address Video RAM, low byte     */
77 #define   vd_ptrh             vdb[ 5]   /* scan address Video RAM, high byte    */
78 #define   vd_ptrm             vdb[ 7]   /* scan address Video RAM, mid byte     */
79 #define   vd_ptrl             vdb[ 9]   /* scan address Video RAM, low byte     */
80 #define   vd_sync             vdb[10]   /* synchronization mode                           */
81 
82 /* bits in vd_sync: */
83 #define   SYNC_EXT  0x01      /* extern sync                                    */
84 #define   SYNC_50             0x02      /* 50 Hertz (used for color)            */
85 
86 /* bits in vd_st_rgb[]: */
87 #define   RGB_B               0x0007
88 #define   RGB_G               0x0070
89 #define   RGB_R               0x0700
90 
91 /* some values for vd_st_rgb[]: */
92 #define   RGB_BLACK 0x0000
93 #define   RGB_RED             0x0700
94 #define   RGB_GREEN 0x0070
95 #define   RGB_BLUE  0x0007
96 #define   RGB_WHITE 0x0777
97 #define   RGB_MAGENTA         0x0707
98 #define   RGB_CYAN  0x0077
99 #define   RGB_YELLOW          0x0770
100 #define   RGB_LGREY 0x0555
101 #define   RGB_DGREY 0x0222
102 
103 /* values for vd_st_res: */
104 #define   RES_LOW             0x00      /* 320x200, 16 colors                             */
105 #define   RES_MID             0x01      /* 640x200,  4 colors                             */
106 #define   RES_HIGH  0x02      /* 640x400, monochrome                            */
107 
108 /* masks for vd_tt_res: */
109 #define   RES_STLOW 0x0000    /* 320x200, 16 colors                             */
110 #define   RES_STMID 0x0100    /* 640x200,  4 colors                             */
111 #define   RES_STHIGH          0x0200    /* 640x400, monochrome                            */
112 #define   RES_TTMID 0x0400    /* 640x480, 16 colors                             */
113 #define   RES_TTHIGH          0x0600    /* 1280x960, monochrome                           */
114 #define   RES_TTLOW 0x0700    /* 320x480,  256 colors                           */
115 #define TT_PALLET   0x000f    /* Palette number                       */
116 #define   TT_HYMONO 0x8000    /* Hyper mono mode                      */
117 #define   TT_SHOLD  0x1000    /* Sample/hold mode                     */
118 
119 /* The falcon video modes */
120 #define RES_FALAUTO 0         /* Falcon resolution detected at boot   */
121 #define RES_VGA2    1         /* 640x480,   2 colors                            */
122 #define RES_VGA4    2         /* 640x480,   4 colors                            */
123 #define RES_VGA16   3         /* 640x480,  16 colors                            */
124 #define RES_VGA256  4         /* 640x480, 256 colors                            */
125 #define RES_DIRECT  5         /* 320x200, 65536 colors                */
126 #define RES_FAL_STLOW         6         /* 320x200,  16 colors                            */
127 #define RES_FAL_STMID         7         /* 640x200,   4 colors                            */
128 #define RES_FAL_STHIGH        8         /* 640x400,   2 colors                            */
129 #define RES_FAL_TTLOW         9         /* 320x480, 256 colors                            */
130 
131 /* Falcon monitor types */
132 #define FAL_SM                0x0000
133 #define FAL_SC                0x0100
134 #define FAL_VGA               0x0200
135 #define FAL_TV                0x0300
136 
137 #endif /*  _MACHINE_VIDEO_H */
138