Keyboard mapper
Description
The keyboard mapper module connects to the PS/2 controller receiving the data bytes coming from the keyboard, it detects the sequences that correspond to valid scan codes or command responses and acts accordingly, it also sends commands to the keyboard through the PS/2 controller.
For example, you press the <Caps Lock> key on your keyboard, transmission is done serially to the (host) PS/2 controller and a data byte is retrieved and passed to the keyboard mapper, the corresponding scan code is put on the output port "ScanCode" but there's more, the keyboard mapper sends a command xED to the keyboard, this is the set/reset LEDs command, the keyboard replies xFA (acknowledge), the keyboard mapper then sends another byte indicating the LED set/reset states, once again the keyboard replies xFA upon reception and lights the Caps Lock LED.
Sender | Byte | Information |
---|---|---|
Keyboard | x58 | <Caps Lock> key pressed |
Host | xED | Set/Reset LEDs command |
Keyboard | xFA | Acknowledge |
Host | x04 | Set Caps Lock LED on |
Keyboard | xFA | Acknowledge |
If you're interested about the keyboard commands take a look at http://www.Computer-Engineering.org/ps2keyboard/.
The keyboard mapper has no file dependencies but was designed specifically to connect to the PS/2 controller available here. A higher hierarchy module was created, instantiating both the PS/2 controller and the keyboard mapper for easier usage.