OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [gfx/] [mw/] [v2_0/] [src/] [drivers/] [vgaplan4.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
/*
2
 * Copyright (c) 1999, 2002 Greg Haerr <greg@censoft.com>
3
 *
4
 * Header file for EGA/VGA 16 color 4 planes screen driver
5
 * Added functions for Hercules access
6
 *
7
 */
8
#define SLOWVGA         0        /* =1 for outb rather than outw instructions*/
9
 
10
#ifdef __PACIFIC__
11
#define HAVEBLIT        0
12
#else
13
#define HAVEBLIT        1       /* =0 to exclude blitting in vgaplan4 drivers*/
14
#endif
15
 
16
#if UNIX & !ELKS
17
#define HAVEFARPTR      1
18
#define FAR
19
#endif
20
 
21
#if LINUX
22
#ifdef __GLIBC__
23
#include <sys/io.h>             /* for outb def's, requires -O */
24
#else
25
#include <asm/io.h>             /* for outb def's on 2.3.x*/
26
#endif
27
#include <unistd.h>
28
#define HAVEFARPTR      1
29
#define FAR
30
#define HAVEIOPERM      1       /* has ioperm() system call*/
31
#endif
32
 
33
#if MSDOS
34
#define HAVEFARPTR      1       /* compiler has _far extension*/
35
#ifdef __PACIFIC__
36
#include <dos.h>
37
#define FAR             far
38
#else
39
#define FAR             _far
40
#endif
41
#endif
42
 
43
#if __rtems__
44
#define HAVEFARPTR      1
45
#define FAR
46
#include <i386_io.h>
47
#endif
48
 
49
#if MSDOS | ELKS
50
/* make far ptr*/
51
#define MK_FP(seg,ofs)  ((FARADDR)(((unsigned long)(seg) << 16) | (unsigned)(ofs)))
52
#define EGA_BASE        MK_FP(0xa000, 0)
53
#else
54
#define EGA_BASE        ((unsigned char *)0xa0000)
55
#endif
56
 
57
#ifdef __ECOS
58
# define HAVEFARPTR 1
59
# define FAR
60
# include <pkgconf/system.h>
61
# ifdef CYGPKG_HAL_I386
62
#  include <cyg/hal/hal_io.h>
63
#  define outb(_a_, _b_) HAL_WRITE_UINT8(_b_, _a_)
64
#  define outp(_a_, _b_) HAL_WRITE_UINT8(_a_, _b_)
65
#  define outw(_a_, _b_) HAL_WRITE_UINT16(_b_, _a_)
66
# else
67
#  define outb(_a_, _b_)
68
#  define outp(_a_, _b_)
69
#  define outw(_a_, _b_)
70
# endif
71
#endif
72
 
73
#if HAVEFARPTR
74
/* far ptr access to screen*/
75
typedef volatile unsigned char FAR * FARADDR;
76
 
77
#if _MINIX
78
/* get byte at address*/
79
extern unsigned char GETBYTE_FP(FARADDR);
80
 
81
/* put byte at address*/
82
extern void PUTBYTE_FP(FARADDR,unsigned char);
83
 
84
/* read-modify-write at address*/
85
extern void RMW_FP(FARADDR);
86
#else
87
/* get byte at address*/
88
#define GETBYTE_FP(addr)        (*(FARADDR)(addr))
89
 
90
/* put byte at address*/
91
#define PUTBYTE_FP(addr,val)    ((*(FARADDR)(addr)) = (val))
92
 
93
/* read-modify-write at address*/
94
#define RMW_FP(addr)            ((*(FARADDR)(addr)) |= 1)
95
 
96
/* or byte at address*/
97
#define ORBYTE_FP(addr,val)     ((*(FARADDR)(addr)) |= (val))
98
 
99
/* and byte at address*/
100
#define ANDBYTE_FP(addr,val)    ((*(FARADDR)(addr)) &= (val))
101
#endif
102
#else
103
 
104
/* for bcc with no _far extension*/
105
typedef unsigned long   FARADDR;
106
 
107
/* get byte at address*/
108
extern unsigned char GETBYTE_FP(FARADDR);
109
 
110
/* put byte at address*/
111
extern void PUTBYTE_FP(FARADDR,unsigned char);
112
 
113
/* read-modify-write at address*/
114
extern void RMW_FP(FARADDR);
115
 
116
/* or byte at address*/
117
extern void ORBYTE_FP(FARADDR,unsigned char);
118
 
119
/* and byte at address*/
120
extern void ANDBYTE_FP(FARADDR,unsigned char);
121
#endif
122
 
123
 
124
#if MSDOS
125
#define outb(val,port)  outp(port,val)
126
#endif
127
 
128
#if ELKS
129
#define outb(val,port)  outportb(port,val)
130
#define outw(val,port)  outport(port,val)
131
 
132
extern int  inportb(int port);
133
extern void outportb(int port,unsigned char data);
134
extern void outport(int port,int data);
135
#endif
136
 
137
/* external routines*/
138
FARADDR         int10(int ax,int bx);
139
 
140
/* external routines implementing planar ega/vga access*/
141
 
142
/* vgaplan4.c portable C, asmplan4.s asm, or ELKS asm elkplan4.c driver*/
143
int             ega_init(PSD psd);
144
void            ega_drawpixel(PSD psd,unsigned int x,unsigned int y,
145
                        MWPIXELVAL c);
146
MWPIXELVAL      ega_readpixel(PSD psd,unsigned int x,unsigned int y);
147
void            ega_drawhorzline(PSD psd,unsigned int x1,unsigned int x2,
148
                        unsigned int y,MWPIXELVAL c);
149
void            ega_drawvertline(PSD psd,unsigned int x,unsigned int y1,
150
                        unsigned int y2, MWPIXELVAL c);
151
#if HAVEBLIT
152
/* memplan4.c*/
153
void            ega_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w,
154
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
155
#endif
156
 
157
/* vgainit.c - direct hw init*/
158
void            ega_hwinit(void);
159
void            ega_hwterm(void);
160
 
161
#if _MINIX
162
#define outb(v, p)      outb(p, v)
163
#define outw(v, p)      outw(p, v)
164
#endif
165
 
166
#if SLOWVGA
167
/* use outb rather than outw instructions for older, slower VGA's*/
168
 
169
/* Program the Set/Reset Register for drawing in color COLOR for write
170
   mode 0. */
171
#define set_color(c)            { outb (0, 0x3ce); outb (c, 0x3cf); }
172
 
173
/* Set the Enable Set/Reset Register. */
174
#define set_enable_sr(mask) { outb (1, 0x3ce); outb (mask, 0x3cf); }
175
 
176
/* Select the Bit Mask Register on the Graphics Controller. */
177
#define select_mask()           { outb (8, 0x3ce); }
178
 
179
/* Program the Bit Mask Register to affect only the pixels selected in
180
   MASK.  The Bit Mask Register must already have been selected with
181
   select_mask (). */
182
#define set_mask(mask)          { outb (mask, 0x3cf); }
183
 
184
#define select_and_set_mask(mask) { outb (8, 0x3ce); outb (mask, 0x3cf); }
185
 
186
/* Set the Data Rotate Register.  Bits 0-2 are rotate count, bits 3-4
187
   are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
188
#define set_op(op)              { outb (3, 0x3ce); outb (op, 0x3cf); }
189
 
190
/* Set the Memory Plane Write Enable register. */
191
#define set_write_planes(mask) { outb (2, 0x3c4); outb (mask, 0x3c5); }
192
 
193
/* Set the Read Map Select register. */
194
#define set_read_plane(plane)   { outb (4, 0x3ce); outb (plane, 0x3cf); }
195
 
196
/* Set the Graphics Mode Register.  The write mode is in bits 0-1, the
197
   read mode is in bit 3. */
198
#define set_mode(mode)          { outb (5, 0x3ce); outb (mode, 0x3cf); }
199
 
200
#else /* !SLOWVGA*/
201
/* use outw rather than outb instructions for new VGAs*/
202
 
203
/* Program the Set/Reset Register for drawing in color COLOR for write
204
   mode 0. */
205
#define set_color(c)            { outw ((c)<<8, 0x3ce); }
206
 
207
/* Set the Enable Set/Reset Register. */
208
#define set_enable_sr(mask)     { outw (1|((mask)<<8), 0x3ce); }
209
 
210
/* Select the Bit Mask Register on the Graphics Controller. */
211
#define select_mask()           { outb (8, 0x3ce); }
212
 
213
/* Program the Bit Mask Register to affect only the pixels selected in
214
   MASK.  The Bit Mask Register must already have been selected with
215
   select_mask (). */
216
#define set_mask(mask)          { outb (mask, 0x3cf); }
217
 
218
#define select_and_set_mask(mask) { outw (8|((mask)<<8), 0x3ce); }
219
 
220
/* Set the Data Rotate Register.  Bits 0-2 are rotate count, bits 3-4
221
   are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
222
#define set_op(op)              { outw (3|((op)<<8), 0x3ce); }
223
 
224
/* Set the Memory Plane Write Enable register. */
225
#define set_write_planes(mask) { outw (2|((mask)<<8), 0x3c4); }
226
 
227
/* Set the Read Map Select register. */
228
#define set_read_plane(plane)   { outw (4|((plane)<<8), 0x3ce); }
229
 
230
/* Set the Graphics Mode Register.  The write mode is in bits 0-1, the
231
   read mode is in bit 3. */
232
#define set_mode(mode)          { outw (5|((mode)<<8), 0x3ce); }
233
 
234
#endif /* SLOWVGA*/

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.