vt_buffer.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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. #ifndef _LINUX_VT_BUFFER_H_
  13. #define _LINUX_VT_BUFFER_H_
  14. #include <linux/config.h>
  15. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
  16. #include <asm/vga.h>
  17. #endif
  18. #ifndef VT_BUF_HAVE_RW
  19. #define scr_writew(val, addr) (*(addr) = (val))
  20. #define scr_readw(addr) (*(addr))
  21. #define scr_memcpyw(d, s, c) memcpy(d, s, c)
  22. #define scr_memmovew(d, s, c) memmove(d, s, c)
  23. #define VT_BUF_HAVE_MEMCPYW
  24. #define VT_BUF_HAVE_MEMMOVEW
  25. #endif
  26. #ifndef VT_BUF_HAVE_MEMSETW
  27. static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
  28. {
  29. count /= 2;
  30. while (count--)
  31. scr_writew(c, s++);
  32. }
  33. #endif
  34. #ifndef VT_BUF_HAVE_MEMCPYW
  35. static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
  36. {
  37. count /= 2;
  38. while (count--)
  39. scr_writew(scr_readw(s++), d++);
  40. }
  41. #endif
  42. #ifndef VT_BUF_HAVE_MEMMOVEW
  43. static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
  44. {
  45. if (d < s)
  46. scr_memcpyw(d, s, count);
  47. else {
  48. count /= 2;
  49. d += count;
  50. s += count;
  51. while (count--)
  52. scr_writew(scr_readw(--s), --d);
  53. }
  54. }
  55. #endif
  56. #endif