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);
  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 short __scrollback_mode;
  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  * The "(unsigned long) addr < video_mem_term" tests for an Alpha kernel
  81  *  virtual address less than the end of the "shadow scrren" memory. This
  82  *  indicates we really want to write to the screen, so, we do... :-)
  83  *
  84  * NOTE: we must guarantee that video_mem_term is less than *any* VC's backing
  85  * store; to do that, we must allocate it earlier than any VC's are done.
  86  *
  87  * NOTE also: there's only *TWO* operations: to put/get a character/attribute.
  88  *  All the others needed by VGA support go away, as Not Applicable for TGA.
  89  */
  90 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  91 {
  92         /*
  93         * always deposit the char/attr, then see if it was to "screen" mem.
  94          * if so, then render the char/attr onto the real screen.
  95         */
  96         *addr = val;
  97         if ((unsigned long)addr < video_mem_term) {
  98                 tga_blitc(val, (unsigned long) addr);
  99         }
 100 }
 101 
 102 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 103 {
 104         return *addr;
 105 }
 106 #else /* CONFIG_TGA_CONSOLE */
 107 
 108 /*
 109  * normal VGA console access
 110  *
 111  */ 
 112 
 113 #ifdef __alpha__
 114 
 115 #include <asm/io.h> 
 116 
 117 /*
 118  * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this
 119  *  indicates a VC's backing store; otherwise, it's a bus memory address, for
 120  *  the VGA's screen memory, so we do the Alpha "swizzle"... :-)
 121  */
 122 static inline void scr_writeb(unsigned char val, unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 123 {
 124         if ((long) addr < 0)
 125                 *addr = val;
 126         else
 127                 writeb(val, (unsigned long) addr);
 128 }
 129 
 130 static inline unsigned char scr_readb(unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 131 {
 132         if ((long) addr < 0)
 133                 return *addr;
 134         return readb((unsigned long) addr);
 135 }
 136 
 137 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 138 {
 139         if ((long) addr < 0)
 140                 *addr = val;
 141         else
 142                 writew(val, (unsigned long) addr);
 143 }
 144 
 145 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 146 {
 147         if ((long) addr < 0)
 148                 return *addr;
 149         return readw((unsigned long) addr);
 150 }
 151 
 152 #else /* __alpha__ */
 153 /*
 154  * normal VGA console access
 155  * 
 156  * NOTE: these do normal PC-style frame buffer accesses
 157  */
 158 static inline void scr_writeb(unsigned char val, unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 159 {
 160         *addr = val;
 161 }
 162 
 163 static inline unsigned char scr_readb(unsigned char * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 164 {
 165         return *addr;
 166 }
 167 
 168 static inline void scr_writew(unsigned short val, unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 169 {
 170         *addr = val;
 171 }
 172 
 173 static inline unsigned short scr_readw(unsigned short * addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 174 {
 175         return *addr;
 176 }
 177 
 178 #endif /* __alpha__ */
 179 #endif /* CONFIG_TGA_CONSOLE */
 180 
 181 static inline void memsetw(void * s, unsigned short c, unsigned int count)
     /* [previous][next][first][last][top][bottom][index][help] */
 182 {
 183         unsigned short * addr = (unsigned short *) s;
 184 
 185         count /= 2;
 186         while (count) {
 187                 count--;
 188                 scr_writew(c, addr++);
 189         }
 190 }
 191 
 192 static inline void memcpyw(unsigned short *to, unsigned short *from,
     /* [previous][next][first][last][top][bottom][index][help] */
 193                            unsigned int count)
 194 {
 195         count /= 2;
 196         while (count) {
 197                 count--;
 198                 scr_writew(scr_readw(from++), to++);
 199         }
 200 }

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