Esempio n. 1
0
int i8042_self_test()
{
	int n, r;
	for (n = 0; n < 5; n++) {
		i8042_write_command(I8042_CMD_TEST_CONTROLLER);
		r = i8042_read_data();
		if (r == 0x55)
			return 0;
	}
	return -1;
}
Esempio n. 2
0
u8int i8042_controller_self_test() {	//4
	if ( DEBUG_KBD ) {
		printf ( "controller self test" );
	}

	i8042_write_command ( 0xAA );
	u8int resp = i8042_read_data();
	resp = i8042_read_data();

	if ( DEBUG_KBD ) {
		if ( resp == 0x55 ) {
			printf ( "PASS\n" );
		}

		if ( resp == 0xFC ) {
			printf ( "FAIL\n" );
		}
	}

	return 0;
}
Esempio n. 3
0
u8int i8042_flush_output_buffer() {	//2
	if ( DEBUG_KBD ) {
		printf ( "flushing output buffer" );
	}

	u8int i = 0;
	u8int c;

	while ( i < I8042_BUFFER_SIZE ) {
		c = i8042_read_data();
		i++;
	}

	return 0;
}
Esempio n. 4
0
u8int i8042_enable_devices() {	//7
	if ( DEBUG_KBD ) {
		printf ( "enabling devices..." );
	}

	i8042_write_command ( 0xAE );

	i8042_write_command ( 0x20 );
	u8int stat = i8042_read_data();
	stat |= 1 << 0;
	stat |= 1 << 1;
	i8042_write_command ( 0x60 );
	i8042_write_data ( stat );
	return 0;
}
Esempio n. 5
0
u8int i8042_set_controller_config_byte() {	//3
	if ( DEBUG_KBD ) {
		printf ( "setting controller config byte" );
	}

	i8042_write_command ( 0x20 );
	status = i8042_read_data();
	status |= 1 << 0;
	status |= 1 << 1;
	status |= 1 << 6;
	i8042_write_command ( 0x60 );
	i8042_write_data ( status );

	if ( DEBUG_KBD && ! ( status & ( 1 << 5 ) ) ) {
		printf ( "DUAL PS/2 = YES\n" );    //TODO check if this is right
	}

	return 0;
}
Esempio n. 6
0
static irqreturn_t top_half(int irq, void *dev_id)
{
    #ifdef DEBUG
    to_tty_string("[simple_keyboard.c] Entring top_half.\n\r");
    #endif

    tasklet_data.status = i8042_read_status();
    tasklet_data.scancode = i8042_read_data(); 

    #ifdef DEBUG
    to_tty_string("[simple_keyboard.c] Got scancode\n\r");
    #endif
    printk(KERN_INFO "Got scancode %02x in top_half.\n", tasklet_data.scancode);

    if ((tasklet_data.scancode & BIT_SCANCODE) == 0x01)
        exit_driver();

    tasklet_schedule(&simple_keyboard_tasklet);

    return IRQ_HANDLED;
}
Esempio n. 7
0
inline uint8_t i8042_read_ram(uint8_t addr)
{
	i8042_write_command(I8042_CMD_READ_RAM(addr));
	return i8042_read_data();
}