TianoCore EDK2 master
Loading...
Searching...
No Matches
HelloWorld.c
Go to the documentation of this file.
1
10#include <Uefi.h>
11#include <Library/PcdLib.h>
12#include <Library/UefiLib.h>
14
15//
16// String token ID of help message text.
17// Shell supports to find help message in the resource section of an application image if
18// .MAN file is not found. This global variable is added to make build tool recognizes
19// that the help string is consumed by user and then build tool will add the string into
20// the resource section. Thus the application can use '-?' option to show help message in
21// Shell.
22//
23GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);
24
37EFIAPI
39 IN EFI_HANDLE ImageHandle,
40 IN EFI_SYSTEM_TABLE *SystemTable
41 )
42{
43 UINT32 Index;
44
45 Index = 0;
46
47 //
48 // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample.
49 //
50 if (FeaturePcdGet (PcdHelloWorldPrintEnable)) {
51 for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index++) {
52 //
53 // Use UefiLib Print API to print string to UEFI console
54 //
55 Print ((CHAR16 *)PcdGetPtr (PcdHelloWorldPrintString));
56 }
57 }
58
59 return EFI_SUCCESS;
60}
EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: HelloWorld.c:38
#define IN
Definition: Base.h:279
#define GLOBAL_REMOVE_IF_UNREFERENCED
Definition: Base.h:48
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388
#define FeaturePcdGet(TokenName)
Definition: PcdLib.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
#define STRING_TOKEN(t)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113