adb.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  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
  4. * later Macintoshes
  5. *
  6. * Copyright (C) 1996 Paul Mackerras.
  7. */
  8. /* First byte sent to or received from CUDA */
  9. #define ADB_PACKET 0
  10. #define CUDA_PACKET 1
  11. #define ERROR_PACKET 2
  12. #define TIMER_PACKET 3
  13. #define POWER_PACKET 4
  14. #define MACIIC_PACKET 5
  15. /* ADB commands (2nd byte) */
  16. #define ADB_BUSRESET 0
  17. #define ADB_FLUSH(id) (1 + ((id) << 4))
  18. #define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4))
  19. #define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4))
  20. /* ADB default device IDs (upper 4 bits of 2nd byte) */
  21. #define ADB_DONGLE 1 /* "software execution control" devices */
  22. #define ADB_KEYBOARD 2
  23. #define ADB_MOUSE 3
  24. #define ADB_TABLET 4
  25. #define ADB_MODEM 5
  26. #define ADB_MISC 7 /* maybe a monitor */
  27. /* CUDA commands (2nd byte) */
  28. #define CUDA_WARM_START 0
  29. #define CUDA_AUTOPOLL 1
  30. #define CUDA_GET_6805_ADDR 2
  31. #define CUDA_GET_TIME 3
  32. #define CUDA_GET_PRAM 7
  33. #define CUDA_SET_6805_ADDR 8
  34. #define CUDA_SET_TIME 9
  35. #define CUDA_POWERDOWN 0xa
  36. #define CUDA_POWERUP_TIME 0xb
  37. #define CUDA_SET_PRAM 0xc
  38. #define CUDA_MS_RESET 0xd
  39. #define CUDA_SEND_DFAC 0xe
  40. #define CUDA_RESET_SYSTEM 0x11
  41. #define CUDA_SET_IPL 0x12
  42. #define CUDA_SET_AUTO_RATE 0x14
  43. #define CUDA_GET_AUTO_RATE 0x16
  44. #define CUDA_SET_DEVICE_LIST 0x19
  45. #define CUDA_GET_DEVICE_LIST 0x1a
  46. #define CUDA_GET_SET_IIC 0x22
  47. #ifdef __KERNEL__
  48. struct adb_request {
  49. unsigned char data[16];
  50. int nbytes;
  51. unsigned char reply[16];
  52. int reply_len;
  53. unsigned char reply_expected;
  54. unsigned char sent;
  55. unsigned char got_reply;
  56. void (*done)(struct adb_request *);
  57. void *arg;
  58. struct adb_request *next;
  59. };
  60. void via_adb_init(void);
  61. int adb_request(struct adb_request *req,
  62. void (*done)(struct adb_request *), int nbytes, ...);
  63. int adb_send_request(struct adb_request *req);
  64. void adb_poll(void);
  65. int adb_register(int default_id,
  66. void (*handler)(unsigned char *, int, struct pt_regs *));
  67. #endif /* __KERNEL */