示例#1
0
__initfunc(int atixl_busmouse_init(void))
{
	unsigned char a,b,c;

	a = inb( ATIXL_MSE_SIGNATURE_PORT );	/* Get signature */
	b = inb( ATIXL_MSE_SIGNATURE_PORT );
	c = inb( ATIXL_MSE_SIGNATURE_PORT );
	if (( a != b ) && ( a == c ))
		printk(KERN_INFO "\nATI Inport ");
	else
		return -EIO;
	outb(0x80, ATIXL_MSE_CONTROL_PORT);	/* Reset the Inport device */
	outb(0x07, ATIXL_MSE_CONTROL_PORT);	/* Select Internal Register 7 */
	outb(0x0a, ATIXL_MSE_DATA_PORT);	/* Data Interrupts 8+, 1=30hz, 2=50hz, 3=100hz, 4=200hz rate */

	msedev = register_busmouse(&atixlmouse);
	if (msedev < 0)
		printk("Bus mouse initialisation error.\n");
	else
		printk("Bus mouse detected and installed.\n");
	return msedev < 0 ? msedev : 0;
}
static int __init ms_bus_mouse_init(void)
{
	int present = 0;
	int mse_byte, i;

	if (check_region(MS_MSE_CONTROL_PORT, 0x04))
		return -ENODEV;

	if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) {

		mse_byte = inb_p(MS_MSE_SIGNATURE_PORT);

		for (i = 0; i < 4; i++) {
			if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) {
				if (inb_p(MS_MSE_SIGNATURE_PORT) == mse_byte)
					present = 1;
				else
					present = 0;
			} else
				present = 0;
		}
	}
	if (present == 0)
		return -EIO;
	if (!request_region(MS_MSE_CONTROL_PORT, 0x04, "MS Busmouse"))
		return -EIO;
	
	MS_MSE_INT_OFF();
	msedev = register_busmouse(&msbusmouse);
	if (msedev < 0) {
		printk(KERN_WARNING "Unable to register msbusmouse driver.\n");
		release_region(MS_MSE_CONTROL_PORT, 0x04);
	}
	else
		printk(KERN_INFO "Microsoft BusMouse detected and installed.\n");
	return msedev < 0 ? msedev : 0;
}
static int __init atixl_busmouse_init(void)
{
	unsigned char a,b,c;

	/*
	 *	We must request the resource and claim it atomically
	 *	nowdays. We can throw it away on error. Otherwise we
	 *	may race another module load of the same I/O
	 */

	if (!request_region(ATIXL_MSE_DATA_PORT, 3, "atixlmouse"))
		return -EIO;

	a = inb( ATIXL_MSE_SIGNATURE_PORT );	/* Get signature */
	b = inb( ATIXL_MSE_SIGNATURE_PORT );
	c = inb( ATIXL_MSE_SIGNATURE_PORT );
	if (( a != b ) && ( a == c ))
		printk(KERN_INFO "\nATI Inport ");
	else
	{
		release_region(ATIXL_MSE_DATA_PORT,3);
		return -EIO;
	}
	outb(0x80, ATIXL_MSE_CONTROL_PORT);	/* Reset the Inport device */
	outb(0x07, ATIXL_MSE_CONTROL_PORT);	/* Select Internal Register 7 */
	outb(0x0a, ATIXL_MSE_DATA_PORT);	/* Data Interrupts 8+, 1=30hz, 2=50hz, 3=100hz, 4=200hz rate */

	msedev = register_busmouse(&atixlmouse);
	if (msedev < 0)
	{
		printk("Bus mouse initialisation error.\n");
		release_region(ATIXL_MSE_DATA_PORT,3);	/* Was missing */
	}
	else
		printk("Bus mouse detected and installed.\n");
	return msedev < 0 ? msedev : 0;
}