root/drivers/char/selection.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. scr_writew
  2. scr_readw
  3. scr_writeb
  4. scr_readb
  5. scr_writew
  6. scr_readw
  7. scr_writeb
  8. scr_readb
  9. scr_writew
  10. scr_readw
  11. memsetw
  12. memcpyw

   1 /*
   2  * selection.h
   3  *
   4  * Interface between console.c, tty_io.c, vt.c, vc_screen.c and selection.c
   5  */
   6 extern int sel_cons;
   7 
   8 extern void clear_selection(void);
   9 extern int set_selection(const unsigned long arg, struct tty_struct *tty, int user);
  10 extern int paste_selection(struct tty_struct *tty);
  11 extern int sel_loadlut(const unsigned long arg);
  12 extern int mouse_reporting(void);
  13 extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
  14 
  15 extern unsigned long video_num_columns;
  16 extern unsigned long video_num_lines;
  17 extern unsigned long video_size_row;
  18 extern unsigned char video_type;
  19 extern unsigned long video_mem_base;
  20 extern unsigned long video_mem_term;
  21 extern unsigned long video_screen_size;
  22 extern unsigned short video_port_reg;
  23 extern unsigned short video_port_val;
  24 
  25 extern int console_blanked;
  26 extern int can_do_color;
  27 
  28 extern unsigned long video_font_height;
  29 extern unsigned long video_scan_lines;
  30 extern unsigned long default_font_height;
  31 extern int video_font_is_default;
  32 
  33 extern unsigned char color_table[];
  34 extern int default_red[];
  35 extern int default_grn[];
  36 extern int default_blu[];
  37 
  38 extern unsigned short __real_origin;
  39 extern unsigned short __origin;
  40 extern unsigned char has_wrapped;
  41 
  42 extern unsigned short *vc_scrbuf[MAX_NR_CONSOLES];
  43 
  44 extern void do_unblank_screen(void);
  45 extern unsigned short *screen_pos(int currcons, int w_offset, int viewed);
  46 extern unsigned short screen_word(int currcons, int offset, int viewed);
  47 extern int scrw2glyph(unsigned short scr_word);
  48 extern void complement_pos(int currcons, int offset);
  49 extern void invert_screen(int currcons, int offset, int count, int shift);
  50 
  51 #define reverse_video_char(a)   (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77))
  52 #define reverse_video_short(a)  (((a) & 0x88ff) | \
  53         (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4))
  54 /* this latter line used to have masks 0xf000 and 0x0f00, but selection
  55    requires a self-inverse operation; moreover, the old version looks wrong */
  56 
  57 extern void getconsxy(int currcons, char *p);
  58 extern void putconsxy(int currcons, char *p);
  59 
  60 
  61 /* how to access screen memory */
  62 
  63 #include <linux/config.h>
  64 
  65 #ifdef CONFIG_TGA_CONSOLE
  66 
  67 extern int tga_blitc(unsigned int, unsigned long);
  68 extern unsigned long video_mem_term;
  69 
  70 /*
  71  * TGA console screen memory access
  72  * 
  73  * TGA is *not* a character/attribute cell device; font bitmaps must be rendered
  74  * to the screen pixels.
  75  *
  76  * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either
  77  * of the VC's backing store, or the "shadow screen" memory where the screen
  78  * contents are kept, as the TGA frame buffer is *not* char/attr cells.
  79  *
  80  * We must test for an Alpha kernel virtual address that falls within
  81  *  the "shadow screen" memory. This condition indicates we really want 
  82  *  to write to the screen, so, we do... :-)
  83  *
  84  * NOTE also: there's only *TWO* operations: to put/get a character/attribute.
  85  *  All the others needed by VGA support go away, as Not Applicable for TGA.
  86  */
  87 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  88 {
  89         /*
  90          * always deposit the char/attr, then see if it was to "screen" mem.
  91          * if so, then render the char/attr onto the real screen.
  92          */
  93         *addr = val;
  94         if ((unsigned long)addr < video_mem_term &&
  95             (unsigned long)addr >= video_mem_base) {
  96                 tga_blitc(val, (unsigned long) addr);
  97         }
  98 }
  99 
 100 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 101 {
 102         return *addr;
 103 }
 104 #else /* CONFIG_TGA_CONSOLE */
 105 
 106 /*
 107  * normal VGA console access
 108  *
 109  */ 
 110 
 111 #ifdef __alpha__
 112 
 113 #include <asm/io.h> 
 114 
 115 /*
 116  * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this
 117  *  indicates a VC's backing store; otherwise, it's a bus memory address, for
 118  *  the VGA's screen memory, so we do the Alpha "swizzle"... :-)
 119  */
 120 static inline void scr_writeb(unsigned char val, unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 121 {
 122         if ((long) addr < 0)
 123                 *addr = val;
 124         else
 125                 writeb(val, (unsigned long) addr);
 126 }
 127 
 128 static inline unsigned char scr_readb(unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 129 {
 130         if ((long) addr < 0)
 131                 return *addr;
 132         return readb((unsigned long) addr);
 133 }
 134 
 135 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 136 {
 137         if ((long) addr < 0)
 138                 *addr = val;
 139         else
 140                 writew(val, (unsigned long) addr);
 141 }
 142 
 143 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 144 {
 145         if ((long) addr < 0)
 146                 return *addr;
 147         return readw((unsigned long) addr);
 148 }
 149 
 150 #else /* __alpha__ */
 151 /*
 152  * normal VGA console access
 153  * 
 154  * NOTE: these do normal PC-style frame buffer accesses
 155  */
 156 static inline void scr_writeb(unsigned char val, unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 157 {
 158         *addr = val;
 159 }
 160 
 161 static inline unsigned char scr_readb(unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 162 {
 163         return *addr;
 164 }
 165 
 166 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 167 {
 168         *addr = val;
 169 }
 170 
 171 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 172 {
 173         return *addr;
 174 }
 175 
 176 #endif /* __alpha__ */
 177 #endif /* CONFIG_TGA_CONSOLE */
 178 
 179 static inline void memsetw(void * s, unsigned short c, unsigned int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 180 {
 181         unsigned short * addr = (unsigned short *) s;
 182 
 183         count /= 2;
 184         while (count) {
 185                 count--;
 186                 scr_writew(c, addr++);
 187         }
 188 }
 189 
 190 static inline void memcpyw(unsigned short *to, unsigned short *from,
     /* [previous][next][first][last][top][bottom][index][help] */
 191                            unsigned int count)
 192 {
 193         count /= 2;
 194         while (count) {
 195                 count--;
 196                 scr_writew(scr_readw(from++), to++);
 197         }
 198 }

/* [previous][next][first][last][top][bottom][index][help] */