Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
pl050.h File Reference
#include "ultibo/keyboard.h"
#include "ultibo/mouse.h"
#include "ultibo/ps2.h"

Go to the source code of this file.

Data Structures

struct  _PL050_KMI_REGISTERS
struct  _PL050_KEYBOARD_SCANCODE
struct  _PL050_KEYBOARD
struct  _PL050_MOUSE_PACKET
struct  _PL050_MOUSE

Macros

#define PL050_KEYBOARD_DESCRIPTION   "ARM PrimeCell PL050 PS2 Keyboard"
 Description of PL050 Keyboard device.
#define PL050_MOUSE_DESCRIPTION   "ARM PrimeCell PL050 PS2 Mouse"
 Description of PL050 Mouse device.
#define PL050_KEYBOARD_SCANCODE_COUNT   256
 Number of keyboard scancode buffers for receive.
#define PL050_MOUSE_PACKET_COUNT   256
 Number of mouse packet buffers for receive.
#define PL050_KEYBOARD_CLOCK_RATE   8000000
 Default clock rate.
#define PL050_MOUSE_CLOCK_RATE   8000000
 Default clock rate.
#define PL050_KEYBOARD_SHIFTSTATE_MASK   KEYBOARD_LEFT_CTRL | KEYBOARD_LEFT_SHIFT | KEYBOARD_LEFT_ALT | KEYBOARD_RIGHT_CTRL | KEYBOARD_RIGHT_SHIFT | KEYBOARD_RIGHT_ALT
#define PL050_CR_TYPE   (1 << 5)
 0 = PS2/AT mode / 1 = No line control bit mode
#define PL050_CR_RXINTREN   (1 << 4)
 Enable receiver interrupt. This bit field is used to enable the PrimeCell KMI receiver interrupt (If KMIRXINTREn = 1, the receiver interrupt is enabled).
#define PL050_CR_TXINTREN   (1 << 3)
 Enable transmitter interrupt. This bit field is used to enable the PrimeCell KMI transmitter interrupt (If KMITXINTREn = 1, the transfer interrupt is enabled).
#define PL050_CR_EN   (1 << 2)
 The enable PrimeCell KMI bit field is used to enable the KMI (If KmiEn = 1, the KMI is enabled).
#define PL050_CR_FDL   (1 << 1)
 The force KMI data LOW bit field is used to force the PrimeCell KMI data pad LOW regardless of the state of the KMI finite state machine (FSM) (If FKMID = 1, the PrimeCell KMI data pad is forced LOW).
#define PL050_CR_FCL   (1 << 0)
 The force KMI clock LOW bit field is used to force the PrimeCell KMI clock pad LOW regardless of the state of the KMI FSM (If FKMIC = 1, the PrimeCell KMI clock pad is forced LOW).
#define PL050_STAT_TXEMPTY   (1 << 6)
 This bit indicates that the transmit register is empty and ready to transmit (0 = Transmit register full / 1 = Transmit register empty, ready to be written).
#define PL050_STAT_TXBUSY   (1 << 5)
 This bit indicates that the PrimeCell KMI is currently sending data (0 = Idle / 1 = Currently sending data).
#define PL050_STAT_RXFULL   (1 << 4)
 This bit indicates that the receiver register is full and ready to be read (0 = Receive register empty / 1 = Receive register full, ready to be read).
#define PL050_STAT_RXBUSY   (1 << 3)
 This bit indicates that the PrimeCell KMI is currently receiving data (0 = Idle / 1 = Currently receiving data).
#define PL050_STAT_RXPARITY   (1 << 2)
 This bit reflects the parity bit for the last received data byte (odd parity).
#define PL050_STAT_IC   (1 << 1)
 This bit reflects the status of the KMICLKIN line after synchronizing and sampling.
#define PL050_STAT_ID   (1 << 0)
 This bit reflects the status of the KMIDATAIN line after synchronizing.
#define PL050_IIR_TXINTR   (1 << 1)
 This bit is set to 1 if the KMITXINTR transmit interrupt is asserted.
#define PL050_IIR_RXINTR   (1 << 0)
 This bit is set to 1 if the KMIRXINTR receive interrupt is asserted.

Typedefs

typedef struct _PL050_KMI_REGISTERS PL050_KMI_REGISTERS
typedef struct _PL050_KEYBOARD PL050_KEYBOARD
typedef struct _PL050_KEYBOARD_SCANCODE PL050_KEYBOARD_SCANCODE
typedef struct _PL050_MOUSE PL050_MOUSE
typedef struct _PL050_MOUSE_PACKET PL050_MOUSE_PACKET

Functions

KEYBOARD_DEVICE *STDCALL pl050_keyboard_create (size_t address, char *name, uint32_t irq, uint32_t clockrate)
 Create, register and attach a new PL050 Keyboard device which can be accessed using the keyboard API.
uint32_t STDCALL pl050_keyboard_destroy (KEYBOARD_DEVICE *keyboard)
 Detach, deregister and destroy a PL050 Keyboard device created by this driver.
MOUSE_DEVICE *STDCALL pl050_mouse_create (size_t address, char *name, uint32_t irq, uint32_t clockrate)
 Create, register and attach a new PL050 Mouse device which can be accessed using the mouse API.
uint32_t STDCALL pl050_mouse_destroy (MOUSE_DEVICE *mouse)
 Detach, deregister and destroy a PL050 Mouse device created by this driver.

Macro Definition Documentation

◆ PL050_KEYBOARD_DESCRIPTION

#define PL050_KEYBOARD_DESCRIPTION   "ARM PrimeCell PL050 PS2 Keyboard"

Description of PL050 Keyboard device.

PL050 specific constants

◆ PL050_MOUSE_DESCRIPTION

#define PL050_MOUSE_DESCRIPTION   "ARM PrimeCell PL050 PS2 Mouse"

Description of PL050 Mouse device.

◆ PL050_KEYBOARD_SCANCODE_COUNT

#define PL050_KEYBOARD_SCANCODE_COUNT   256

Number of keyboard scancode buffers for receive.

◆ PL050_MOUSE_PACKET_COUNT

#define PL050_MOUSE_PACKET_COUNT   256

Number of mouse packet buffers for receive.

◆ PL050_KEYBOARD_CLOCK_RATE

#define PL050_KEYBOARD_CLOCK_RATE   8000000

Default clock rate.

◆ PL050_MOUSE_CLOCK_RATE

#define PL050_MOUSE_CLOCK_RATE   8000000

Default clock rate.

◆ PL050_KEYBOARD_SHIFTSTATE_MASK

◆ PL050_CR_TYPE

#define PL050_CR_TYPE   (1 << 5)

0 = PS2/AT mode / 1 = No line control bit mode

PL050 Control register bits

◆ PL050_CR_RXINTREN

#define PL050_CR_RXINTREN   (1 << 4)

Enable receiver interrupt. This bit field is used to enable the PrimeCell KMI receiver interrupt (If KMIRXINTREn = 1, the receiver interrupt is enabled).

◆ PL050_CR_TXINTREN

#define PL050_CR_TXINTREN   (1 << 3)

Enable transmitter interrupt. This bit field is used to enable the PrimeCell KMI transmitter interrupt (If KMITXINTREn = 1, the transfer interrupt is enabled).

◆ PL050_CR_EN

#define PL050_CR_EN   (1 << 2)

The enable PrimeCell KMI bit field is used to enable the KMI (If KmiEn = 1, the KMI is enabled).

◆ PL050_CR_FDL

#define PL050_CR_FDL   (1 << 1)

The force KMI data LOW bit field is used to force the PrimeCell KMI data pad LOW regardless of the state of the KMI finite state machine (FSM) (If FKMID = 1, the PrimeCell KMI data pad is forced LOW).

◆ PL050_CR_FCL

#define PL050_CR_FCL   (1 << 0)

The force KMI clock LOW bit field is used to force the PrimeCell KMI clock pad LOW regardless of the state of the KMI FSM (If FKMIC = 1, the PrimeCell KMI clock pad is forced LOW).

◆ PL050_STAT_TXEMPTY

#define PL050_STAT_TXEMPTY   (1 << 6)

This bit indicates that the transmit register is empty and ready to transmit (0 = Transmit register full / 1 = Transmit register empty, ready to be written).

PL050 Status register bits

◆ PL050_STAT_TXBUSY

#define PL050_STAT_TXBUSY   (1 << 5)

This bit indicates that the PrimeCell KMI is currently sending data (0 = Idle / 1 = Currently sending data).

◆ PL050_STAT_RXFULL

#define PL050_STAT_RXFULL   (1 << 4)

This bit indicates that the receiver register is full and ready to be read (0 = Receive register empty / 1 = Receive register full, ready to be read).

◆ PL050_STAT_RXBUSY

#define PL050_STAT_RXBUSY   (1 << 3)

This bit indicates that the PrimeCell KMI is currently receiving data (0 = Idle / 1 = Currently receiving data).

◆ PL050_STAT_RXPARITY

#define PL050_STAT_RXPARITY   (1 << 2)

This bit reflects the parity bit for the last received data byte (odd parity).

◆ PL050_STAT_IC

#define PL050_STAT_IC   (1 << 1)

This bit reflects the status of the KMICLKIN line after synchronizing and sampling.

◆ PL050_STAT_ID

#define PL050_STAT_ID   (1 << 0)

This bit reflects the status of the KMIDATAIN line after synchronizing.

◆ PL050_IIR_TXINTR

#define PL050_IIR_TXINTR   (1 << 1)

This bit is set to 1 if the KMITXINTR transmit interrupt is asserted.

PL050 Interrupt register bits

◆ PL050_IIR_RXINTR

#define PL050_IIR_RXINTR   (1 << 0)

This bit is set to 1 if the KMIRXINTR receive interrupt is asserted.

Typedef Documentation

◆ PL050_KMI_REGISTERS

◆ PL050_KEYBOARD

◆ PL050_KEYBOARD_SCANCODE

◆ PL050_MOUSE

typedef struct _PL050_MOUSE PL050_MOUSE

◆ PL050_MOUSE_PACKET

Function Documentation

◆ pl050_keyboard_create()

KEYBOARD_DEVICE *STDCALL pl050_keyboard_create ( size_t address,
char * name,
uint32_t irq,
uint32_t clockrate )

Create, register and attach a new PL050 Keyboard device which can be accessed using the keyboard API.

PL050 Functions

Parameters
AddressThe address of the PL050 registers
NameThe text description of this device which will show in the device list (Optional)
IRQThe interrupt number for the PL050
ClockRateThe clock source frequency for the PL050
Returns
Pointer to the new Keyboard device or nil if the Keyboard device could not be created

◆ pl050_keyboard_destroy()

uint32_t STDCALL pl050_keyboard_destroy ( KEYBOARD_DEVICE * keyboard)

Detach, deregister and destroy a PL050 Keyboard device created by this driver.

Parameters
KeyboardThe Keyboard device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ pl050_mouse_create()

MOUSE_DEVICE *STDCALL pl050_mouse_create ( size_t address,
char * name,
uint32_t irq,
uint32_t clockrate )

Create, register and attach a new PL050 Mouse device which can be accessed using the mouse API.

Parameters
AddressThe address of the PL050 registers
NameThe text description of this device which will show in the device list (Optional)
IRQThe interrupt number for the PL050
ClockRateThe clock source frequency for the PL050
Returns
Pointer to the new Mouse device or nil if the Mouse device could not be created

◆ pl050_mouse_destroy()

uint32_t STDCALL pl050_mouse_destroy ( MOUSE_DEVICE * mouse)

Detach, deregister and destroy a PL050 Mouse device created by this driver.

Parameters
MouseThe Mouse device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure