Import 2.1.129pre2
[davej-history.git] / include / asm-ppc / adb.h
blob58fcb8abe550337d4aca897149be269b3685515c
1 /*
2 * Definitions for ADB (Apple Desktop Bus) support.
3 */
4 #ifndef __PPC_ADB_H
5 #define __PPC_ADB_H
7 /* ADB commands */
8 #define ADB_BUSRESET 0
9 #define ADB_FLUSH(id) (1 + ((id) << 4))
10 #define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4))
11 #define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4))
13 /* ADB default device IDs (upper 4 bits of ADB command byte) */
14 #define ADB_DONGLE 1 /* "software execution control" devices */
15 #define ADB_KEYBOARD 2
16 #define ADB_MOUSE 3
17 #define ADB_TABLET 4
18 #define ADB_MODEM 5
19 #define ADB_MISC 7 /* maybe a monitor */
21 #define ADB_RET_OK 0
22 #define ADB_RET_TIMEOUT 3
24 #ifdef __KERNEL__
26 struct adb_request {
27 unsigned char data[32];
28 int nbytes;
29 unsigned char reply[32];
30 int reply_len;
31 unsigned char reply_expected;
32 unsigned char sent;
33 unsigned char complete;
34 void (*done)(struct adb_request *);
35 void *arg;
36 struct adb_request *next;
39 struct adb_ids {
40 int nids;
41 unsigned char id[16];
44 extern enum adb_hw {
45 ADB_NONE, ADB_VIACUDA, ADB_VIAPMU, ADB_MACIO
46 } adb_hardware;
48 extern int (*adb_send_request)(struct adb_request *req, int sync);
49 extern int (*adb_autopoll)(int devs);
50 extern int (*adb_reset_bus)(void);
52 /* Values for adb_request flags */
53 #define ADBREQ_REPLY 1 /* expect reply */
54 #define ADBREQ_SYNC 2 /* poll until done */
56 void adb_init(void);
57 int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
58 int flags, int nbytes, ...);
59 int adb_register(int default_id,int handler_id,struct adb_ids *ids,
60 void (*handler)(unsigned char *, int, struct pt_regs *, int));
61 void adb_input(unsigned char *, int, struct pt_regs *, int);
63 #endif /* __KERNEL__ */
65 #endif /* __PPC_ADB_H */