Home | History | Annotate | Line # | Download | only in iomd
vidc.h revision 1.1
      1 /*	$NetBSD: vidc.h,v 1.1 2001/10/05 22:27:42 reinoud Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994,1995 Mark Brinicombe.
      5  * Copyright (c) 1994,1995 Brini.
      6  * All rights reserved.
      7  *
      8  * This code is derived from software written for Brini by Mark Brinicombe
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *	This product includes software developed by Brini.
     21  * 4. The name of the company nor the name of the author may be used to
     22  *    endorse or promote products derived from this software without specific
     23  *    prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
     26  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     28  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  * SUCH DAMAGE.
     36  *
     37  * RiscBSD kernel project
     38  *
     39  * vidc.h
     40  *
     41  * VIDC20 registers
     42  *
     43  * Created      : 18/09/94
     44  *
     45  * Based on kate/display/vidc.h
     46  */
     47 
     48 /*
     49  * This should be private to the vidc directory but there are still dependancies
     50  * between the vidc and the riscpc virtual console (struct vidc_mode) that
     51  * means this file must be exported to userland.
     52  * With the import of the new console code this will go away.
     53  */
     54 
     55 #ifndef	_ARM32_VIDC_H_
     56 #define	_ARM32_VIDC_H_
     57 
     58 #include <machine/vidc_machdep.h>
     59 
     60 
     61 /*
     62  * Current VIDC base set in initarm()
     63  * since the current code isnt busspaceified, we need to set it manually ...
     64  * this is to allow the VIDC to be moved.
     65  */
     66 extern int *vidc_base;
     67 
     68 
     69 /* Video registers */
     70 
     71 #define VIDC_PALETTE 0x00000000
     72 #define VIDC_PALREG  0x10000000
     73 
     74 #define VIDC_BCOL    0x40000000
     75 #define VIDC_CP0     0x40000000
     76 #define VIDC_CP1     0x50000000
     77 #define VIDC_CP2     0x60000000
     78 #define VIDC_CP3     0x70000000
     79 
     80 #define VIDC_HCR     0x80000000
     81 #define VIDC_HSWR    0x81000000
     82 #define VIDC_HBSR    0x82000000
     83 #define VIDC_HDSR    0x83000000
     84 #define VIDC_HDER    0x84000000
     85 #define VIDC_HBER    0x85000000
     86 #define VIDC_HCSR    0x86000000
     87 #define VIDC_HIR     0x87000000
     88 
     89 #define VIDC_VCR     0x90000000
     90 #define VIDC_VSWR    0x91000000
     91 #define VIDC_VBSR    0x92000000
     92 #define VIDC_VDSR    0x93000000
     93 #define VIDC_VDER    0x94000000
     94 #define VIDC_VBER    0x95000000
     95 #define VIDC_VCSR    0x96000000
     96 #define VIDC_VCER    0x97000000
     97 
     98 #define VIDC_EREG    0xc0000000
     99 #define VIDC_FSYNREG 0xd0000000
    100 #define VIDC_CONREG  0xe0000000
    101 #define VIDC_DCTL    0xf0000000
    102 
    103 /* VIDC palette macros */
    104 
    105 #define VIDC_RED(r)   (r)
    106 #define VIDC_GREEN(g) (g << 8)
    107 #define VIDC_BLUE(b)  (b << 16)
    108 #define VIDC_COL(r, g, b) (VIDC_RED(r) | VIDC_GREEN(g) | VIDC_BLUE(b))
    109 
    110 #ifdef RC7500
    111 /*
    112  * Video frequency definitions
    113  */
    114 #define VIDFREQ_25_18	0x00
    115 #define VIDFREQ_28_32	0x01
    116 #define VIDFREQ_40_00	0x02
    117 #define VIDFREQ_72_00	0x03
    118 #define VIDFREQ_50_00	0x04
    119 #define VIDFREQ_77_00	0x05
    120 #define VIDFREQ_36_00	0x06
    121 #define VIDFREQ_44_90	0x07
    122 #define VIDFREQ_130_0	0x08
    123 #define VIDFREQ_120_0	0x09
    124 #define VIDFREQ_80_00	0x0A
    125 #define VIDFREQ_31_50	0x0B
    126 #define VIDFREQ_110_0	0x0C
    127 #define VIDFREQ_65_00	0x0D
    128 #define VIDFREQ_75_00	0x0E
    129 #define VIDFREQ_94_50	0x0F
    130 #endif
    131 
    132 
    133 /* Sound registers */
    134 
    135 #define VIDC_SIR0    0xa0000000
    136 #define VIDC_SIR1    0xa1000000
    137 #define VIDC_SIR2    0xa2000000
    138 #define VIDC_SIR3    0xa3000000
    139 #define VIDC_SIR4    0xa4000000
    140 #define VIDC_SIR5    0xa5000000
    141 #define VIDC_SIR6    0xa6000000
    142 #define VIDC_SIR7    0xa7000000
    143 
    144 #define VIDC_SFR     0xb0000000
    145 #define VIDC_SCR     0xb1000000
    146 
    147 #define SIR_LEFT_100  0x01
    148 #define SIR_LEFT_83   0x02
    149 #define SIR_LEFT_67   0x03
    150 #define SIR_CENTRE    0x04
    151 #define SIR_RIGHT_67  0x05
    152 #define SIR_RIGHT_83  0x06
    153 #define SIR_RIGHT_100 0x07
    154 
    155 /* Video display addresses */
    156 
    157 /* Where the display memory is mapped */
    158 /* note that there's not normally more than 2MB */
    159 #define VMEM_VBASE 0xf7000000
    160 
    161 /* Where the VRAM will be found */
    162 
    163 #define VRAM_BASE  0x02000000
    164 
    165 #ifndef _LOCORE
    166 
    167 /* Video memory descriptor */
    168 
    169 typedef struct
    170   {
    171     u_int vidm_vbase;	/* virtual base of video memory */
    172     u_int vidm_pbase;	/* physical base of video memory */
    173     u_int vidm_size;	/* video memory size */
    174     int   vidm_type;	/* video memory type */
    175   } videomemory_t;
    176 
    177 #define VIDEOMEM_TYPE_VRAM 0x01
    178 #define VIDEOMEM_TYPE_DRAM 0x02
    179 
    180 /* Structures and prototypes for vidc handling functions */
    181 
    182 struct vidc_state {
    183 	int palette[256];
    184 	int palreg;
    185 	int bcol;
    186 	int cp1;
    187 	int cp2;
    188 	int cp3;
    189 	int hcr, hswr, hbsr, hdsr, hder, hber, hcsr;
    190 	int hir;
    191 	int vcr, vswr, vbsr, vdsr, vder, vber, vcsr, vcer;
    192 	int ereg;
    193 	int fsynreg;
    194 	int conreg;
    195 	int dctl;
    196 };
    197 
    198 extern int vidc_fref;		/* reference frequency of detected VIDC */
    199 
    200 #ifdef _KERNEL
    201 extern int  vidc_write		__P((u_int /*reg*/, int /*value*/));
    202 extern void vidc_setstate	__P((struct vidc_state */*vidc*/));
    203 extern void vidc_setpalette	__P((struct vidc_state */*vidc*/));
    204 extern void vidc_stdpalette	__P((void));
    205 extern int  vidc_col		__P((int /*red*/, int /*green*/, int /*blue*/));
    206 extern struct vidc_state vidc_current[];
    207 #endif	/* _KERNEL */
    208 
    209 struct vidc_mode {
    210     int pixel_rate;
    211     int hswr, hbsr, hdsr, hder, hber, hcr;
    212     int vswr, vbsr, vdsr, vder, vber, vcr;
    213     int log2_bpp;
    214     int sync_pol;
    215     int frame_rate;
    216 };
    217 
    218 typedef struct
    219   {
    220     int chars;                 /* Number of characters defined in font */
    221     int width;                 /* Defined width of characters in bytes */
    222     int height;                /* Defined height of characters in lines */
    223     int pixel_width;           /* Width of characters in pixels */
    224     int pixel_height;          /* Height of characters in pixels */
    225     int x_spacing;             /* Spacing in pixels between chars */
    226     int y_spacing;             /* Spacing in pixels between lines */
    227     int data_size;             /* Allocated data size */
    228     unsigned char *data;       /* Font data */
    229   } font_struct;
    230 
    231 #define XRES mode.hder
    232 #define YRES mode.vder
    233 #define NUMCOLOURS (1 << mode.log2_bpp)
    234 
    235 struct vidc_info
    236   {
    237     struct vidc_mode mode;
    238     struct vidc_state vidc;
    239     font_struct *font;         /* pointer to current font_struct */
    240     font_struct *normalfont;   /* pointer to normal font struct */
    241     font_struct *italicfont;   /* pointer to italic font struct */
    242     font_struct *boldfont;     /* pointer to bold font struct */
    243     int xfontsize, yfontsize;
    244     int text_width, text_height;
    245     int bytes_per_line;
    246     int bytes_per_scroll;
    247     int pixelsperbyte;
    248     int screensize;
    249     int fast_render;
    250     int forecolour, forefillcolour;
    251     int backcolour, backfillcolour;
    252     int text_colours;
    253     int frontporch;
    254     int topporch;	/* ;) */
    255     int bold;
    256     int reverse;
    257     int n_forecolour;
    258     int n_backcolour;
    259     int blanked;
    260     int scrollback_end;
    261     int flash;
    262     int cursor_flash;
    263   };
    264 
    265 #endif	/* !_LOCORE */
    266 
    267 #define COLOUR_BLACK_1 0x00
    268 #define COLOUR_WHITE_1 0x01
    269 
    270 #define COLOUR_BLACK_2 0x00
    271 #define COLOUR_WHITE_2 0x03
    272 
    273 #define COLOUR_BLACK_4 0x00
    274 #define COLOUR_WHITE_4 0x07
    275 
    276 #define COLOUR_BLACK_8 0x00
    277 #define COLOUR_WHITE_8 0x07
    278 
    279 #endif	/* !_ARM32_VIDC_H */
    280 
    281 /* End of vidc.h */
    282 
    283