Difference between revisions of "Unit PL050"
Line 317: | Line 317: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Address |
| The address of the PL050 registers | | The address of the PL050 registers | ||
|- | |- | ||
− | ! | + | ! Name |
| The text description of this device which will show in the device list (Optional) | | The text description of this device which will show in the device list (Optional) | ||
|- | |- | ||
− | ! | + | ! IRQ |
| The interrupt number for the PL050 | | The interrupt number for the PL050 | ||
|- | |- | ||
− | ! | + | ! ClockRate |
| The clock source frequency for the PL050 | | The clock source frequency for the PL050 | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to the new Keyboard device or nil if the Keyboard device could not be created | | Pointer to the new Keyboard device or nil if the Keyboard device could not be created | ||
|- | |- | ||
Line 341: | Line 341: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The Keyboard device to destroy | | The Keyboard device to destroy | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 356: | Line 356: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Address |
| The address of the PL050 registers | | The address of the PL050 registers | ||
|- | |- | ||
− | ! | + | ! Name |
| The text description of this device which will show in the device list (Optional) | | The text description of this device which will show in the device list (Optional) | ||
|- | |- | ||
− | ! | + | ! IRQ |
| The interrupt number for the PL050 | | The interrupt number for the PL050 | ||
|- | |- | ||
− | ! | + | ! ClockRate |
| The clock source frequency for the PL050 | | The clock source frequency for the PL050 | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to the new Mouse device or nil if the Mouse device could not be created | | Pointer to the new Mouse device or nil if the Mouse device could not be created | ||
|- | |- | ||
Line 380: | Line 380: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Mouse |
| The Mouse device to destroy | | The Mouse device to destroy | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 398: | Line 398: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use KeyboardDeviceControl instead | + | | Not intended to be called directly by applications, use KeyboardDeviceControl instead. |
|- | |- | ||
|} | |} | ||
Line 410: | Line 410: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 422: | Line 422: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 437: | Line 437: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use MouseDeviceControl instead | + | | Not intended to be called directly by applications, use MouseDeviceControl instead. |
|- | |- | ||
|} | |} | ||
Line 449: | Line 449: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 461: | Line 461: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 476: | Line 476: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Registers |
| Pointer to the PL050 KMI registers for the device | | Pointer to the PL050 KMI registers for the device | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 491: | Line 491: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Registers |
| Pointer to the PL050 KMI registers for the device | | Pointer to the PL050 KMI registers for the device | ||
|- | |- | ||
− | ! | + | ! Value |
| The returned value read from the device | | The returned value read from the device | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 509: | Line 509: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Registers |
| Pointer to the PL050 KMI registers for the device | | Pointer to the PL050 KMI registers for the device | ||
|- | |- | ||
− | ! | + | ! Value |
| The data value to write to the device | | The data value to write to the device | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 527: | Line 527: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Registers |
| Pointer to the PL050 KMI registers for the device | | Pointer to the PL050 KMI registers for the device | ||
|- | |- | ||
− | ! | + | ! Command |
| The PS/2 command to send to the device | | The PS/2 command to send to the device | ||
|- | |- | ||
− | ! | + | ! Data |
| Pointer to the data to be sent with the command (Optional) | | Pointer to the data to be sent with the command (Optional) | ||
|- | |- | ||
− | ! | + | ! DataSize |
| The size in bytes of the data to be sent | | The size in bytes of the data to be sent | ||
|- | |- | ||
− | ! | + | ! Response |
| Pointer to a buffer to store the response from the device (Optional) | | Pointer to a buffer to store the response from the device (Optional) | ||
|- | |- | ||
− | ! | + | ! ResponseSize |
| The size in bytes of the response to be received | | The size in bytes of the response to be received | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 557: | Line 557: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to reset | | The keyboard device to reset | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 572: | Line 572: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to enable | | The keyboard device to enable | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 587: | Line 587: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to disable | | The keyboard device to disable | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 602: | Line 602: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to set the scancode set for | | The keyboard device to set the scancode set for | ||
|- | |- | ||
− | ! | + | ! LEDs |
| Type keyboard LED values to set (eg KEYBOARD_LED_CAPSLOCK) | | Type keyboard LED values to set (eg KEYBOARD_LED_CAPSLOCK) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 623: | Line 623: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to set the scancode set for | | The keyboard device to set the scancode set for | ||
|- | |- | ||
− | ! | + | ! Rate |
| Type typematic repeat rate to set (Milliseconds) | | Type typematic repeat rate to set (Milliseconds) | ||
|- | |- | ||
− | ! | + | ! Delay |
| The typematic repeat delay to set (Repeat rate intervals before first repeat) | | The typematic repeat delay to set (Repeat rate intervals before first repeat) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 647: | Line 647: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to get the scancode set from | | The keyboard device to get the scancode set from | ||
|- | |- | ||
− | ! | + | ! ScancodeSet |
| The returned scancode set value (eg PS2_KEYBOARD_SCANCODE_SET2) | | The returned scancode set value (eg PS2_KEYBOARD_SCANCODE_SET2) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 668: | Line 668: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to set the scancode set for | | The keyboard device to set the scancode set for | ||
|- | |- | ||
− | ! | + | ! ScancodeSet |
| The scancode set to set (eg PS2_KEYBOARD_SCANCODE_SET2) | | The scancode set to set (eg PS2_KEYBOARD_SCANCODE_SET2) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 689: | Line 689: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to check for | | The keyboard device to check for | ||
|- | |- | ||
− | ! | + | ! ScanCode |
| The keyboard scan code to check | | The keyboard scan code to check | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 707: | Line 707: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Keyboard |
| The keyboard device to check for | | The keyboard device to check for | ||
|- | |- | ||
− | ! | + | ! ScanCode |
| The keyboard scan code to check | | The keyboard scan code to check | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the keyboard lock | | Caller must hold the keyboard lock | ||
|- | |- | ||
Line 725: | Line 725: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Mouse |
| The mouse device to reset | | The mouse device to reset | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the mouse lock | | Caller must hold the mouse lock | ||
|- | |- | ||
Line 743: | Line 743: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Mouse |
| The mouse device to enable | | The mouse device to enable | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the mouse lock | | Caller must hold the mouse lock | ||
|- | |- | ||
Line 761: | Line 761: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Mouse |
| The mouse device to disable | | The mouse device to disable | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the mouse lock | | Caller must hold the mouse lock | ||
|- | |- | ||
Line 779: | Line 779: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Mouse |
| The mouse device to set the rate for | | The mouse device to set the rate for | ||
|- | |- | ||
− | ! | + | ! Rate |
| The sample rate to set (samples per second) | | The sample rate to set (samples per second) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the mouse lock | | Caller must hold the mouse lock | ||
|- | |- |
Revision as of 04:51, 24 April 2018
Return to Unit Reference
Contents
[hide]Description
ARM PrimeCell PL050 PS2 Keyboard/Mouse Interface Driver unit
The PL050 is an Advanced Microcontroller Bus Architecture (AMBA) compliant peripheral that implements a PS/2 compatible Keyboard and Mouse interface. This driver supports all of the standard functionality of the PL050 KMI controller including both Keyboard and Mouse devices as well as setting LEDs, repeat rate, repeat delay and sample rate values.
The driver uses interrupt transfers for receiving keyboard and mouse inputs but uses only polling mode for transmitting data to the keyboard or mouse device. This driver has only been tested with the QEMU Versatile PB emulation of the PL050 device and has not been confirmed to work with real hardware.
Notes:
- Currently QEMU only supports Scancode set 2 so scancode sets 1 and 3 are not implemented.
- On Windows, QEMU appears to send invalid scancodes for Print Screen and Pause/Break keys.
- On Windows, QEMU does not differentiate between the cursor keys (Up, Down, Left, Right, Home, End, PgUp, PgDown) and the numeric keypad keys so each of these will always return their numeric keypad equivalent. This means that to use the cursor keys you need to turn off Number Lock otherwise they are interpreted as number keys instead.
Constants
PL050_*
PL050_CR_*
PL050_STAT_*
PL050_IIR_*
Type definitions
PL050 KMI registers
PL050 keyboard scancode
PL050 keyboard
PL050 mouse packet
PL050 mouse
Public variables
None defined
Function declarations
PL050 functions
function PL050KeyboardCreate(Address:LongWord; const Name:String; IRQ,ClockRate:LongWord):PKeyboardDevice;
function PL050KeyboardDestroy(Keyboard:PKeyboardDevice):LongWord;
function PL050MouseCreate(Address:LongWord; const Name:String; IRQ,ClockRate:LongWord):PMouseDevice;
function PL050MouseDestroy(Mouse:PMouseDevice):LongWord;
PL050 keyboard functions
function PL050KeyboardControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
procedure PL050KeyboardInterruptHandler(Keyboard:PKeyboardDevice);
procedure PL050KeyboardWorker(Scancode:PPL050KeyboardScancode);
PL050 mouse functions
function PL050MouseControl(Mouse:PMouseDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
procedure PL050MouseInterruptHandler(Mouse:PMouseDevice);
procedure PL050MouseWorker(Packet:PPL050MousePacket);
PL050 helper functions
function PL050KMIClear(Registers:PPL050KMIRegisters):LongWord;
function PL050KMIRead(Registers:PPL050KMIRegisters; var Value:Byte):LongWord;
function PL050KMIWrite(Registers:PPL050KMIRegisters; Value:Byte):LongWord;
function PL050KMICommand(Registers:PPL050KMIRegisters; Command:Byte; Data:PByte; DataSize:LongWord; Response:PByte; ResponseSize:LongWord):LongWord;
function PL050KMIKeyboardReset(Keyboard:PPL050Keyboard):LongWord;
function PL050KMIKeyboardEnable(Keyboard:PPL050Keyboard):LongWord;
function PL050KMIKeyboardDisable(Keyboard:PPL050Keyboard):LongWord;
function PL050KMIKeyboardSetLEDs(Keyboard:PPL050Keyboard; LEDs:LongWord):LongWord;
function PL050KMIKeyboardSetTypematic(Keyboard:PPL050Keyboard; Rate,Delay:LongWord):LongWord;
function PL050KMIKeyboardGetScancodeSet(Keyboard:PPL050Keyboard; var ScancodeSet:Byte):LongWord;
function PL050KMIKeyboardSetScancodeSet(Keyboard:PPL050Keyboard; ScancodeSet:Byte):LongWord;
function PL050KMIKeyboardCheckPressed(Keyboard:PPL050Keyboard; ScanCode:Word):Boolean;
function PL050KMIKeyboardCheckRepeated(Keyboard:PPL050Keyboard; ScanCode:Word):Boolean;
function PL050KMIMouseReset(Mouse:PPL050Mouse):LongWord;
function PL050KMIMouseEnable(Mouse:PPL050Mouse):LongWord;
function PL050KMIMouseDisable(Mouse:PPL050Mouse):LongWord;
function PL050KMIMouseSetSampleRate(Mouse:PPL050Mouse; Rate:Byte):LongWord;
Return to Unit Reference