diff options
| author | tmk <nobody@nowhere> | 2014-02-10 11:05:18 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2014-02-10 11:05:18 +0900 |
| commit | 902afcc509cf5d84b24f71297591cb7cb3d7493d (patch) | |
| tree | 9e18b65bf2ce218cd7cf722d210ef0257892746a | |
| parent | 0f827cf94ccd6bef490ba889bc86c61483b1eb80 (diff) | |
| download | qmk_firmware-902afcc509cf5d84b24f71297591cb7cb3d7493d.tar.gz qmk_firmware-902afcc509cf5d84b24f71297591cb7cb3d7493d.zip | |
Add doc 4704.txt and protocol comment
| -rw-r--r-- | converter/ibm4704_usb/4704.txt | 147 | ||||
| -rw-r--r-- | protocol/ibm4704.c | 40 |
2 files changed, 180 insertions, 7 deletions
diff --git a/converter/ibm4704_usb/4704.txt b/converter/ibm4704_usb/4704.txt new file mode 100644 index 000000000..db584970d --- /dev/null +++ b/converter/ibm4704_usb/4704.txt | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | 4704 Keyboard | ||
| 2 | ============= | ||
| 3 | Keyboard Models: | ||
| 4 | Model 100 6019273 50-key (grid layout) | ||
| 5 | Model 200 6019284 62-key Alpha(60% layout) | ||
| 6 | Model 300 6019303 77-key Expanded Alpha | ||
| 7 | Model 400 6020218 107-key Full key | ||
| 8 | |||
| 9 | Resourse | ||
| 10 | -------- | ||
| 11 | The IBM 4704: lots of pictures and info | ||
| 12 | http://kishy.dyndns.org/?p=648#more-648 | ||
| 13 | |||
| 14 | Brochure: | ||
| 15 | http://ed-thelen.org/comp-hist/IBM-ProdAnn/4700.pdf | ||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | 4704 Keyboard Protocol | ||
| 21 | ====================== | ||
| 22 | On powering up the keyboard sends keyboard id; A3h for 6019284(62-key), for example. | ||
| 23 | After that firmware enters FC command mode and waits for parameter data from host | ||
| 24 | so that it doesn't send any scancode until you send 'FF'(End of FC command). | ||
| 25 | |||
| 26 | |||
| 27 | Keyboard to Host | ||
| 28 | ---------------- | ||
| 29 | Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part. | ||
| 30 | |||
| 31 | ____ __ __ __ __ __ __ __ __ __ ________ | ||
| 32 | Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ | ||
| 33 | ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ | ||
| 34 | Data ____/ X____X____X____X____X____X____X____X____X____X________ | ||
| 35 | Start 0 1 2 3 4 5 6 7 P Stop | ||
| 36 | |||
| 37 | Start bit: can be long as 300-350us. | ||
| 38 | Inhibit: Pull Data line down to inhibit keyboard to send. | ||
| 39 | Timing: Host reads bit while Clock is hi. | ||
| 40 | Stop bit: Keyboard pulls down Data line to lo after 9th clock. | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | Host to Keyboard | ||
| 45 | ---------------- | ||
| 46 | Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part. | ||
| 47 | |||
| 48 | ____ __ __ __ __ __ __ __ __ __ ________ | ||
| 49 | Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ | ||
| 50 | ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___ | ||
| 51 | Data ____|__/ X____X____X____X____X____X____X____X____X____X \___ | ||
| 52 | | Start 0 1 2 3 4 5 6 7 P Stop | ||
| 53 | Request by host | ||
| 54 | |||
| 55 | Start bit: can be long as 300-350us. | ||
| 56 | Request: Host pulls Clock line down to request to send a command. | ||
| 57 | Timing: After Request keyboard pull up Data and down Clock line to low for start bit. | ||
| 58 | After request host release Clock line once Data line becomes hi. | ||
| 59 | Host wirtes a bit while Clock is hi and Keyboard reads while low. | ||
| 60 | Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keybaord pull down the line to lo. | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | Scancodes | ||
| 65 | --------- | ||
| 66 | Keyboard doesn't send Break code for all keys except for Alt by default. | ||
| 67 | |||
| 68 | 6019284 62-key: | ||
| 69 | ,-----------------------------------------------------------. | ||
| 70 | | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS | | ||
| 71 | |-----------------------------------------------------------| | ||
| 72 | |Tab | Q| W| E| R| T| Y| U| I| O| P| ¢| \| PD2| | ||
| 73 | |-----------------------------------------------------------| | ||
| 74 | |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| {}| PD3| | ||
| 75 | |-----------------------------------------------------------| | ||
| 76 | |Shif| <>| Z| X| C| V| B| N| M| ,| ,| /|???|Shift | | ||
| 77 | |-----------------------------------------------------------| | ||
| 78 | |Reset|blk|Alt | Space |Alt |blk|Enter| | ||
| 79 | `-----------------------------------------------------------' | ||
| 80 | +----------+---------------------+----------+----------+ | ||
| 81 | |` 00|PD1 04|Caps 20|LShift 30|Reset 31| | ||
| 82 | |1 18|q 05|a 21|<> 3E|Rblank 41| | ||
| 83 | |2 19|w 06|s 22|z 32|Alt 3F| | ||
| 84 | |3 1A|e 13|d 23|x 33|Space 40| | ||
| 85 | |4 10|r 14|f 24|c 34|Alt 3F| | ||
| 86 | |5 11|t 15|g 25|v 35|Lblank 42| | ||
| 87 | |6 12|y 16|h 26|b 36|Enter 2F| | ||
| 88 | |7 08|u 17|j 27|n 37| | | ||
| 89 | |8 09|i 01|k 28|m 38| | | ||
| 90 | |9 0A|o 02|l 29|, 39| | | ||
| 91 | |0 0F|p 03|; 2A|. 3A| | | ||
| 92 | |- 1F|¢ 1B|' 2B|/ 3B| | | ||
| 93 | |= 0D|\ 1C|{} 2C|??? 3C| | | ||
| 94 | |??? 0C|PD2 1D|PD3 2D|RShift 3D| | | ||
| 95 | |BS 0E| | | | | | ||
| 96 | +----------+---------------------+----------+----------+ | ||
| 97 | Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled. | ||
| 98 | |||
| 99 | NOTE: When break code is enabled the key sends scancode with setting 7th bit on press | ||
| 100 | and without it on release. That is, '`' sends 80h on press and 00h on release. | ||
| 101 | |||
| 102 | |||
| 103 | keyboard command | ||
| 104 | ---------------- | ||
| 105 | FF Soft Reset(0008h) | ||
| 106 | FE Resend(00e8h) | ||
| 107 | FD Buzzer stop?(00edh) | ||
| 108 | FC Set Key flag(00f6h) | ||
| 109 | FB Soft Reset(0008h) | ||
| 110 | FA Reset(0000h) | ||
| 111 | |||
| 112 | |||
| 113 | Keyboard response | ||
| 114 | ----------------- | ||
| 115 | FF Not exist. [Outgoing buffer cannot have FFh(00h in fact)] | ||
| 116 | FE Overflow(key event/receive data) at 00c5h, 0346h | ||
| 117 | FE Memory test error at 0224h | ||
| 118 | FD Command out of bound at 00d8h | ||
| 119 | Key out of bound | ||
| 120 | 7E Read/Parity error in receive from host at 00bch | ||
| 121 | |||
| 122 | |||
| 123 | Set Key flag command(FC) | ||
| 124 | ------------------------ | ||
| 125 | After 'Power on Reset' firmware enters this command mode and waits for data from host, | ||
| 126 | so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'. | ||
| 127 | |||
| 128 | Data sent from host: | ||
| 129 | |||
| 130 | bit: 7 6 ... 0 | ||
| 131 | en | | | ||
| 132 | | `-----`--- scan code | ||
| 133 | `------------- enable bit(0: enable repeat, 1: enable break) | ||
| 134 | |||
| 135 | 00-77 Enable repeat(78-7F: invalid scancode) | ||
| 136 | 80-F7 Enable break(F8-FF: invalid scancode) | ||
| 137 | FE Resend(011ah) no need to use | ||
| 138 | FF End(0114h) exits FC command mode. | ||
| 139 | |||
| 140 | Response from keyboard: | ||
| 141 | FD Out of bound - Invalid scancode | ||
| 142 | |||
| 143 | Examples: | ||
| 144 | To enable break code of all keys. | ||
| 145 | |||
| 146 | FC 80 81 ... F7 FF | ||
| 147 | |||
diff --git a/protocol/ibm4704.c b/protocol/ibm4704.c index d3fbcc541..10e229fd1 100644 --- a/protocol/ibm4704.c +++ b/protocol/ibm4704.c | |||
| @@ -23,6 +23,25 @@ void ibm4704_init(void) | |||
| 23 | inhibit(); | 23 | inhibit(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /* | ||
| 27 | Host to Keyboard | ||
| 28 | ---------------- | ||
| 29 | Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. | ||
| 30 | |||
| 31 | ____ __ __ __ __ __ __ __ __ __ ________ | ||
| 32 | Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ | ||
| 33 | ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___ | ||
| 34 | Data ____|__/ X____X____X____X____X____X____X____X____X____X \___ | ||
| 35 | | Start 0 1 2 3 4 5 6 7 P Stop | ||
| 36 | Request by host | ||
| 37 | |||
| 38 | Start bit: can be long as 300-350us. | ||
| 39 | Request: Host pulls Clock line down to request to send a command. | ||
| 40 | Timing: After Request keyboard pull up Data and down Clock line to low for start bit. | ||
| 41 | After request host release Clock line once Data line becomes hi. | ||
| 42 | Host writes a bit while Clock is hi and Keyboard reads while low. | ||
| 43 | Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keyboard pull down the line to lo. | ||
| 44 | */ | ||
| 26 | uint8_t ibm4704_send(uint8_t data) | 45 | uint8_t ibm4704_send(uint8_t data) |
| 27 | { | 46 | { |
| 28 | bool parity = true; // odd parity | 47 | bool parity = true; // odd parity |
| @@ -85,13 +104,20 @@ uint8_t ibm4704_recv_response(void) | |||
| 85 | } | 104 | } |
| 86 | 105 | ||
| 87 | /* | 106 | /* |
| 88 | Keyboard to Host: | 107 | Keyboard to Host |
| 89 | Clock ~~~~___~~_~~_~~_~~_~~_~~_~~_~~_~~_~~~~~~~~ H:60us/L:30us | 108 | ---------------- |
| 90 | 109 | Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. | |
| 91 | Data ____~~X==X==X==X==X==X==X==X==X==X________ | 110 | |
| 92 | | 0 1 2 3 4 5 6 7 P(odd) | 111 | ____ __ __ __ __ __ __ __ __ __ ________ |
| 93 | | LSB MSB | 112 | Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ |
| 94 | Start bit(80us) | 113 | ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ |
| 114 | Data ____/ X____X____X____X____X____X____X____X____X____X________ | ||
| 115 | Start 0 1 2 3 4 5 6 7 P Stop | ||
| 116 | |||
| 117 | Start bit: can be long as 300-350us. | ||
| 118 | Inhibit: Pull Data line down to inhibit keyboard to send. | ||
| 119 | Timing: Host reads bit while Clock is hi. | ||
| 120 | Stop bit: Keyboard pulls down Data line to lo after 9th clock. | ||
| 95 | */ | 121 | */ |
| 96 | uint8_t ibm4704_recv(void) | 122 | uint8_t ibm4704_recv(void) |
| 97 | { | 123 | { |
