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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [char/] [selection.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * selection.h
3
 *
4
 * Interface between console.c, tty_io.c, vt.c, vc_screen.c and selection.c
5
 */
6
extern int sel_cons;
7
 
8
extern void clear_selection(void);
9
extern int set_selection(const unsigned long arg, struct tty_struct *tty, int user);
10
extern int paste_selection(struct tty_struct *tty);
11
extern int sel_loadlut(const unsigned long arg);
12
extern int mouse_reporting(void);
13
extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
14
 
15
extern unsigned long video_num_columns;
16
extern unsigned long video_num_lines;
17
extern unsigned long video_size_row;
18
extern unsigned char video_type;
19
extern unsigned long video_mem_base;
20
extern unsigned long video_mem_term;
21
extern unsigned long video_screen_size;
22
extern unsigned short video_port_reg;
23
extern unsigned short video_port_val;
24
 
25
extern int console_blanked;
26
extern int can_do_color;
27
 
28
extern unsigned long video_font_height;
29
extern unsigned long video_scan_lines;
30
extern unsigned long default_font_height;
31
extern int video_font_is_default;
32
 
33
extern unsigned char color_table[];
34
extern int default_red[];
35
extern int default_grn[];
36
extern int default_blu[];
37
 
38
extern unsigned short __real_origin;
39
extern unsigned short __origin;
40
extern unsigned char has_wrapped;
41
 
42
extern unsigned short *vc_scrbuf[MAX_NR_CONSOLES];
43
 
44
extern void do_unblank_screen(void);
45
extern unsigned short *screen_pos(int currcons, int w_offset, int viewed);
46
extern unsigned short screen_word(int currcons, int offset, int viewed);
47
extern int scrw2glyph(unsigned short scr_word);
48
extern void complement_pos(int currcons, int offset);
49
extern void invert_screen(int currcons, int offset, int count, int shift);
50
 
51
#define reverse_video_char(a)   (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77))
52
#define reverse_video_short(a)  (((a) & 0x88ff) | \
53
        (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4))
54
/* this latter line used to have masks 0xf000 and 0x0f00, but selection
55
   requires a self-inverse operation; moreover, the old version looks wrong */
56
 
57
extern void getconsxy(int currcons, char *p);
58
extern void putconsxy(int currcons, char *p);
59
 
60
 
61
/* how to access screen memory */
62
 
63
#include <linux/config.h>
64
#include <asm/io.h> 
65
 
66
#ifdef CONFIG_TGA_CONSOLE
67
 
68
# ifdef CONFIG_VGA_CONSOLE
69
extern const struct console_desc cons_devices[];
70
# endif
71
 
72
extern unsigned long video_mem_term;
73
 
74
int tga_blitc (unsigned int, unsigned long);
75
 
76
/*
77
 * TGA console screen memory access
78
 *
79
 * TGA is *not* a character/attribute cell device; font bitmaps must be rendered
80
 * to the screen pixels.
81
 *
82
 * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either
83
 * of the VC's backing store, or the "shadow screen" memory where the screen
84
 * contents are kept, as the TGA frame buffer is *not* char/attr cells.
85
 *
86
 * We must test for an Alpha kernel virtual address that falls within
87
 *  the "shadow screen" memory. This condition indicates we really want
88
 *  to write to the screen, so, we do... :-)
89
 *
90
 * NOTE also: there's only *TWO* operations: to put/get a character/attribute.
91
 *  All the others needed by VGA support go away, as Not Applicable for TGA.
92
 *
93
 * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this
94
 *  indicates a VC's backing store; otherwise, it's a bus memory address, for
95
 *  the VGA's screen memory, so we do the Alpha "swizzle"... :-)
96
 */
97
#define IS_VIDEO_MEMORY(a) \
98
        ((unsigned long)(a) - video_mem_base < video_mem_term - video_mem_base)
99
 
100
static inline void scr_writew(unsigned short val, unsigned short * addr)
101
{
102
        if ((long) addr < 0) {
103
        /*
104
                 * always deposit the char/attr, then see if it was to
105
                 * "screen" mem.
106
         * if so, then render the char/attr onto the real screen.
107
         */
108
        *addr = val;
109
 
110
                /*
111
                 * TGA might need the char blitted to the screen,
112
                 * but check first, we could be running on a VGA.
113
                 */
114
                if (tga_blitc && IS_VIDEO_MEMORY(addr))
115
                        tga_blitc(val, (unsigned long) addr);
116
        } else
117
                writew(val, (unsigned long) addr);
118
}
119
 
120
static inline unsigned short scr_readw(unsigned short * addr)
121
{
122
        if ((long) addr < 0)
123
        return *addr;
124
        return readw((unsigned long) addr);
125
}
126
 
127
/* scr_writeb and scr_readb are not expected to be called with a TGA */
128
static inline void scr_writeb(unsigned char val, unsigned char * addr)
129
{
130
        if ((long) addr < 0)
131
                *addr = val;
132
        else
133
                writeb(val, (unsigned long) addr);
134
}
135
 
136
static inline unsigned char scr_readb(unsigned char * addr)
137
{
138
        if ((long) addr < 0)
139
                return *addr;
140
        return readb((unsigned long) addr);
141
}
142
 
143
#else /* CONFIG_TGA_CONSOLE */
144
 
145
/*
146
 * normal VGA console access
147
 *
148
 */
149
 
150
#ifdef __alpha__
151
 
152
/*
153
 * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this
154
 *  indicates a VC's backing store; otherwise, it's a bus memory address, for
155
 *  the VGA's screen memory, so we do the Alpha "swizzle"... :-)
156
 */
157
static inline void scr_writeb(unsigned char val, unsigned char * addr)
158
{
159
        if ((long) addr < 0)
160
                *addr = val;
161
        else
162
                writeb(val, (unsigned long) addr);
163
}
164
 
165
static inline unsigned char scr_readb(unsigned char * addr)
166
{
167
        if ((long) addr < 0)
168
                return *addr;
169
        return readb((unsigned long) addr);
170
}
171
 
172
static inline void scr_writew(unsigned short val, unsigned short * addr)
173
{
174
        if ((long) addr < 0)
175
                *addr = val;
176
        else
177
                writew(val, (unsigned long) addr);
178
}
179
 
180
static inline unsigned short scr_readw(unsigned short * addr)
181
{
182
        if ((long) addr < 0)
183
                return *addr;
184
        return readw((unsigned long) addr);
185
}
186
 
187
#else /* __alpha__ */
188
/*
189
 * normal VGA console access
190
 *
191
 * NOTE: these do normal PC-style frame buffer accesses
192
 */
193
static inline void scr_writeb(unsigned char val, unsigned char * addr)
194
{
195
        *addr = val;
196
}
197
 
198
static inline unsigned char scr_readb(unsigned char * addr)
199
{
200
        return *addr;
201
}
202
 
203
static inline void scr_writew(unsigned short val, unsigned short * addr)
204
{
205
        *addr = val;
206
}
207
 
208
static inline unsigned short scr_readw(unsigned short * addr)
209
{
210
        return *addr;
211
}
212
 
213
#endif /* __alpha__ */
214
#endif /* CONFIG_TGA_CONSOLE */
215
 
216
static inline void memsetw(void * s, unsigned short c, unsigned int count)
217
{
218
        unsigned short * addr = (unsigned short *) s;
219
 
220
        count /= 2;
221
        while (count) {
222
                count--;
223
                scr_writew(c, addr++);
224
        }
225
}
226
 
227
static inline void memcpyw(unsigned short *to, unsigned short *from,
228
                           unsigned int count)
229
{
230
        count /= 2;
231
        while (count) {
232
                count--;
233
                scr_writew(scr_readw(from++), to++);
234
        }
235
}

powered by: WebSVN 2.1.0

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