OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [include/] [linux/] [libps2.h] - Blame information for rev 62

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 marcus.erl
#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
 
14
#define PS2_CMD_GETID           0x02f2
15
#define PS2_CMD_RESET_BAT       0x02ff
16
 
17
#define PS2_RET_BAT             0xaa
18
#define PS2_RET_ID              0x00
19
#define PS2_RET_ACK             0xfa
20
#define PS2_RET_NAK             0xfe
21
 
22
#define PS2_FLAG_ACK            1       /* Waiting for ACK/NAK */
23
#define PS2_FLAG_CMD            2       /* Waiting for command to finish */
24
#define PS2_FLAG_CMD1           4       /* Waiting for the first byte of command response */
25
#define PS2_FLAG_WAITID         8       /* Command execiting is GET ID */
26
 
27
struct ps2dev {
28
        struct serio *serio;
29
 
30
        /* Ensures that only one command is executing at a time */
31
        struct mutex cmd_mutex;
32
 
33
        /* Used to signal completion from interrupt handler */
34
        wait_queue_head_t wait;
35
 
36
        unsigned long flags;
37
        unsigned char cmdbuf[6];
38
        unsigned char cmdcnt;
39
        unsigned char nak;
40
};
41
 
42
void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
43
int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
44
void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
45
int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
46
int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command);
47
int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
48
int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
49
void ps2_cmd_aborted(struct ps2dev *ps2dev);
50
int ps2_is_keyboard_id(char id);
51
 
52
#endif /* _LIBPS2_H */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.