2 * Definitions for talking to ADB and CUDA. The CUDA is a microcontroller
3 * which controls the ADB, system power, RTC, and various other things on
6 * Copyright (C) 1996 Paul Mackerras.
9 /* First byte sent to or received from CUDA */
12 #define ERROR_PACKET 2
13 #define TIMER_PACKET 3
14 #define POWER_PACKET 4
15 #define MACIIC_PACKET 5
17 /* ADB commands (2nd byte) */
18 #define ADB_BUSRESET 0
19 #define ADB_FLUSH(id) (1 + ((id) << 4))
20 #define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4))
21 #define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4))
23 /* ADB default device IDs (upper 4 bits of 2nd byte) */
24 #define ADB_DONGLE 1 /* "software execution control" devices */
25 #define ADB_KEYBOARD 2
29 #define ADB_MISC 7 /* maybe a monitor */
31 /* CUDA commands (2nd byte) */
32 #define CUDA_WARM_START 0
33 #define CUDA_AUTOPOLL 1
34 #define CUDA_GET_6805_ADDR 2
35 #define CUDA_GET_TIME 3
36 #define CUDA_GET_PRAM 7
37 #define CUDA_SET_6805_ADDR 8
38 #define CUDA_SET_TIME 9
39 #define CUDA_POWERDOWN 0xa
40 #define CUDA_POWERUP_TIME 0xb
41 #define CUDA_SET_PRAM 0xc
42 #define CUDA_MS_RESET 0xd
43 #define CUDA_SEND_DFAC 0xe
44 #define CUDA_RESET_SYSTEM 0x11
45 #define CUDA_SET_IPL 0x12
46 #define CUDA_SET_AUTO_RATE 0x14
47 #define CUDA_GET_AUTO_RATE 0x16
48 #define CUDA_SET_DEVICE_LIST 0x19
49 #define CUDA_GET_DEVICE_LIST 0x1a
50 #define CUDA_GET_SET_IIC 0x22
55 unsigned char data
[16];
57 unsigned char reply
[16];
59 unsigned char reply_expected
;
61 unsigned char got_reply
;
62 void (*done
)(struct adb_request
*);
64 struct adb_request
*next
;
67 void via_adb_init(void);
68 int adb_request(struct adb_request
*req
,
69 void (*done
)(struct adb_request
*), int nbytes
, ...);
70 int adb_send_request(struct adb_request
*req
);
72 int adb_register(int default_id
,
73 void (*handler
)(unsigned char *, int, struct pt_regs
*));