Home | History | Annotate | Download | only in Include
      1 /*++
      2 
      3 Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
      4 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   EfiPrintLib.h
     15 
     16 Abstract:
     17 
     18   Light weight lib to support EFI drivers.
     19 
     20 --*/
     21 
     22 #ifndef _EFI_PRINT_LIB_H_
     23 #define _EFI_PRINT_LIB_H_
     24 
     25 #include EFI_PROTOCOL_DEFINITION(GraphicsOutput)
     26 #include EFI_PROTOCOL_DEFINITION(UgaDraw)
     27 #include EFI_PROTOCOL_DEFINITION(Print)
     28 
     29 UINTN
     30 ErrorPrint (
     31   IN CONST CHAR16 *ErrorString,
     32   IN CONST CHAR8  *Format,
     33   ...
     34   )
     35 /*++
     36 
     37 Routine Description:
     38 
     39   Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
     40   characters.
     41 
     42 Arguments:
     43 
     44   ErrorString   - Error message printed first
     45 
     46   Format - Ascii format string see file header for more details.
     47 
     48   ...    - Vararg list consumed by processing Format.
     49 
     50 Returns:
     51 
     52   Number of characters printed.
     53 
     54 --*/
     55 ;
     56 
     57 VOID
     58 ErrorDumpHex (
     59   IN UINTN        Indent,
     60   IN UINTN        Offset,
     61   IN UINTN        DataSize,
     62   IN VOID         *UserData
     63   )
     64 /*++
     65 
     66 Routine Description:
     67 
     68   Dump error info by hex.
     69 
     70 Arguments:
     71 
     72   Indent    - Indent number
     73   Offset    - Offset number
     74   DataSize  - Size of user data
     75   UserData  - User data to dump
     76 
     77 Returns:
     78 
     79   None
     80 
     81 --*/
     82 ;
     83 
     84 UINTN
     85 Print (
     86   IN CONST CHAR16  *Format,
     87   ...
     88   )
     89 /*++
     90 
     91 Routine Description:
     92 
     93     Prints a formatted unicode string to the default console
     94 
     95 Arguments:
     96 
     97     fmt         - Format string
     98 
     99 Returns:
    100 
    101     Length of string printed to the console
    102 
    103 --*/
    104 ;
    105 
    106 UINTN
    107 PrintXY (
    108   IN UINTN                            X,
    109   IN UINTN                            Y,
    110   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *Foreground, OPTIONAL
    111   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *Background, OPTIONAL
    112   IN CHAR16                           *Fmt,
    113   ...
    114   )
    115 /*++
    116 
    117 Routine Description:
    118 
    119     Prints a formatted unicode string to the default console
    120 
    121 Arguments:
    122 
    123     X           - X coordinate to start printing
    124 
    125     Y           - Y coordinate to start printing
    126 
    127     ForeGround  - Foreground color
    128 
    129     BackGround  - Background color
    130 
    131     Fmt         - Format string
    132 
    133     ...         - Print arguments
    134 
    135 Returns:
    136 
    137     Length of string printed to the console
    138 
    139 --*/
    140 ;
    141 
    142 UINTN
    143 Aprint (
    144   IN CONST CHAR8  *Format,
    145   ...
    146   )
    147 /*++
    148 
    149 Routine Description:
    150 
    151   Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
    152   characters.
    153 
    154 Arguments:
    155 
    156   Format - Ascii format string see file header for more details.
    157 
    158   ...    - Vararg list consumed by processing Format.
    159 
    160 Returns:
    161 
    162   Number of characters printed.
    163 
    164 --*/
    165 ;
    166 
    167 UINTN
    168 UPrint (
    169   IN CONST CHAR16  *Format,
    170   ...
    171   )
    172 /*++
    173 
    174 Routine Description:
    175 
    176   Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
    177   characters.
    178 
    179 Arguments:
    180 
    181   Format - Ascii format string see file header for more details.
    182 
    183   ...    - Vararg list consumed by processing Format.
    184 
    185 Returns:
    186 
    187   Number of characters printed.
    188 
    189 --*/
    190 ;
    191 
    192 UINTN
    193 EFIAPI
    194 VSPrint (
    195   OUT CHAR16        *StartOfBuffer,
    196   IN  UINTN         StrLen,
    197   IN  CONST CHAR16  *Format,
    198   IN  VA_LIST       Marker
    199   )
    200 /*++
    201 
    202 Routine Description:
    203 
    204     Prints a formatted unicode string to a buffer
    205 
    206 Arguments:
    207 
    208     StartOfBuffer   - Output buffer to print the formatted string into
    209     StrLen          - Size of Str.  String is truncated to this size.
    210                       A size of 0 means there is no limit
    211     Format          - The format string
    212     Marker          - Vararg list consumed by processing Format.
    213 
    214 Returns:
    215 
    216     String length returned in buffer
    217 
    218 --*/
    219 ;
    220 
    221 UINTN
    222 SPrint (
    223   OUT CHAR16      *Buffer,
    224   IN UINTN        BufferSize,
    225   IN CONST CHAR16 *Format,
    226   ...
    227   )
    228 /*++
    229 
    230 Routine Description:
    231 
    232   SPrint function to process format and place the results in Buffer.
    233 
    234 Arguments:
    235 
    236   Buffer     - Wide char buffer to print the results of the parsing of Format into.
    237 
    238   BufferSize - Maximum number of characters to put into buffer. Zero means no
    239                limit.
    240 
    241   Format - Format string see file header for more details.
    242 
    243   ...    - Vararg list consumed by processing Format.
    244 
    245 Returns:
    246 
    247   Number of characters printed.
    248 
    249 --*/
    250 ;
    251 
    252 //
    253 // BoxDraw support
    254 //
    255 BOOLEAN
    256 IsValidEfiCntlChar (
    257   IN  CHAR16  CharC
    258   )
    259 /*++
    260 
    261 Routine Description:
    262 
    263   Test whether a wide char is a valid control char.
    264 
    265 Arguments:
    266 
    267   CharC - A char
    268 
    269 Returns:
    270 
    271   TRUE    - A control char
    272 
    273   FALSE   - Not a control char
    274 
    275 --*/
    276 ;
    277 
    278 BOOLEAN
    279 IsValidAscii (
    280   IN  CHAR16  Ascii
    281   )
    282 /*++
    283 
    284 Routine Description:
    285 
    286   Test whether a wide char is a normal printable char
    287 
    288 Arguments:
    289 
    290   Ascii - A char
    291 
    292 Returns:
    293 
    294   True      - A normal, printable char
    295   FALSE     - Not a normal, printable char
    296 
    297 --*/
    298 ;
    299 
    300 BOOLEAN
    301 LibIsValidTextGraphics (
    302   IN  CHAR16  Graphic,
    303   OUT CHAR8   *PcAnsi,    OPTIONAL
    304   OUT CHAR8   *Ascii      OPTIONAL
    305   )
    306 /*++
    307 
    308 Routine Description:
    309 
    310     Detects if a Unicode char is for Box Drawing text graphics.
    311 
    312 Arguments:
    313 
    314     Graphic - Unicode char to test.
    315 
    316     PcAnsi  - Optional pointer to return PCANSI equivalent of Graphic.
    317 
    318     Ascii   - Optional pointer to return Ascii equivalent of Graphic.
    319 
    320 Returns:
    321 
    322     TRUE if Gpaphic is a supported Unicode Box Drawing character.
    323 
    324 --*/
    325 ;
    326 
    327 #endif
    328