~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/libps2.h

Version: ~ [ linux-5.6 ] ~ [ linux-5.5.13 ] ~ [ linux-5.4.28 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.113 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.174 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.217 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.217 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.82 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LIBPS2_H
  2 #define _LIBPS2_H
  3 
  4 /*
  5  * Copyright (C) 1999-2002 Vojtech Pavlik
  6  * Copyright (C) 2004 Dmitry Torokhov
  7  *
  8  * This program is free software; you can redistribute it and/or modify it
  9  * under the terms of the GNU General Public License version 2 as published by
 10  * the Free Software Foundation.
 11  */
 12 
 13 #include <linux/bitops.h>
 14 #include <linux/mutex.h>
 15 #include <linux/types.h>
 16 #include <linux/wait.h>
 17 
 18 #define PS2_CMD_SETSCALE11      0x00e6
 19 #define PS2_CMD_SETRES          0x10e8
 20 #define PS2_CMD_GETID           0x02f2
 21 #define PS2_CMD_RESET_BAT       0x02ff
 22 
 23 #define PS2_RET_BAT             0xaa
 24 #define PS2_RET_ID              0x00
 25 #define PS2_RET_ACK             0xfa
 26 #define PS2_RET_NAK             0xfe
 27 #define PS2_RET_ERR             0xfc
 28 
 29 #define PS2_FLAG_ACK            BIT(0)  /* Waiting for ACK/NAK */
 30 #define PS2_FLAG_CMD            BIT(1)  /* Waiting for a command to finish */
 31 #define PS2_FLAG_CMD1           BIT(2)  /* Waiting for the first byte of command response */
 32 #define PS2_FLAG_WAITID         BIT(3)  /* Command executing is GET ID */
 33 #define PS2_FLAG_NAK            BIT(4)  /* Last transmission was NAKed */
 34 #define PS2_FLAG_ACK_CMD        BIT(5)  /* Waiting to ACK the command (first) byte */
 35 
 36 struct ps2dev {
 37         struct serio *serio;
 38 
 39         /* Ensures that only one command is executing at a time */
 40         struct mutex cmd_mutex;
 41 
 42         /* Used to signal completion from interrupt handler */
 43         wait_queue_head_t wait;
 44 
 45         unsigned long flags;
 46         u8 cmdbuf[8];
 47         u8 cmdcnt;
 48         u8 nak;
 49 };
 50 
 51 void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
 52 int ps2_sendbyte(struct ps2dev *ps2dev, u8 byte, unsigned int timeout);
 53 void ps2_drain(struct ps2dev *ps2dev, size_t maxbytes, unsigned int timeout);
 54 void ps2_begin_command(struct ps2dev *ps2dev);
 55 void ps2_end_command(struct ps2dev *ps2dev);
 56 int __ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command);
 57 int ps2_command(struct ps2dev *ps2dev, u8 *param, unsigned int command);
 58 int ps2_sliced_command(struct ps2dev *ps2dev, u8 command);
 59 bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data);
 60 bool ps2_handle_response(struct ps2dev *ps2dev, u8 data);
 61 void ps2_cmd_aborted(struct ps2dev *ps2dev);
 62 bool ps2_is_keyboard_id(u8 id);
 63 
 64 #endif /* _LIBPS2_H */
 65 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp