Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  Access to VGA videoram
0004  *
0005  *  (c) 1998 Martin Mares <mj@ucw.cz>
0006  */
0007 #ifndef _ASM_VGA_H
0008 #define _ASM_VGA_H
0009 
0010 #include <linux/string.h>
0011 #include <asm/addrspace.h>
0012 #include <asm/byteorder.h>
0013 
0014 /*
0015  *  On the PC, we can just recalculate addresses and then
0016  *  access the videoram directly without any black magic.
0017  */
0018 
0019 #define VGA_MAP_MEM(x, s)   CKSEG1ADDR(0x10000000L + (unsigned long)(x))
0020 
0021 #define vga_readb(x)    (*(x))
0022 #define vga_writeb(x, y)    (*(y) = (x))
0023 
0024 #define VT_BUF_HAVE_RW
0025 /*
0026  *  These are only needed for supporting VGA or MDA text mode, which use little
0027  *  endian byte ordering.
0028  *  In other cases, we can optimize by using native byte ordering and
0029  *  <linux/vt_buffer.h> has already done the right job for us.
0030  */
0031 
0032 #undef scr_writew
0033 #undef scr_readw
0034 
0035 static inline void scr_writew(u16 val, volatile u16 *addr)
0036 {
0037     *addr = cpu_to_le16(val);
0038 }
0039 
0040 static inline u16 scr_readw(volatile const u16 *addr)
0041 {
0042     return le16_to_cpu(*addr);
0043 }
0044 
0045 static inline void scr_memsetw(u16 *s, u16 v, unsigned int count)
0046 {
0047     memset16(s, cpu_to_le16(v), count / 2);
0048 }
0049 
0050 #define scr_memcpyw(d, s, c) memcpy(d, s, c)
0051 #define scr_memmovew(d, s, c) memmove(d, s, c)
0052 #define VT_BUF_HAVE_MEMCPYW
0053 #define VT_BUF_HAVE_MEMMOVEW
0054 #define VT_BUF_HAVE_MEMSETW
0055 
0056 #endif /* _ASM_VGA_H */