Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ADB.txt 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ADB Protocol
  2. ============
  3. Resources
  4. ---------
  5. Apple IIgs Hardware Reference Second Edition [p80(Chapter6 p121)]
  6. ftp://ftp.apple.asimov.net/pub/apple_II/documentation/Apple%20IIgs%20Hardware%20Reference.pdf
  7. ADB Keycode
  8. http://72.0.193.250/Documentation/macppc/adbkeycodes/
  9. http://m0115.web.fc2.com/m0115.jpg
  10. ADB Signaling
  11. http://kbdbabel.sourceforge.net/doc/kbd_signaling_pcxt_ps2_adb.pdf
  12. ADB Overview & History
  13. http://en.wikipedia.org/wiki/Apple_Desktop_Bus
  14. Microchip Application Note: ADB device(with code for PIC16C)
  15. http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062
  16. AVR ATtiny2131 ADB to PS/2 converter(Japanese)
  17. http://hp.vector.co.jp/authors/VA000177/html/KeyBoardA5DEA5CBA5A2II.html
  18. Pinouts
  19. -------
  20. Female socket from the front
  21. 4o o3
  22. 2o o1
  23. ==
  24. 1: Data
  25. 2: Power SW(low when press Power key)
  26. 3: Vcc(5V)
  27. 4: GND
  28. Commands
  29. --------
  30. ADB command is 1byte and consists of 4bit-address, 2bit-command
  31. type and 2bit-register. The commands are always sent by Host.
  32. Command format:
  33. 7 6 5 4 3 2 1 0
  34. | | | |------------ address
  35. | |-------- command type
  36. | |---- register
  37. bits commands
  38. ------------------------------------------------------
  39. - - - - 0 0 0 0 Send Request(reset all devices)
  40. A A A A 0 0 0 1 Flush(reset a device)
  41. - - - - 0 0 1 0 Reserved
  42. - - - - 0 0 1 1 Reserved
  43. - - - - 0 1 - - Reserved
  44. A A A A 1 0 R R Listen(write to a device)
  45. A A A A 1 1 R R Talk(read from a device)
  46. The command to read keycodes from keyboard is 0x2C which
  47. consist of keyboard address 2 and Talk against register 0.
  48. Address:
  49. 2: keyboard
  50. 3: mice
  51. Registers:
  52. 0: application(keyobard/mice use to store its data.)
  53. 1: application
  54. 2: application
  55. 3: status and command
  56. Communication
  57. -------------
  58. This is a minimum information for keyboard communication.
  59. See "Resources" for detail.
  60. Signaling:
  61. ~~~~____________~~||||||||||||__~~~~~_~~|||||||||||||||__~~~~
  62. |800us | |7 Command 0| | | |15-64 Data 0|Stopbit(0)
  63. +Attention | | | +Startbit(1)
  64. +Startbit(1) | +Tlt(140-260us)
  65. +stopbit(0)
  66. Bit cells:
  67. bit0: ______~~~
  68. 65 :35us
  69. bit1: ___~~~~~~
  70. 35 :65us
  71. bit0 low time: 60-70% of bit cell(42-91us)
  72. bit1 low time: 30-40% of bit cell(21-52us)
  73. bit cell time: 70-130us
  74. [from Apple IIgs Hardware Reference Second Edition]
  75. Criterion for bit0/1:
  76. After 55us if line is low/high then bit is 0/1.
  77. Attention & start bit:
  78. Host asserts low in 560-1040us then places start bit(1).
  79. Tlt(Stop to Start):
  80. Bus stays high in 140-260us then device places start bit(1).
  81. Global reset:
  82. Host asserts low in 2.8-5.2ms. All devices are forced to reset.
  83. Send request from device(Srq):
  84. Device can request to send at commad(Global only?) stop bit.
  85. keep low for 300us to request.
  86. Keyboard data(register0)
  87. This 16bit data can contains 2 keycodes and 2 released flags.
  88. First keycode is palced in upper nibble. When one keyocode is sent,
  89. lower nibble is 0xFF.
  90. Release flag is 1 when key is released.
  91. 15 14 . . . . . 8 7 6 . . . . . 0
  92. | |keycode1 | |keycode2
  93. |released(1) |released(1)
  94. Keycodes:
  95. Scancode consists of 7bit keycode and 1bit release flag.
  96. Device can send two keycodes at once. If just one keycode is sent
  97. keycode1 contains it and keyocode2 is 0xFF.
  98. Power switch:
  99. You can read the state from PSW line(active low) however
  100. the switch has a special scancode 0x7F7F, so you can
  101. also read from Data line. It uses 0xFFFF for release scancode.
  102. END_OF_ADB