]> git.proxmox.com Git - mirror_edk2.git/blob - TerminalDxe/ansi.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / TerminalDxe / ansi.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 ansi.c
15
16 Abstract:
17
18
19 Revision History
20 --*/
21
22
23 #include "Terminal.h"
24
25 VOID
26 AnsiRawDataToUnicode (
27 IN TERMINAL_DEV *TerminalDevice
28 )
29 {
30 UINT8 RawData;
31
32 //
33 // pop the raw data out from the raw fifo,
34 // and translate it into unicode, then push
35 // the unicode into unicode fifo, until the raw fifo is empty.
36 //
37 while (!IsRawFiFoEmpty (TerminalDevice)) {
38
39 RawFiFoRemoveOneKey (TerminalDevice, &RawData);
40
41 UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16) RawData);
42 }
43 }
44
45 EFI_STATUS
46 AnsiTestString (
47 IN TERMINAL_DEV *TerminalDevice,
48 IN CHAR16 *WString
49 )
50 {
51 CHAR8 GraphicChar;
52
53 //
54 // support three kind of character:
55 // valid ascii, valid efi control char, valid text graphics.
56 //
57 for (; *WString != CHAR_NULL; WString++) {
58
59 if ( !(TerminalIsValidAscii (*WString) ||
60 TerminalIsValidEfiCntlChar (*WString) ||
61 TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL) )) {
62
63 return EFI_UNSUPPORTED;
64 }
65 }
66
67 return EFI_SUCCESS;
68 }