X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=protocol%2Fibm4704.c;h=10e229fd15ed91149e4df1d211c6d58c0b424b39;hb=0bfba7acc4e05e66c8ab448286fc51bc94d03a57;hp=d3fbcc541dcf85918cbc571fbdd11a3375a3e0a5;hpb=54a06c2520f6de4b33558b2203d6706a988d291c;p=max%2Ftmk_keyboard.git diff --git a/protocol/ibm4704.c b/protocol/ibm4704.c index d3fbcc54..10e229fd 100644 --- a/protocol/ibm4704.c +++ b/protocol/ibm4704.c @@ -23,6 +23,25 @@ void ibm4704_init(void) inhibit(); } +/* +Host to Keyboard +---------------- +Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. + + ____ __ __ __ __ __ __ __ __ __ ________ +Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ + ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___ +Data ____|__/ X____X____X____X____X____X____X____X____X____X \___ + | Start 0 1 2 3 4 5 6 7 P Stop + Request by host + +Start bit: can be long as 300-350us. +Request: Host pulls Clock line down to request to send a command. +Timing: After Request keyboard pull up Data and down Clock line to low for start bit. + After request host release Clock line once Data line becomes hi. + Host writes a bit while Clock is hi and Keyboard reads while low. +Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keyboard pull down the line to lo. +*/ uint8_t ibm4704_send(uint8_t data) { bool parity = true; // odd parity @@ -85,13 +104,20 @@ uint8_t ibm4704_recv_response(void) } /* -Keyboard to Host: -Clock ~~~~___~~_~~_~~_~~_~~_~~_~~_~~_~~_~~~~~~~~ H:60us/L:30us - -Data ____~~X==X==X==X==X==X==X==X==X==X________ - | 0 1 2 3 4 5 6 7 P(odd) - | LSB MSB - Start bit(80us) +Keyboard to Host +---------------- +Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. + + ____ __ __ __ __ __ __ __ __ __ ________ +Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ + ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ +Data ____/ X____X____X____X____X____X____X____X____X____X________ + Start 0 1 2 3 4 5 6 7 P Stop + +Start bit: can be long as 300-350us. +Inhibit: Pull Data line down to inhibit keyboard to send. +Timing: Host reads bit while Clock is hi. +Stop bit: Keyboard pulls down Data line to lo after 9th clock. */ uint8_t ibm4704_recv(void) {