patch-1.3.38 linux/drivers/char/selection.h

Next file: linux/drivers/char/tga.c
Previous file: linux/drivers/char/scc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.37/linux/drivers/char/selection.h linux/drivers/char/selection.h
@@ -15,6 +15,31 @@
 extern unsigned long video_num_columns;
 extern unsigned long video_num_lines;
 extern unsigned long video_size_row;
+extern unsigned char video_type;
+extern unsigned long video_mem_base;
+extern unsigned long video_mem_term;
+extern unsigned long video_screen_size;
+extern unsigned short video_port_reg;
+extern unsigned short video_port_val;
+
+extern int console_blanked;
+extern int can_do_color;
+
+extern unsigned long video_font_height;
+extern unsigned long video_scan_lines;
+extern unsigned long default_font_height;
+extern int video_font_is_default;
+
+extern unsigned char color_table[];
+extern int default_red[];
+extern int default_grn[];
+extern int default_blu[];
+
+extern unsigned short __real_origin;
+extern unsigned short __origin;
+extern unsigned short __scrollback_mode;
+
+extern unsigned short *vc_scrbuf[MAX_NR_CONSOLES];
 
 extern void do_unblank_screen(void);
 extern unsigned short *screen_pos(int currcons, int w_offset, int viewed);
@@ -32,11 +57,68 @@
 extern void getconsxy(int currcons, char *p);
 extern void putconsxy(int currcons, char *p);
 
+
 /* how to access screen memory */
+
+#include <linux/config.h>
+
+#ifdef CONFIG_TGA_CONSOLE
+
+extern int tga_blitc(unsigned int, unsigned long);
+extern unsigned long video_mem_term;
+
+/*
+ * TGA console screen memory access
+ * 
+ * TGA is *not* a character/attribute cell device; font bitmaps must be rendered
+ * to the screen pixels.
+ *
+ * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either
+ * of the VC's backing store, or the "shadow screen" memory where the screen
+ * contents are kept, as the TGA frame buffer is *not* char/attr cells.
+ *
+ * The "(unsigned long) addr < video_mem_term" tests for an Alpha kernel
+ *  virtual address less than the end of the "shadow scrren" memory. This
+ *  indicates we really want to write to the screen, so, we do... :-)
+ *
+ * NOTE: we must guarantee that video_mem_term is less than *any* VC's backing
+ * store; to do that, we must allocate it earlier than any VC's are done.
+ *
+ * NOTE also: there's only *TWO* operations: to put/get a character/attribute.
+ *  All the others needed by VGA support go away, as Not Applicable for TGA.
+ */
+static inline void scr_writew(unsigned short val, unsigned short * addr)
+{
+        /*
+        * always deposit the char/attr, then see if it was to "screen" mem.
+	 * if so, then render the char/attr onto the real screen.
+        */
+        *addr = val;
+        if ((unsigned long)addr < video_mem_term) {
+                tga_blitc(val, (unsigned long) addr);
+        }
+}
+
+static inline unsigned short scr_readw(unsigned short * addr)
+{
+	return *addr;
+}
+#else /* CONFIG_TGA_CONSOLE */
+
+/*
+ * normal VGA console access
+ *
+ */ 
+
 #ifdef __alpha__
 
 #include <asm/io.h> 
 
+/*
+ * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this
+ *  indicates a VC's backing store; otherwise, it's a bus memory address, for
+ *  the VGA's screen memory, so we do the Alpha "swizzle"... :-)
+ */
 static inline void scr_writeb(unsigned char val, unsigned char * addr)
 {
 	if ((long) addr < 0)
@@ -67,8 +149,12 @@
 	return readw((unsigned long) addr);
 }
 
-#else
-
+#else /* __alpha__ */
+/*
+ * normal VGA console access
+ * 
+ * NOTE: these do normal PC-style frame buffer accesses
+ */
 static inline void scr_writeb(unsigned char val, unsigned char * addr)
 {
 	*addr = val;
@@ -89,4 +175,26 @@
 	return *addr;
 }
 
-#endif
+#endif /* __alpha__ */
+#endif /* CONFIG_TGA_CONSOLE */
+
+static inline void memsetw(void * s, unsigned short c, unsigned int count)
+{
+	unsigned short * addr = (unsigned short *) s;
+
+	count /= 2;
+	while (count) {
+		count--;
+		scr_writew(c, addr++);
+	}
+}
+
+static inline void memcpyw(unsigned short *to, unsigned short *from,
+			   unsigned int count)
+{
+	count /= 2;
+	while (count) {
+		count--;
+		scr_writew(scr_readw(from++), to++);
+	}
+}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this