Subversion Repositories pentevo

Rev

Rev 126 | Rev 299 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef PS2_H
  2. #define PS2_H
  3.  
  4. /**
  5.  * @file
  6.  * @brief PS/2 mouse and keyboard support.
  7.  * @author http://www.nedopc.com
  8.  *
  9.  * PS/2 keyboard support (read only).
  10.  *
  11.  * PS/2 mouse support (read/write).
  12.  * ZX Kempston mouse interface emulation.
  13.  *
  14.  * Support PS/2 mouses:
  15.  * - "microsoft" mouses with wheel (4bytes data);
  16.  * - classic mouses (3bytes data).
  17.  */
  18.  
  19. /**
  20.  * Decode received data.
  21.  * @return decoded data.
  22.  * @param count - counter.
  23.  * @param shifter - received bits.
  24.  */
  25. UBYTE ps2_decode(UBYTE count, UWORD shifter);
  26.  
  27. /**
  28.  * Encode (prepare) sended data.
  29.  * @return encoded data.
  30.  * @param data - data to send.
  31.  */
  32. UWORD ps2_encode(UBYTE data);
  33.  
  34. /** Timeout value for PS/2 keyboard. */
  35. #define PS2KEYBOARD_TIMEOUT 20
  36.  
  37. /** Received PS/2 keyboard data register. */
  38. extern volatile UWORD ps2keyboard_shifter;
  39. /** Counter of current PS/2 keyboard data bit. */
  40. extern volatile UBYTE ps2keyboard_count;
  41. /** Timeout register for detecting PS/2 keyboard timeouts. */
  42. extern volatile UBYTE ps2keyboard_timeout;
  43.  
  44. /** PS/2 keyboard task. */
  45. void ps2keyboard_task(void);
  46.  
  47. /**
  48.  * Parsing PS/2 keboard recived bytes .
  49.  * @param recbyte [in] - received byte.
  50.  */
  51. void ps2keyboard_parse(UBYTE recbyte);
  52.  
  53. /** Timeout for waiting response from mouse. */
  54. #define PS2MOUSE_TIMEOUT 20
  55. /** Received/sended PS/2 mouse data register. */
  56. extern volatile UWORD ps2mouse_shifter;
  57. /** Counter of current PS/2 mouse data bit. */
  58. extern volatile UBYTE ps2mouse_count;
  59. /** Timeout register for detecting PS/2 mouse timeouts. */
  60. extern volatile UBYTE ps2mouse_timeout;
  61. /** Index of PS/2 mouse initialization step (@see ps2mouse_init_sequence). */
  62. extern volatile UBYTE ps2mouse_initstep;
  63. /** Counter of PS/2 mouse response bytes. */
  64. extern volatile UBYTE ps2mouse_resp_count;
  65.  
  66. /** PS/2 mouse task. */
  67. void ps2mouse_task(void);
  68.  
  69. #endif //PS2_H
  70.  
  71.