1 /*
2 * include/linux/vt_buffer.h -- Access to VT screen buffer
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 *
6 * This is a set of macros and functions which are used in the
7 * console driver and related code to access the screen buffer.
8 * In most cases the console works with simple in-memory buffer,
9 * but when handling hardware text mode consoles, we store
10 * the foreground console directly in video memory.
11 */
12
13 #ifndef _LINUX_VT_BUFFER_H_
14 #define _LINUX_VT_BUFFER_H_
15
16 #include <linux/config.h>
17
18 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
19 #include <asm/vga.h>
20 #endif
21
22 #ifndef VT_BUF_HAVE_RW
23 #define scr_writew(val, addr) (*(addr) = (val))
24 #define scr_readw(addr) (*(addr))
25 #define scr_memcpyw(d, s, c) memcpy(d, s, c)
26 #define scr_memmovew(d, s, c) memmove(d, s, c)
27 #define VT_BUF_HAVE_MEMCPYW
28 #define VT_BUF_HAVE_MEMMOVEW
29 #define scr_memcpyw_from(d, s, c) memcpy(d, s, c)
30 #define scr_memcpyw_to(d, s, c) memcpy(d, s, c)
31 #define VT_BUF_HAVE_MEMCPYF
32 #endif
33
34 #ifndef VT_BUF_HAVE_MEMSETW
35 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
36 {
37 count /= 2;
38 while (count--)
39 scr_writew(c, s++);
40 }
41 #endif
42
43 #ifndef VT_BUF_HAVE_MEMCPYW
44 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
45 {
46 count /= 2;
47 while (count--)
48 scr_writew(scr_readw(s++), d++);
49 }
50 #endif
51
52 #ifndef VT_BUF_HAVE_MEMMOVEW
53 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
54 {
55 if (d < s)
56 scr_memcpyw(d, s, count);
57 else {
58 count /= 2;
59 d += count;
60 s += count;
61 while (count--)
62 scr_writew(scr_readw(--s), --d);
63 }
64 }
65 #endif
66
67 #ifndef VT_BUF_HAVE_MEMCPYF
68 static inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count)
69 {
70 count /= 2;
71 while (count--)
72 *d++ = scr_readw(s++);
73 }
74
75 static inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count)
76 {
77 count /= 2;
78 while (count--)
79 scr_writew(*s++, d++);
80 }
81 #endif
82
83 #endif
84
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.