Blame view

include/i8042.h 2.49 KB
1df49e27b   wdenk   Initial revision
1
2
3
4
  /*
   * (C) Copyright 2002 ELTEC Elektronik AG
   * Frank Gottschling <fgottschling@eltec.de>
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
1df49e27b   wdenk   Initial revision
6
7
8
9
10
11
   */
  
  /* i8042.h - Intel 8042 keyboard driver header */
  
  #ifndef _I8042_H_
  #define _I8042_H_
7a8e9bed1   wdenk   * Patch by Marc S...
12
13
14
15
16
17
  #ifdef __I386__
  #include <common.h>
  #include <asm/io.h>
  #define in8(p) inb(p)
  #define out8(p,v) outb(v,p)
  #endif
1df49e27b   wdenk   Initial revision
18
  /* defines */
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
19
20
21
  #define I8042_DATA_REG      (CONFIG_SYS_ISA_IO + 0x0060)    /* keyboard i/o buffer */
  #define I8042_STATUS_REG    (CONFIG_SYS_ISA_IO + 0x0064)    /* keyboard status read */
  #define I8042_COMMAND_REG   (CONFIG_SYS_ISA_IO + 0x0064)    /* keyboard ctrl write */
1df49e27b   wdenk   Initial revision
22

ef94f7fa6   Gabe Black   input: Use finer ...
23
24
25
26
27
  enum {
  	/* Output register (I8042_DATA_REG) has data for system */
  	I8042_STATUS_OUT_DATA	= 1 << 0,
  	I8042_STATUS_IN_DATA	= 1 << 1,
  };
1df49e27b   wdenk   Initial revision
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  #define KBD_US              0        /* default US layout */
  #define KBD_GER             1        /* german layout */
  
  #define KBD_TIMEOUT         1000     /* 1 sec */
  #define KBD_RESET_TRIES     3
  
  #define AS                  0        /* normal character index */
  #define SH                  1        /* shift index */
  #define CN                  2        /* control index */
  #define NM                  3        /* numeric lock index */
  #define AK                  4        /* right alt key */
  #define CP                  5        /* capslock index */
  #define ST                  6        /* stop output index */
  #define EX                  7        /* extended code index */
  #define ES                  8        /* escape and extended code index */
  
  #define NORMAL              0x0000    /* normal key */
  #define STP                 0x0001    /* scroll lock stop output*/
  #define NUM                 0x0002    /* numeric lock */
  #define CAPS                0x0004    /* capslock */
  #define SHIFT               0x0008    /* shift */
  #define CTRL                0x0010    /* control*/
  #define EXT                 0x0020    /* extended scan code 0xe0 */
  #define ESC                 0x0040    /* escape key press */
  #define E1                  0x0080    /* extended scan code 0xe1 */
  #define BRK                 0x0100    /* make break flag for keyboard */
  #define ALT                 0x0200    /* right alt */
  
  /* exports */
45fe668f5   Louis Yung-Chieh Lo   input: i8042: Pro...
57
58
59
60
61
62
63
64
65
66
67
68
  /**
   * Flush all buffer from keyboard controller to host.
   */
  void i8042_flush(void);
  
  /**
   * Disables the keyboard so that key strokes no longer generate scancodes to
   * the host.
   *
   * @return 0 if ok, -1 if keyboard input was found while disabling
   */
  int i8042_disable(void);
1df49e27b   wdenk   Initial revision
69
70
71
72
73
  int i8042_kbd_init(void);
  int i8042_tstc(void);
  int i8042_getc(void);
  
  #endif /* _I8042_H_ */