EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Functions | Variables

IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c File Reference

#include "Ps2Keyboard.h"

Go to the source code of this file.

Functions

UINTN GetScancodeBufCount (IN SCAN_CODE_QUEUE *Queue)
EFI_STATUS GetScancodeBufHead (IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf)
EFI_STATUS PopScancodeBufHead (IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf OPTIONAL)
VOID PushScancodeBufTail (IN SCAN_CODE_QUEUE *Queue, IN UINT8 Scancode)
UINT8 KeyReadDataRegister (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
VOID KeyWriteDataRegister (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN UINT8 Data)
UINT8 KeyReadStatusRegister (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
VOID KeyWriteCommandRegister (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN UINT8 Data)
VOID KeyboardError (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN CHAR16 *ErrMsg)
VOID EFIAPI KeyboardTimerHandler (IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS KeyboardRead (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, OUT UINT8 *Data)
EFI_STATUS KeyboardWrite (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN UINT8 Data)
EFI_STATUS KeyboardCommand (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN UINT8 Data)
EFI_STATUS KeyboardWaitForValue (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN UINT8 Value)
EFI_STATUS UpdateStatusLights (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
VOID KeyGetchar (IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
EFI_STATUS InitKeyboard (IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn, IN BOOLEAN ExtendedVerification)
EFI_STATUS DisableKeyboard (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)
BOOLEAN EFIAPI CheckKeyboardConnect (IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn)

Variables

struct {
   UINT8   ScanCode
 follows value defined in Scan Code Set1
   UINT16   EfiScanCode
   CHAR16   UnicodeChar
   CHAR16   ShiftUnicodeChar
ConvertKeyboardScanCodeToEfiKey []
UINTN mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT
BOOLEAN mEnableMouseInterface

Detailed Description

Routines that access 8042 keyboard controller

Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file Ps2KbdCtrller.c.


Function Documentation

BOOLEAN EFIAPI CheckKeyboardConnect ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device should not be in system.

Parameters:
[in]ConsoleInKeyboard Private Data Structure
Return values:
TRUEKeyboard in System.
FALSEKeyboard not in System.

Definition at line 1861 of file Ps2KbdCtrller.c.

EFI_STATUS DisableKeyboard ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Disable the keyboard interface of the 8042 controller.

Parameters:
ConsoleInThe device instance
Returns:
status of issuing disable command

Definition at line 1831 of file Ps2KbdCtrller.c.

UINTN GetScancodeBufCount ( IN SCAN_CODE_QUEUE Queue)

Return the count of scancode in the queue.

Parameters:
QueuePointer to instance of SCAN_CODE_QUEUE.
Returns:
Count of the scancode.

Definition at line 578 of file Ps2KbdCtrller.c.

EFI_STATUS GetScancodeBufHead ( IN SCAN_CODE_QUEUE Queue,
IN UINTN  Count,
OUT UINT8 Buf 
)

Read several bytes from the scancode buffer without removing them. This function is called to see if there are enough bytes of scancode representing a single key.

Parameters:
QueuePointer to instance of SCAN_CODE_QUEUE.
CountNumber of bytes to be read
BufStore the results
Return values:
EFI_SUCCESSsuccess to scan the keyboard code
EFI_NOT_READYinvalid parameter

Definition at line 602 of file Ps2KbdCtrller.c.

EFI_STATUS InitKeyboard ( IN OUT KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN BOOLEAN  ExtendedVerification 
)

Perform 8042 controller and keyboard Initialization. If ExtendedVerification is TRUE, do additional test for the keyboard interface

Parameters:
ConsoleIn- KEYBOARD_CONSOLE_IN_DEV instance pointer
ExtendedVerification- indicates a thorough initialization
Return values:
EFI_DEVICE_ERRORFail to init keyboard
EFI_SUCCESSSuccess to init keyboard

Definition at line 1488 of file Ps2KbdCtrller.c.

EFI_STATUS KeyboardCommand ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN UINT8  Data 
)

Issue keyboard command.

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
DataThe buff holding the command
Return values:
EFI_TIMEOUTKeyboard is not ready to issuing
EFI_SUCCESSSuccess to issue keyboard command

Definition at line 965 of file Ps2KbdCtrller.c.

VOID KeyboardError ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN CHAR16 ErrMsg 
)

Display error message.

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
ErrMsgUnicode string of error message

Definition at line 795 of file Ps2KbdCtrller.c.

EFI_STATUS KeyboardRead ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
OUT UINT8 Data 
)

Read key value .

Parameters:
ConsoleIn- Pointer to instance of KEYBOARD_CONSOLE_IN_DEV
Data- Pointer to outof buffer for keeping key value
Return values:
EFI_TIMEOUTStatus resigter time out
EFI_SUCCESSSuccess to read keyboard

Definition at line 877 of file Ps2KbdCtrller.c.

VOID EFIAPI KeyboardTimerHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY

Parameters:
EventThe timer event
ContextA KEYBOARD_CONSOLE_IN_DEV pointer

Definition at line 816 of file Ps2KbdCtrller.c.

EFI_STATUS KeyboardWaitForValue ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN UINT8  Value 
)

wait for a specific value to be presented on 8042 Data register by keyboard and then read it, used in keyboard commands ack

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Valuethe value wanted to be waited.
Return values:
EFI_TIMEOUTFail to get specific value in given time
EFI_SUCCESSSuccess to get specific value in given time.

Definition at line 1029 of file Ps2KbdCtrller.c.

EFI_STATUS KeyboardWrite ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN UINT8  Data 
)

write key to keyboard

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Datavalue wanted to be written
Return values:
EFI_TIMEOUTThe input buffer register is full for putting new value util timeout
EFI_SUCCESSThe new value is sucess put into input buffer register.

Definition at line 920 of file Ps2KbdCtrller.c.

VOID KeyGetchar ( IN OUT KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Get scancode from scancode buffer and translate into EFI-scancode and unicode defined by EFI spec.

The function is always called in TPL_NOTIFY.

Parameters:
ConsoleInKEYBOARD_CONSOLE_IN_DEV instance pointer

Definition at line 1152 of file Ps2KbdCtrller.c.

UINT8 KeyReadDataRegister ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Read data register .

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns:
return the value

Definition at line 695 of file Ps2KbdCtrller.c.

UINT8 KeyReadStatusRegister ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Read status register.

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns:
value in status register

Definition at line 750 of file Ps2KbdCtrller.c.

VOID KeyWriteCommandRegister ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN UINT8  Data 
)

Write command register .

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
DataThe value wanted to be written

Definition at line 773 of file Ps2KbdCtrller.c.

VOID KeyWriteDataRegister ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn,
IN UINT8  Data 
)

Write data register.

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Datavalue wanted to be written

Definition at line 727 of file Ps2KbdCtrller.c.

EFI_STATUS PopScancodeBufHead ( IN SCAN_CODE_QUEUE Queue,
IN UINTN  Count,
OUT UINT8 *Buf  OPTIONAL 
)

Read & remove several bytes from the scancode buffer. This function is usually called after GetScancodeBufHead()

Parameters:
QueuePointer to instance of SCAN_CODE_QUEUE.
CountNumber of bytes to be read
BufStore the results
Return values:
EFI_SUCCESSsuccess to scan the keyboard code
EFI_NOT_READYinvalid parameter

Definition at line 640 of file Ps2KbdCtrller.c.

VOID PushScancodeBufTail ( IN SCAN_CODE_QUEUE Queue,
IN UINT8  Scancode 
)

Push one byte to the scancode buffer.

Parameters:
QueuePointer to instance of SCAN_CODE_QUEUE.
ScancodeThe byte to push.

Definition at line 673 of file Ps2KbdCtrller.c.

EFI_STATUS UpdateStatusLights ( IN KEYBOARD_CONSOLE_IN_DEV ConsoleIn)

Show keyboard status lights according to indicators in ConsoleIn.

Parameters:
ConsoleInPointer to instance of KEYBOARD_CONSOLE_IN_DEV
Returns:
status of updating keyboard register

Definition at line 1100 of file Ps2KbdCtrller.c.


Variable Documentation

Definition at line 19 of file Ps2KbdCtrller.c.

Definition at line 566 of file Ps2KbdCtrller.c.

UINTN mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT

Definition at line 564 of file Ps2KbdCtrller.c.

follows value defined in Scan Code Set1

Definition at line 18 of file Ps2KbdCtrller.c.

Definition at line 21 of file Ps2KbdCtrller.c.

Definition at line 20 of file Ps2KbdCtrller.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines