Linux 4.6-rc6
[cris-mirror.git] / include / linux / vt_buffer.h
blobf38c10ba3ff5ea01821ed375d25be2a403365e94
1 /*
2 * include/linux/vt_buffer.h -- Access to VT screen buffer
4 * (c) 1998 Martin Mares <mj@ucw.cz>
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.
13 #ifndef _LINUX_VT_BUFFER_H_
14 #define _LINUX_VT_BUFFER_H_
17 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
18 #include <asm/vga.h>
19 #endif
21 #ifndef VT_BUF_HAVE_RW
22 #define scr_writew(val, addr) (*(addr) = (val))
23 #define scr_readw(addr) (*(addr))
24 #endif
26 #ifndef VT_BUF_HAVE_MEMSETW
27 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
29 count /= 2;
30 while (count--)
31 scr_writew(c, s++);
33 #endif
35 #ifndef VT_BUF_HAVE_MEMCPYW
36 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
38 count /= 2;
39 while (count--)
40 scr_writew(scr_readw(s++), d++);
42 #endif
44 #ifndef VT_BUF_HAVE_MEMMOVEW
45 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
47 if (d < s)
48 scr_memcpyw(d, s, count);
49 else {
50 count /= 2;
51 d += count;
52 s += count;
53 while (count--)
54 scr_writew(scr_readw(--s), --d);
57 #endif
59 #endif