blob: 12bf98dfe3849b6298c13dd8b7e315f8f93849cc [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001
2#ifndef _LINUX_VT_BUFFER_H_
3#define _LINUX_VT_BUFFER_H_
4
5
6#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
7#include <asm/vga.h>
8#endif
9
10#ifndef VT_BUF_HAVE_RW
11#define scr_writew(val, addr) (*(addr) = (val))
12#define scr_readw(addr) (*(addr))
13#define scr_memcpyw(d, s, c) memcpy(d, s, c)
14#define scr_memmovew(d, s, c) memmove(d, s, c)
15#define VT_BUF_HAVE_MEMCPYW
16#define VT_BUF_HAVE_MEMMOVEW
17#endif
18
19#ifndef VT_BUF_HAVE_MEMSETW
20static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
21{
22 count /= 2;
23 while (count--)
24 scr_writew(c, s++);
25}
26#endif
27
28#ifndef VT_BUF_HAVE_MEMCPYW
29static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
30{
31 count /= 2;
32 while (count--)
33 scr_writew(scr_readw(s++), d++);
34}
35#endif
36
37#ifndef VT_BUF_HAVE_MEMMOVEW
38static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
39{
40 if (d < s)
41 scr_memcpyw(d, s, count);
42 else {
43 count /= 2;
44 d += count;
45 s += count;
46 while (count--)
47 scr_writew(scr_readw(--s), --d);
48 }
49}
50#endif
51
52#endif