PL050 PS/2 Controller

From OSDev.wiki
Revision as of 10:39, 6 August 2021 by osdev>Mishatheosmaker (Remove first person words)
Jump to navigation Jump to search
This page is a stub.
You can help the wiki by accurately adding more contents to it.
This article refers to its readers or editors using I, my, we or us.
It should be edited to be in an encyclopedic tone.

Another example is the ARM Integrator/CP board which implements the PS/2 interface encapsulated in the PL050 (where the PL050 is analogous to the I8042) except you communicate with the PL050 differently than the I8042. But, after the PL050 is configured you then proceed with the PS/2 mouse protocol. For example:

/*
	 KMI/PL050 bases under Integrator/CP compatible board.
*/
#define KMI_KB_BASE	            0x18000000	// keyboard
#define KMI_MS_BASE	            0x19000000	// mouse
typedef struct _KMI_MMIO {
	uint32		cr;		// control register (rw)
	uint32		stat;		// status register (r)
	uint32		data;		// data register (rw)
	uint32		clk;		// clock divisor register (rw)
	uint32		ir;		// interrupt control register (r)
} KMI_MMIO;

KMI_MMIO	volatile *mmio;
uint32       tmp;
mmio = (KMI_MMIO*)KMI_MS_BASE;
mmio->cr = 0x4;
/* talk to the PS2 controller and enable it */
mmio->data = 0xF4;
/* keyboard sends back ACK */
while(!KMI_TXFULL(mmio->stat));
tmp = mmio->data;

The above uses memory mapped input/output (MMIO), but other architectures may use I/O ports instead or a combination of I/O ports and MMIO for example the X84/64. So understanding your platform is very important to understand how to proceed in talking to the devices.

Above, the PL050 is also called the KMI (Keyboard And Mouse Interface). So first, configure the PL050 by enabling it. Now, it provides a interface to the PS2 interface which then interfaces with the mouse. So, the next thing to do is write the value 0xF4 which you can find in the table above to enable the mouse.

Note that, due to the complexity of the Raspberry Pi's USB interface and Qemu's versatilepb being the go-to Pi emulator before raspi2 was developed, some older Pi programs will use the PL050 to easily enable debugging in Qemu. No Pi device so far has PS/2 compatibility hardware.

See Also

External Links