plan 9 kernel history: overview | file list | diff list

pc/vgatvp3020.c (diff list | history)

1994/0624/sys/src/9/pc/vgatvp3020.c:59,651994/0729/sys/src/9/pc/vgatvp3020.c:59,65 (short | long)
1994/0624    
	uchar p, p0, p1; 
	int x, y; 
 
	lock(&pallettelock); 
1994/0729    
	lock(&palettelock); 
1994/0624    
 
	/* 
	 * Make sure cursor is off by initialising the cursor 
1994/0624/sys/src/9/pc/vgatvp3020.c:147,1531994/0729/sys/src/9/pc/vgatvp3020.c:147,153
1994/0624    
 
	tvp3020xo(0x06, 0x40|0x10);			/* Cursor Control Register */ 
 
	unlock(&pallettelock); 
1994/0729    
	unlock(&palettelock); 
1994/0624    
} 
 
static void 
1994/0624/sys/src/9/pc/vgatvp3020.c:155,1611994/0729/sys/src/9/pc/vgatvp3020.c:155,161
1994/0624    
{ 
	uchar r; 
 
	lock(&pallettelock); 
1994/0729    
	lock(&palettelock); 
1994/0624    
 
	/* 
	 * Make sure cursor is off by initialising the cursor 
1994/0624/sys/src/9/pc/vgatvp3020.c:172,1781994/0729/sys/src/9/pc/vgatvp3020.c:172,178
1994/0624    
	tvp3020xo(0x23, 0xFF); tvp3020xo(0x24, 0xFF); tvp3020xo(0x25, 0xFF); 
	tvp3020xo(0x26, 0x00); tvp3020xo(0x27, 0x00); tvp3020xo(0x28, 0x00); 
 
	unlock(&pallettelock); 
1994/0729    
	unlock(&palettelock); 
1994/0624    
 
	/* 
	 * Finally, enable 
1994/0624/sys/src/9/pc/vgatvp3020.c:189,1951994/0729/sys/src/9/pc/vgatvp3020.c:189,195
1994/0624    
static int 
move(Point p) 
{ 
	if(canlock(&pallettelock) == 0) 
1994/0729    
	if(canlock(&palettelock) == 0) 
1994/0624    
		return 1; 
 
	tvp3020xo(0x00, p.x & 0xFF);			/* Cursor Position X LSB */ 
1994/0624/sys/src/9/pc/vgatvp3020.c:197,2031994/0729/sys/src/9/pc/vgatvp3020.c:197,203
1994/0624    
	tvp3020xo(0x02, p.y & 0xFF);			/* Cursor Position Y LSB */ 
	tvp3020xo(0x03, (p.y>>8) & 0x0F);		/* Cursor Position Y MSB */ 
 
	unlock(&pallettelock); 
1994/0729    
	unlock(&palettelock); 
1994/0624    
	return 0; 
} 
 
1994/0624/sys/src/9/pc/vgatvp3020.c:212,2201994/0729/sys/src/9/pc/vgatvp3020.c:212,220
1994/0624    
	 *	cursor control enable for Bt485 DAC (!); 
	 *	the hardware cursor external operation mode. 
	 */ 
	lock(&pallettelock); 
1994/0729    
	lock(&palettelock); 
1994/0624    
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
	unlock(&pallettelock); 
1994/0729    
	unlock(&palettelock); 
1994/0624    
 
	r = vgaxi(Crtx, 0x45) & ~0x20; 
	vgaxo(Crtx, 0x45, r); 
1994/0729/sys/src/9/pc/vgatvp3020.c:9,141994/0810/sys/src/9/pc/vgatvp3020.c:9,16 (short | long)
1994/0624    
#include "screen.h" 
#include "vga.h" 
 
1994/0810    
extern Cursor curcursor; 
 
1994/0624    
/* 
 * TVP3020 Viewpoint Video Interface Pallette. 
 * Assumes hooked up to an S3 86C928. 
1994/0729/sys/src/9/pc/vgatvp3020.c:59,651994/0810/sys/src/9/pc/vgatvp3020.c:61,79
1994/0624    
	uchar p, p0, p1; 
	int x, y; 
 
1994/0810    
	/* 
	 * Lock the DAC registers so we can update the 
	 * cursor bitmap if necessary. 
	 * If it's the same as the last cursor we loaded, 
	 * just make sure it's enabled. 
	 */ 
1994/0729    
	lock(&palettelock); 
1994/0810    
	if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ 
		tvp3020xo(0x06, 0x40|0x10);		/* Cursor Control Register */ 
		unlock(&palettelock); 
		return; 
	} 
	memmove(&curcursor, c, sizeof(Cursor)); 
1994/0624    
 
	/* 
	 * Make sure cursor is off by initialising the cursor 
1994/0810/sys/src/9/pc/vgatvp3020.c:30,361995/0126/sys/src/9/pc/vgatvp3020.c:30,36 (short | long)
1994/0624    
 * addressing. 
 */ 
static ushort dacxreg[4] = { 
	DACWx, DACData, DACMask, DACSts 
1995/0126    
	PaddrW, Pdata, Pixmask, PaddrR 
1994/0624    
}; 
 
static uchar 
1994/0810/sys/src/9/pc/vgatvp3020.c:182,1901995/0126/sys/src/9/pc/vgatvp3020.c:182,190
1994/0624    
	 * cursor colour 1 (white), 
	 * cursor colour 2 (black). 
	 */ 
	tvp3020xo(0x20, 0xFF); tvp3020xo(0x21, 0xFF); tvp3020xo(0x22, 0xFF); 
	tvp3020xo(0x23, 0xFF); tvp3020xo(0x24, 0xFF); tvp3020xo(0x25, 0xFF); 
	tvp3020xo(0x26, 0x00); tvp3020xo(0x27, 0x00); tvp3020xo(0x28, 0x00); 
1995/0126    
	tvp3020xo(0x20, Pwhite); tvp3020xo(0x21, Pwhite); tvp3020xo(0x22, Pwhite); 
	tvp3020xo(0x23, Pwhite); tvp3020xo(0x24, Pwhite); tvp3020xo(0x25, Pwhite); 
	tvp3020xo(0x26, Pblack); tvp3020xo(0x27, Pblack); tvp3020xo(0x28, Pblack); 
1994/0624    
 
1994/0729    
	unlock(&palettelock); 
1994/0624    
 
1994/0810/sys/src/9/pc/vgatvp3020.c:243,2461995/0126/sys/src/9/pc/vgatvp3020.c:243,254
1994/0624    
	load, 
	move, 
	disable, 
1995/0126    
 
	0, 
1994/0624    
}; 
1995/0126    
 
void 
vgatvp3020link(void) 
{ 
	addhwgclink(&tvp3020hwgc); 
} 
1995/0126/sys/src/9/pc/vgatvp3020.c:5,281997/1101/sys/src/9/pc/vgatvp3020.c:5,22 (short | long)
1994/0624    
#include "fns.h" 
#include "../port/error.h" 
 
#include <libg.h> 
1997/1101    
#define	Image	IMAGE 
#include <draw.h> 
#include <memdraw.h> 
1994/0624    
#include "screen.h" 
#include "vga.h" 
 
1994/0810    
extern Cursor curcursor; 
                 
1994/0624    
/* 
 * TVP3020 Viewpoint Video Interface Pallette. 
 * Assumes hooked up to an S3 86C928. 
 */ 
enum { 
	AddrW		= 0x00,		/* Palette address register - write mode */ 
	Palette		= 0x01,		/* Color palette holding register */ 
	Pmask		= 0x02,		/* Pixel read mask */ 
	AddrR		= 0x03,		/* Palette address register - read mode */ 
                 
	Index		= 0x06,		/* Index register */ 
	Data		= 0x07,		/* Data register */ 
1997/1101    
	Index		= 0x06,				/* Index register */ 
	Data		= 0x07,				/* Data register */ 
1994/0624    
}; 
 
/* 
1995/0126/sys/src/9/pc/vgatvp3020.c:56,801997/1101/sys/src/9/pc/vgatvp3020.c:50,79
1994/0624    
} 
 
static void 
load(Cursor *c) 
1997/1101    
tvp3020disable(VGAscr*) 
1994/0624    
{ 
	uchar p, p0, p1; 
	int x, y; 
1997/1101    
	uchar r; 
1994/0624    
 
1994/0810    
	/* 
	 * Lock the DAC registers so we can update the 
	 * cursor bitmap if necessary. 
	 * If it's the same as the last cursor we loaded, 
	 * just make sure it's enabled. 
1997/1101    
	 * Disable  
	 *	cursor; 
	 *	cursor control enable for Bt485 DAC (!); 
	 *	the hardware cursor external operation mode. 
1994/0810    
	 */ 
1994/0729    
	lock(&palettelock); 
1994/0810    
	if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ 
		tvp3020xo(0x06, 0x40|0x10);		/* Cursor Control Register */ 
		unlock(&palettelock); 
		return; 
	} 
	memmove(&curcursor, c, sizeof(Cursor)); 
1997/1101    
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
1994/0624    
 
1997/1101    
	r = vgaxi(Crtx, 0x45) & ~0x20; 
	vgaxo(Crtx, 0x45, r); 
 
	r = vgaxi(Crtx, 0x55) & ~0x20; 
	vgaxo(Crtx, 0x55, r); 
} 
 
static void 
tvp3020enable(VGAscr*) 
{ 
	uchar r; 
 
1994/0624    
	/* 
	 * Make sure cursor is off by initialising the cursor 
	 * control to defaults + X-Windows cursor mode. 
1995/0126/sys/src/9/pc/vgatvp3020.c:82,871997/1101/sys/src/9/pc/vgatvp3020.c:81,119
1994/0624    
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
 
	/* 
1997/1101    
	 * Overscan colour, 
	 * cursor colour 1 (white), 
	 * cursor colour 2 (black). 
	 */ 
	tvp3020xo(0x20, Pwhite); tvp3020xo(0x21, Pwhite); tvp3020xo(0x22, Pwhite); 
	tvp3020xo(0x23, Pwhite); tvp3020xo(0x24, Pwhite); tvp3020xo(0x25, Pwhite); 
	tvp3020xo(0x26, Pblack); tvp3020xo(0x27, Pblack); tvp3020xo(0x28, Pblack); 
 
	/* 
	 * Finally, enable 
	 *	the hardware cursor external operation mode; 
	 *	cursor control enable for Bt485 DAC (!). 
	 */ 
	r = vgaxi(Crtx, 0x55)|0x20; 
	vgaxo(Crtx, 0x55, r); 
 
	r = vgaxi(Crtx, 0x45)|0x20; 
	vgaxo(Crtx, 0x45, r); 
} 
 
static void 
tvp3020load(VGAscr*, Cursor* curs) 
{ 
	uchar p, p0, p1; 
	int x, y; 
 
	/* 
	 * Make sure cursor is off by initialising the cursor 
	 * control to defaults + X-Windows cursor mode. 
	 */ 
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
 
	/* 
1994/0624    
	 * Initialise the cursor RAM LS and MS address 
	 * (LS must be first). 
	 */ 
1995/0126/sys/src/9/pc/vgatvp3020.c:104,1111997/1101/sys/src/9/pc/vgatvp3020.c:136,143
1994/0624    
	for(y = 0; y < 64; y++){ 
		for(x = 0; x < 64/8; x++){ 
			if(x < 16/8 && y < 16){ 
				p0 = c->clr[x+y*2]; 
				p1 = c->set[x+y*2]; 
1997/1101    
				p0 = curs->clr[x+y*2]; 
				p1 = curs->set[x+y*2]; 
1994/0624    
 
				p = 0x00; 
				if(p1 & 0x10) 
1995/0126/sys/src/9/pc/vgatvp3020.c:153,2541997/1101/sys/src/9/pc/vgatvp3020.c:185,215
1994/0624    
	} 
 
	/* 
	 * Initialise the cursor hot-point 
1997/1101    
	 * Initialise the cursor hotpoint 
1994/0624    
	 * and enable the cursor. 
	 */ 
	tvp3020xo(0x04, -c->offset.x);			/* Sprite Origin X */ 
	tvp3020xo(0x05, -c->offset.y);			/* Sprite Origin Y */ 
1997/1101    
	tvp3020xo(0x04, -curs->offset.x);		/* Sprite Origin X */ 
	tvp3020xo(0x05, -curs->offset.y);		/* Sprite Origin Y */ 
1994/0624    
 
	tvp3020xo(0x06, 0x40|0x10);			/* Cursor Control Register */ 
                 
1994/0729    
	unlock(&palettelock); 
1994/0624    
} 
 
static void 
enable(void) 
{ 
	uchar r; 
                 
1994/0729    
	lock(&palettelock); 
1994/0624    
                 
	/* 
	 * Make sure cursor is off by initialising the cursor 
	 * control to defaults + X-Windows cursor mode. 
	 */ 
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
                 
	/* 
	 * Overscan colour, 
	 * cursor colour 1 (white), 
	 * cursor colour 2 (black). 
	 */ 
1995/0126    
	tvp3020xo(0x20, Pwhite); tvp3020xo(0x21, Pwhite); tvp3020xo(0x22, Pwhite); 
	tvp3020xo(0x23, Pwhite); tvp3020xo(0x24, Pwhite); tvp3020xo(0x25, Pwhite); 
	tvp3020xo(0x26, Pblack); tvp3020xo(0x27, Pblack); tvp3020xo(0x28, Pblack); 
1994/0624    
                 
1994/0729    
	unlock(&palettelock); 
1994/0624    
                 
	/* 
	 * Finally, enable 
	 *	the hardware cursor external operation mode; 
	 *	cursor control enable for Bt485 DAC (!). 
	 */ 
	r = vgaxi(Crtx, 0x55)|0x20; 
	vgaxo(Crtx, 0x55, r); 
                 
	r = vgaxi(Crtx, 0x45)|0x20; 
	vgaxo(Crtx, 0x45, r); 
} 
                 
static int 
move(Point p) 
1997/1101    
tvp3020move(VGAscr*, Point p) 
1994/0624    
{ 
1994/0729    
	if(canlock(&palettelock) == 0) 
1994/0624    
		return 1; 
                 
	tvp3020xo(0x00, p.x & 0xFF);			/* Cursor Position X LSB */ 
	tvp3020xo(0x01, (p.x>>8) & 0x0F);		/* Cursor Position X MSB */ 
	tvp3020xo(0x02, p.y & 0xFF);			/* Cursor Position Y LSB */ 
	tvp3020xo(0x03, (p.y>>8) & 0x0F);		/* Cursor Position Y MSB */ 
 
1994/0729    
	unlock(&palettelock); 
1994/0624    
	return 0; 
} 
 
static void 
disable(void) 
{ 
	uchar r; 
                 
	/* 
	 * Disable  
	 *	cursor; 
	 *	cursor control enable for Bt485 DAC (!); 
	 *	the hardware cursor external operation mode. 
	 */ 
1994/0729    
	lock(&palettelock); 
1994/0624    
	tvp3020xo(0x06, 0x10);				/* Cursor Control Register */ 
1994/0729    
	unlock(&palettelock); 
1994/0624    
                 
	r = vgaxi(Crtx, 0x45) & ~0x20; 
	vgaxo(Crtx, 0x45, r); 
                 
	r = vgaxi(Crtx, 0x55) & ~0x20; 
	vgaxo(Crtx, 0x55, r); 
} 
                 
Hwgc tvp3020hwgc = { 
1997/1101    
VGAcur vgatvp3020cur = { 
1994/0624    
	"tvp3020hwgc", 
	enable, 
	load, 
	move, 
	disable, 
1995/0126    
 
	0, 
1997/1101    
	tvp3020enable, 
	tvp3020disable, 
	tvp3020load, 
	tvp3020move, 
1994/0624    
}; 
1995/0126    
                 
void 
vgatvp3020link(void) 
{ 
	addhwgclink(&tvp3020hwgc); 
} 
1997/1101/sys/src/9/pc/vgatvp3020.c:8,131999/0119/sys/src/9/pc/vgatvp3020.c:8,14 (short | long)
1997/1101    
#define	Image	IMAGE 
#include <draw.h> 
#include <memdraw.h> 
1999/0119    
#include <cursor.h> 
1994/0624    
#include "screen.h" 
 
/* 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)