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

1992/0904/pc/kbd.c (diff list | history)

1992/0902/sys/src/9/pc/kbd.c:112,1171992/0904/sys/src/9/pc/kbd.c:112,125 (short | long | prev | next)
1991/0905    
 */ 
static void	kbdintr(Ureg*); 
 
1992/0904    
enum 
{ 
	/* what kind of mouse */ 
	Mouseother=	0, 
	Mouseserial=	1, 
	MousePS2=	2, 
}; 
static int mousetype; 
1991/0703    
 
1991/0803    
/* 
 *  wait for output no longer busy 
1992/0902/sys/src/9/pc/kbd.c:207,2521992/0904/sys/src/9/pc/kbd.c:215,266
1991/0730    
		if(c & Inready) 
			inb(Data); 
 
1992/0902    
	switch(mousetype){ 
	case MousePS2: 
1992/0408    
		bigcursor(); 
		setvec(Mousevec, kbdintr); 
1992/0904    
	/* enable kbd xfers and interrupts */ 
	outb(Cmd, 0x60); 
	if(outready() < 0) 
		print("kbd init failed\n"); 
	outb(Data, 0x65); 
} 
1992/0408    
 
1991/1210    
		/* enable kbd/mouse xfers and interrupts */ 
		outb(Cmd, 0x60); 
		if(outready() < 0) 
			print("kbd init failed\n"); 
		outb(Data, 0x47); 
		if(outready() < 0) 
			print("kbd init failed\n"); 
		outb(Cmd, 0xA8); 
	                 
		/* make mouse streaming, enabled */ 
		if(mousecmd(0xEA) < 0 
		|| mousecmd(0xF4) < 0) 
			print("can't initialize mouse\n"); 
1992/0904    
/* 
 *  setup a serial mouse 
 */ 
void 
mouseserial(int port) 
{ 
	if(mousetype) 
		return; 
1992/0811    
 
		/* turn on mouse acceleration */ 
1992/0825    
		mouseaccelerate(0); 
1991/1210    
		break; 
1992/0902    
	case Mouseserial: 
1991/1210    
		/* enable kbd xfers and interrupts */ 
		outb(Cmd, 0x60); 
		if(outready() < 0) 
			print("kbd init failed\n"); 
		outb(Data, 0x65); 
1992/0904    
	/* set up /dev/eia0 as the mouse */ 
	uartspecial(port, 0, &mouseq, 1200); 
	mousetype = Mouseserial; 
} 
1992/0408    
 
		/* set up /dev/eia0 as the mouse */ 
		uartspecial(0, 0, &mouseq, 1200); 
1992/0825    
		break; 
1992/0902    
	case Mouseother: 
		/* enable kbd xfers and interrupts */ 
		outb(Cmd, 0x60); 
		if(outready() < 0) 
			print("kbd init failed\n"); 
		outb(Data, 0x65); 
		break; 
1992/0825    
	} 
1992/0904    
/* 
 *  set up a ps2 mouse 
 */ 
void 
mouseps2(void) 
{ 
	if(mousetype) 
		return; 
 
	bigcursor(); 
	setvec(Mousevec, kbdintr); 
 
	/* enable kbd/mouse xfers and interrupts */ 
	outb(Cmd, 0x60); 
	if(outready() < 0) 
		print("kbd init failed\n"); 
	outb(Data, 0x47); 
	if(outready() < 0) 
		print("kbd init failed\n"); 
	outb(Cmd, 0xA8); 
 
	/* make mouse streaming, enabled */ 
	mousecmd(0xEA); 
	mousecmd(0xF4); 
	mousetype = MousePS2; 
1992/0825    
} 
 
/* 
1992/0902/sys/src/9/pc/kbd.c:262,2671992/0904/sys/src/9/pc/kbd.c:276,296
1992/0825    
			mousecmd(0xE7); 
		else 
			mousecmd(0xE6); 
1992/0904    
		break; 
	} 
} 
 
/* 
 *  set mouse resolution 
 */ 
void 
mouseres(int res) 
{ 
 
	switch(mousetype){ 
	case MousePS2: 
		mousecmd(0xE8); 
		mousecmd(res); 
1991/1210    
		break; 
	} 
1991/0731    
} 


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