mirror of https://github.com/acidanthera/audk.git
remove some internal functions and allocate some FIFO data structure instead of declaring in global variable. To save size.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7416 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1068a65374
commit
5c998646f3
|
@ -69,21 +69,11 @@ TERMINAL_DEV mTerminalDevTemplate = {
|
|||
TRUE // CursorVisible
|
||||
},
|
||||
0, // SerialInTimeOut
|
||||
{ // RawFiFo
|
||||
0,
|
||||
0,
|
||||
{ 0 }
|
||||
},
|
||||
{ // UnicodeFiFo
|
||||
0,
|
||||
0,
|
||||
{ 0 }
|
||||
},
|
||||
{ // EfiKeyFiFo
|
||||
0,
|
||||
0,
|
||||
{ {0} }
|
||||
},
|
||||
|
||||
NULL, // RawFifo
|
||||
NULL, // UnicodeFiFo
|
||||
NULL, // EfiKeyFiFo
|
||||
|
||||
NULL, // ControllerNameTable
|
||||
NULL, // TwoSecondTimeOut
|
||||
INPUT_STATE_DEFAULT,
|
||||
|
@ -424,12 +414,21 @@ TerminalDriverBindingStart (
|
|||
goto Error;
|
||||
}
|
||||
//
|
||||
// initialize the FIFO buffer used for accommodating
|
||||
// the pre-read pending characters
|
||||
// Allocates and initializes the FIFO buffer to be zero, used for accommodating
|
||||
// the pre-read pending characters.
|
||||
//
|
||||
InitializeRawFiFo (TerminalDevice);
|
||||
InitializeUnicodeFiFo (TerminalDevice);
|
||||
InitializeEfiKeyFiFo (TerminalDevice);
|
||||
TerminalDevice->RawFiFo = AllocateZeroPool (sizeof (RAW_DATA_FIFO));
|
||||
if (TerminalDevice->RawFiFo == NULL) {
|
||||
goto Error;
|
||||
}
|
||||
TerminalDevice->UnicodeFiFo = AllocateZeroPool (sizeof (UNICODE_FIFO));
|
||||
if (TerminalDevice->UnicodeFiFo == NULL) {
|
||||
goto Error;
|
||||
}
|
||||
TerminalDevice->EfiKeyFiFo = AllocateZeroPool (sizeof (EFI_KEY_FIFO));
|
||||
if (TerminalDevice->EfiKeyFiFo == NULL) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Set the timeout value of serial buffer for
|
||||
|
@ -704,6 +703,16 @@ Error:
|
|||
|
||||
TerminalFreeNotifyList (&TerminalDevice->NotifyList);
|
||||
|
||||
if (TerminalDevice->RawFiFo != NULL) {
|
||||
FreePool (TerminalDevice->RawFiFo);
|
||||
}
|
||||
if (TerminalDevice->UnicodeFiFo != NULL) {
|
||||
FreePool (TerminalDevice->UnicodeFiFo);
|
||||
}
|
||||
if (TerminalDevice->EfiKeyFiFo != NULL) {
|
||||
FreePool (TerminalDevice->EfiKeyFiFo);
|
||||
}
|
||||
|
||||
if (TerminalDevice->ControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
|
||||
}
|
||||
|
@ -1279,58 +1288,6 @@ SetTerminalDevicePath (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the Raw Data FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeRawFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
//
|
||||
// Make the raw FIFO empty.
|
||||
//
|
||||
TerminalDevice->RawFiFo.Head = TerminalDevice->RawFiFo.Tail;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the Unicode FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeUnicodeFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
//
|
||||
// Make the unicode FIFO empty
|
||||
//
|
||||
TerminalDevice->UnicodeFiFo.Head = TerminalDevice->UnicodeFiFo.Tail;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize the EFI Key FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeEfiKeyFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
//
|
||||
// Make the efi key FIFO empty
|
||||
//
|
||||
TerminalDevice->EfiKeyFiFo.Head = TerminalDevice->EfiKeyFiFo.Tail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The user Entry Point for module Terminal. The user code starts with this function.
|
||||
|
||||
|
|
|
@ -84,9 +84,9 @@ typedef struct {
|
|||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
|
||||
UINTN SerialInTimeOut;
|
||||
RAW_DATA_FIFO RawFiFo;
|
||||
UNICODE_FIFO UnicodeFiFo;
|
||||
EFI_KEY_FIFO EfiKeyFiFo;
|
||||
RAW_DATA_FIFO *RawFiFo;
|
||||
UNICODE_FIFO *UnicodeFiFo;
|
||||
EFI_KEY_FIFO *EfiKeyFiFo;
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
EFI_EVENT TwoSecondTimeOut;
|
||||
UINT32 InputState;
|
||||
|
@ -491,7 +491,7 @@ TerminalConOutQueryMode (
|
|||
@param ModeNumber The text mode to set.
|
||||
|
||||
@retval EFI_SUCCESS The requested text mode is set.
|
||||
@retval EFI_DEVICE_ERROR The requested text mode cannot be set
|
||||
@retval EFI_DEVICE_ERROR The requested text mode cannot be set
|
||||
because of serial device error.
|
||||
@retval EFI_UNSUPPORTED The text mode number is not valid.
|
||||
|
||||
|
@ -581,7 +581,7 @@ TerminalConOutEnableCursor (
|
|||
);
|
||||
|
||||
/**
|
||||
Test to see if this driver supports Controller.
|
||||
Test to see if this driver supports Controller.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to test
|
||||
|
@ -629,7 +629,7 @@ TerminalDriverBindingStart (
|
|||
/**
|
||||
Stop this driver on Controller by closing Simple Text In, Simple Text
|
||||
In Ex, Simple Text Out protocol, and removing parent device path from
|
||||
Console Device Environment Variables.
|
||||
Console Device Environment Variables.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Controller Handle of device to stop driver on
|
||||
|
@ -847,7 +847,7 @@ TerminalRemoveConsoleDevVariable (
|
|||
@param VariableSize Returns the size of the EFI variable that was read
|
||||
|
||||
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
||||
Caller is repsoncible freeing the buffer. If variable was not read,
|
||||
Caller is repsoncible freeing the buffer. If variable was not read,
|
||||
NULL regturned.
|
||||
|
||||
**/
|
||||
|
@ -877,39 +877,6 @@ SetTerminalDevicePath (
|
|||
OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the Raw Data FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeRawFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the Unicode FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeUnicodeFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the EFI Key FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeEfiKeyFiFo (
|
||||
IN TERMINAL_DEV *TerminalDevice
|
||||
);
|
||||
|
||||
/**
|
||||
Get one key out of serial buffer.
|
||||
|
||||
|
@ -1125,8 +1092,8 @@ UnicodeFiFoGetKeyCount (
|
|||
);
|
||||
|
||||
/**
|
||||
Translate raw data into Unicode (according to different encode), and
|
||||
translate Unicode into key information. (according to different standard).
|
||||
Translate raw data into Unicode (according to different encode), and
|
||||
translate Unicode into key information. (according to different standard).
|
||||
|
||||
@param TerminalDevice Terminal driver private structure.
|
||||
|
||||
|
@ -1154,8 +1121,8 @@ AnsiRawDataToUnicode (
|
|||
|
||||
/**
|
||||
Converts a stream of Unicode characters from a terminal input device into EFI Keys that
|
||||
can be read through the Simple Input Protocol.
|
||||
|
||||
can be read through the Simple Input Protocol.
|
||||
|
||||
The table below shows the keyboard input mappings that this function supports.
|
||||
If the ESC sequence listed in one of the columns is presented, then it is translated
|
||||
into the coorespoding EFI Scan Code. If a matching sequence is not found, then the raw
|
||||
|
@ -1206,7 +1173,7 @@ AnsiRawDataToUnicode (
|
|||
| F11 | 0x15 | | ESC ! | |
|
||||
| F12 | 0x16 | | ESC @ | |
|
||||
+=========+======+===========+==========+==========+
|
||||
|
||||
|
||||
Special Mappings
|
||||
================
|
||||
ESC R ESC r ESC R = Reset System
|
||||
|
@ -1225,8 +1192,8 @@ UnicodeToEfiKey (
|
|||
or valid text graphics.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
@param WString The input string.
|
||||
|
||||
@param WString The input string.
|
||||
|
||||
@retval EFI_UNSUPPORTED If not all input characters are valid.
|
||||
@retval EFI_SUCCESS If all input characters are valid.
|
||||
|
||||
|
@ -1242,7 +1209,7 @@ AnsiTestString (
|
|||
//
|
||||
|
||||
/**
|
||||
Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,
|
||||
Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,
|
||||
and insert them into Unicode FIFO.
|
||||
|
||||
@param VtUtf8Device The terminal device.
|
||||
|
@ -1257,8 +1224,8 @@ VTUTF8RawDataToUnicode (
|
|||
Check if input string is valid VT-UTF8 string.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
@param WString The input string.
|
||||
|
||||
@param WString The input string.
|
||||
|
||||
@retval EFI_SUCCESS If all input characters are valid.
|
||||
|
||||
**/
|
||||
|
@ -1268,7 +1235,7 @@ VTUTF8TestString (
|
|||
IN CHAR16 *WString
|
||||
);
|
||||
|
||||
/**
|
||||
/**
|
||||
Translate one Unicode character into VT-UTF8 characters.
|
||||
|
||||
UTF8 Encoding Table
|
||||
|
@ -1296,7 +1263,7 @@ UnicodeToUtf8 (
|
|||
|
||||
@param Utf8Device The terminal device.
|
||||
@param Utf8Char Returned valid VT-UTF8 characters set.
|
||||
@param ValidBytes The count of returned VT-VTF8 characters.
|
||||
@param ValidBytes The count of returned VT-VTF8 characters.
|
||||
If ValidBytes is zero, no valid VT-UTF8 returned.
|
||||
|
||||
**/
|
||||
|
@ -1307,7 +1274,7 @@ GetOneValidUtf8Char (
|
|||
OUT UINT8 *ValidBytes
|
||||
);
|
||||
|
||||
/**
|
||||
/**
|
||||
Translate VT-UTF8 characters into one Unicode character.
|
||||
|
||||
UTF8 Encoding Table
|
||||
|
@ -1319,7 +1286,7 @@ GetOneValidUtf8Char (
|
|||
|
||||
@param Utf8Char VT-UTF8 character set needs translating.
|
||||
@param ValidBytes The count of valid VT-UTF8 characters.
|
||||
@param UnicodeChar Returned unicode character.
|
||||
@param UnicodeChar Returned unicode character.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -1356,7 +1323,7 @@ TerminalIsValidTextGraphics (
|
|||
Detects if a valid ASCII char.
|
||||
|
||||
@param Ascii An ASCII character.
|
||||
|
||||
|
||||
@retval TRUE If it is a valid ASCII character.
|
||||
@retval FALSE If it is not a valid ASCII character.
|
||||
|
||||
|
@ -1370,7 +1337,7 @@ TerminalIsValidAscii (
|
|||
Detects if a valid EFI control character.
|
||||
|
||||
@param CharC An input EFI Control character.
|
||||
|
||||
|
||||
@retval TRUE If it is a valid EFI control character.
|
||||
@retval FALSE If it is not a valid EFI control character.
|
||||
|
||||
|
|
|
@ -120,11 +120,11 @@ TerminalConInReset (
|
|||
Status = TerminalDevice->SerialIo->Reset (TerminalDevice->SerialIo);
|
||||
|
||||
//
|
||||
// clear all the internal buffer for keys
|
||||
// Make all the internal buffer empty for keys
|
||||
//
|
||||
InitializeRawFiFo (TerminalDevice);
|
||||
InitializeUnicodeFiFo (TerminalDevice);
|
||||
InitializeEfiKeyFiFo (TerminalDevice);
|
||||
TerminalDevice->RawFiFo->Head = TerminalDevice->RawFiFo->Tail;
|
||||
TerminalDevice->UnicodeFiFo->Head = TerminalDevice->UnicodeFiFo->Tail;
|
||||
TerminalDevice->EfiKeyFiFo->Head = TerminalDevice->EfiKeyFiFo->Tail;
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
||||
|
@ -179,7 +179,7 @@ TerminalConInReadKeyStroke (
|
|||
|
||||
/**
|
||||
Check if the key already has been registered.
|
||||
|
||||
|
||||
If both RegsiteredData and InputData is NULL, then ASSERT().
|
||||
|
||||
@param RegsiteredData A pointer to a buffer that is filled in with the
|
||||
|
@ -450,7 +450,7 @@ TerminalConInUnregisterKeyNotify (
|
|||
LIST_ENTRY *Link;
|
||||
TERMINAL_CONSOLE_IN_EX_NOTIFY *CurrentNotify;
|
||||
LIST_ENTRY *NotifyList;
|
||||
|
||||
|
||||
if (NotificationHandle == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -498,8 +498,8 @@ TerminalConInUnregisterKeyNotify (
|
|||
}
|
||||
|
||||
/**
|
||||
Translate raw data into Unicode (according to different encode), and
|
||||
translate Unicode into key information. (according to different standard).
|
||||
Translate raw data into Unicode (according to different encode), and
|
||||
translate Unicode into key information. (according to different standard).
|
||||
|
||||
@param TerminalDevice Terminal driver private structure.
|
||||
|
||||
|
@ -746,7 +746,7 @@ RawFiFoInsertOneKey (
|
|||
{
|
||||
UINT8 Tail;
|
||||
|
||||
Tail = TerminalDevice->RawFiFo.Tail;
|
||||
Tail = TerminalDevice->RawFiFo->Tail;
|
||||
|
||||
if (IsRawFiFoFull (TerminalDevice)) {
|
||||
//
|
||||
|
@ -755,9 +755,9 @@ RawFiFoInsertOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
TerminalDevice->RawFiFo.Data[Tail] = Input;
|
||||
TerminalDevice->RawFiFo->Data[Tail] = Input;
|
||||
|
||||
TerminalDevice->RawFiFo.Tail = (UINT8) ((Tail + 1) % (RAW_FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->RawFiFo->Tail = (UINT8) ((Tail + 1) % (RAW_FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ RawFiFoRemoveOneKey (
|
|||
{
|
||||
UINT8 Head;
|
||||
|
||||
Head = TerminalDevice->RawFiFo.Head;
|
||||
Head = TerminalDevice->RawFiFo->Head;
|
||||
|
||||
if (IsRawFiFoEmpty (TerminalDevice)) {
|
||||
//
|
||||
|
@ -790,9 +790,9 @@ RawFiFoRemoveOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
*Output = TerminalDevice->RawFiFo.Data[Head];
|
||||
*Output = TerminalDevice->RawFiFo->Data[Head];
|
||||
|
||||
TerminalDevice->RawFiFo.Head = (UINT8) ((Head + 1) % (RAW_FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->RawFiFo->Head = (UINT8) ((Head + 1) % (RAW_FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ IsRawFiFoEmpty (
|
|||
TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
if (TerminalDevice->RawFiFo.Head == TerminalDevice->RawFiFo.Tail) {
|
||||
if (TerminalDevice->RawFiFo->Head == TerminalDevice->RawFiFo->Tail) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
@ -835,8 +835,8 @@ IsRawFiFoFull (
|
|||
UINT8 Tail;
|
||||
UINT8 Head;
|
||||
|
||||
Tail = TerminalDevice->RawFiFo.Tail;
|
||||
Head = TerminalDevice->RawFiFo.Head;
|
||||
Tail = TerminalDevice->RawFiFo->Tail;
|
||||
Head = TerminalDevice->RawFiFo->Head;
|
||||
|
||||
if (((Tail + 1) % (RAW_FIFO_MAX_NUMBER + 1)) == Head) {
|
||||
|
||||
|
@ -865,7 +865,7 @@ EfiKeyFiFoInsertOneKey (
|
|||
{
|
||||
UINT8 Tail;
|
||||
|
||||
Tail = TerminalDevice->EfiKeyFiFo.Tail;
|
||||
Tail = TerminalDevice->EfiKeyFiFo->Tail;
|
||||
|
||||
if (IsEfiKeyFiFoFull (TerminalDevice)) {
|
||||
//
|
||||
|
@ -874,9 +874,9 @@ EfiKeyFiFoInsertOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
TerminalDevice->EfiKeyFiFo.Data[Tail] = Key;
|
||||
TerminalDevice->EfiKeyFiFo->Data[Tail] = Key;
|
||||
|
||||
TerminalDevice->EfiKeyFiFo.Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->EfiKeyFiFo->Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -899,7 +899,7 @@ EfiKeyFiFoRemoveOneKey (
|
|||
{
|
||||
UINT8 Head;
|
||||
|
||||
Head = TerminalDevice->EfiKeyFiFo.Head;
|
||||
Head = TerminalDevice->EfiKeyFiFo->Head;
|
||||
|
||||
if (IsEfiKeyFiFoEmpty (TerminalDevice)) {
|
||||
//
|
||||
|
@ -910,9 +910,9 @@ EfiKeyFiFoRemoveOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
*Output = TerminalDevice->EfiKeyFiFo.Data[Head];
|
||||
*Output = TerminalDevice->EfiKeyFiFo->Data[Head];
|
||||
|
||||
TerminalDevice->EfiKeyFiFo.Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->EfiKeyFiFo->Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ IsEfiKeyFiFoEmpty (
|
|||
TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
if (TerminalDevice->EfiKeyFiFo.Head == TerminalDevice->EfiKeyFiFo.Tail) {
|
||||
if (TerminalDevice->EfiKeyFiFo->Head == TerminalDevice->EfiKeyFiFo->Tail) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
@ -955,8 +955,8 @@ IsEfiKeyFiFoFull (
|
|||
UINT8 Tail;
|
||||
UINT8 Head;
|
||||
|
||||
Tail = TerminalDevice->EfiKeyFiFo.Tail;
|
||||
Head = TerminalDevice->EfiKeyFiFo.Head;
|
||||
Tail = TerminalDevice->EfiKeyFiFo->Tail;
|
||||
Head = TerminalDevice->EfiKeyFiFo->Head;
|
||||
|
||||
if (((Tail + 1) % (FIFO_MAX_NUMBER + 1)) == Head) {
|
||||
|
||||
|
@ -985,7 +985,7 @@ UnicodeFiFoInsertOneKey (
|
|||
{
|
||||
UINT8 Tail;
|
||||
|
||||
Tail = TerminalDevice->UnicodeFiFo.Tail;
|
||||
Tail = TerminalDevice->UnicodeFiFo->Tail;
|
||||
|
||||
if (IsUnicodeFiFoFull (TerminalDevice)) {
|
||||
//
|
||||
|
@ -994,9 +994,9 @@ UnicodeFiFoInsertOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
TerminalDevice->UnicodeFiFo.Data[Tail] = Input;
|
||||
TerminalDevice->UnicodeFiFo->Data[Tail] = Input;
|
||||
|
||||
TerminalDevice->UnicodeFiFo.Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->UnicodeFiFo->Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1019,7 +1019,7 @@ UnicodeFiFoRemoveOneKey (
|
|||
{
|
||||
UINT8 Head;
|
||||
|
||||
Head = TerminalDevice->UnicodeFiFo.Head;
|
||||
Head = TerminalDevice->UnicodeFiFo->Head;
|
||||
|
||||
if (IsUnicodeFiFoEmpty (TerminalDevice)) {
|
||||
//
|
||||
|
@ -1029,9 +1029,9 @@ UnicodeFiFoRemoveOneKey (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
*Output = TerminalDevice->UnicodeFiFo.Data[Head];
|
||||
*Output = TerminalDevice->UnicodeFiFo->Data[Head];
|
||||
|
||||
TerminalDevice->UnicodeFiFo.Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
TerminalDevice->UnicodeFiFo->Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ IsUnicodeFiFoEmpty (
|
|||
TERMINAL_DEV *TerminalDevice
|
||||
)
|
||||
{
|
||||
if (TerminalDevice->UnicodeFiFo.Head == TerminalDevice->UnicodeFiFo.Tail) {
|
||||
if (TerminalDevice->UnicodeFiFo->Head == TerminalDevice->UnicodeFiFo->Tail) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
|
@ -1074,8 +1074,8 @@ IsUnicodeFiFoFull (
|
|||
UINT8 Tail;
|
||||
UINT8 Head;
|
||||
|
||||
Tail = TerminalDevice->UnicodeFiFo.Tail;
|
||||
Head = TerminalDevice->UnicodeFiFo.Head;
|
||||
Tail = TerminalDevice->UnicodeFiFo->Tail;
|
||||
Head = TerminalDevice->UnicodeFiFo->Head;
|
||||
|
||||
if (((Tail + 1) % (FIFO_MAX_NUMBER + 1)) == Head) {
|
||||
|
||||
|
@ -1101,8 +1101,8 @@ UnicodeFiFoGetKeyCount (
|
|||
UINT8 Tail;
|
||||
UINT8 Head;
|
||||
|
||||
Tail = TerminalDevice->UnicodeFiFo.Tail;
|
||||
Head = TerminalDevice->UnicodeFiFo.Head;
|
||||
Tail = TerminalDevice->UnicodeFiFo->Tail;
|
||||
Head = TerminalDevice->UnicodeFiFo->Head;
|
||||
|
||||
if (Tail >= Head) {
|
||||
return (UINT8) (Tail - Head);
|
||||
|
@ -1113,7 +1113,7 @@ UnicodeFiFoGetKeyCount (
|
|||
|
||||
/**
|
||||
Update the Unicode characters from a terminal input device into EFI Keys FIFO.
|
||||
|
||||
|
||||
@param TerminalDevice The terminal device to use to translate raw input into EFI Keys
|
||||
|
||||
**/
|
||||
|
@ -1124,9 +1124,9 @@ UnicodeToEfiKeyFlushState (
|
|||
{
|
||||
EFI_INPUT_KEY Key;
|
||||
UINT32 InputState;
|
||||
|
||||
|
||||
InputState = TerminalDevice->InputState;
|
||||
|
||||
|
||||
if ((InputState & INPUT_STATE_ESC) != 0) {
|
||||
Key.ScanCode = SCAN_ESC;
|
||||
Key.UnicodeChar = 0;
|
||||
|
@ -1172,8 +1172,8 @@ UnicodeToEfiKeyFlushState (
|
|||
|
||||
/**
|
||||
Converts a stream of Unicode characters from a terminal input device into EFI Keys that
|
||||
can be read through the Simple Input Protocol.
|
||||
|
||||
can be read through the Simple Input Protocol.
|
||||
|
||||
The table below shows the keyboard input mappings that this function supports.
|
||||
If the ESC sequence listed in one of the columns is presented, then it is translated
|
||||
into the corresponding EFI Scan Code. If a matching sequence is not found, then the raw
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Implementation of translation upon VT-UTF8.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. <BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. <BR>
|
||||
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
|
||||
|
@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include "Terminal.h"
|
||||
|
||||
/**
|
||||
Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,
|
||||
Translate all VT-UTF8 characters in the Raw FIFI into unicode characters,
|
||||
and insert them into Unicode FIFO.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
|
@ -55,7 +55,7 @@ VTUTF8RawDataToUnicode (
|
|||
|
||||
@param Utf8Device The terminal device.
|
||||
@param Utf8Char Returned valid VT-UTF8 characters set.
|
||||
@param ValidBytes The count of returned VT-VTF8 characters.
|
||||
@param ValidBytes The count of returned VT-VTF8 characters.
|
||||
If ValidBytes is zero, no valid VT-UTF8 returned.
|
||||
|
||||
**/
|
||||
|
@ -125,6 +125,9 @@ GetOneValidUtf8Char (
|
|||
break;
|
||||
|
||||
case 2:
|
||||
//
|
||||
// two-byte utf8 char go on
|
||||
//
|
||||
if ((Temp & 0xc0) == 0x80) {
|
||||
|
||||
Utf8Char->Utf8_2[0] = Temp;
|
||||
|
@ -138,15 +141,20 @@ GetOneValidUtf8Char (
|
|||
break;
|
||||
|
||||
case 3:
|
||||
//
|
||||
// three-byte utf8 char go on
|
||||
//
|
||||
if ((Temp & 0xc0) == 0x80) {
|
||||
|
||||
Utf8Char->Utf8_3[2 - Index] = Temp;
|
||||
Index++;
|
||||
if (Index == 3) {
|
||||
if (Index > 2) {
|
||||
FetchFlag = FALSE;
|
||||
}
|
||||
} else {
|
||||
|
||||
//
|
||||
// reset *ValidBytes and Index to zero, let valid utf8 char search restart
|
||||
//
|
||||
*ValidBytes = 0;
|
||||
Index = 0;
|
||||
}
|
||||
|
@ -164,7 +172,7 @@ GetOneValidUtf8Char (
|
|||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Translate VT-UTF8 characters into one Unicode character.
|
||||
|
||||
UTF8 Encoding Table
|
||||
|
@ -176,7 +184,7 @@ GetOneValidUtf8Char (
|
|||
|
||||
@param Utf8Char VT-UTF8 character set needs translating.
|
||||
@param ValidBytes The count of valid VT-UTF8 characters.
|
||||
@param UnicodeChar Returned unicode character.
|
||||
@param UnicodeChar Returned unicode character.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -237,7 +245,7 @@ Utf8ToUnicode (
|
|||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Translate one Unicode character into VT-UTF8 characters.
|
||||
|
||||
UTF8 Encoding Table
|
||||
|
@ -301,8 +309,8 @@ UnicodeToUtf8 (
|
|||
Check if input string is valid VT-UTF8 string.
|
||||
|
||||
@param TerminalDevice The terminal device.
|
||||
@param WString The input string.
|
||||
|
||||
@param WString The input string.
|
||||
|
||||
@retval EFI_SUCCESS If all input characters are valid.
|
||||
|
||||
**/
|
||||
|
|
Loading…
Reference in New Issue