]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This sample application bases on HelloWorld PCD setting\r | |
3 | to print "UEFI Hello World!" to the UEFI Console.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
7 | \r | |
8 | **/\r | |
9 | \r | |
10 | #include <Uefi.h>\r | |
11 | #include <Library/PcdLib.h>\r | |
12 | #include <Library/UefiLib.h>\r | |
13 | #include <Library/UefiApplicationEntryPoint.h>\r | |
14 | \r | |
15 | //\r | |
16 | // String token ID of help message text.\r | |
17 | // Shell supports to find help message in the resource section of an application image if\r | |
18 | // .MAN file is not found. This global variable is added to make build tool recognizes\r | |
19 | // that the help string is consumed by user and then build tool will add the string into\r | |
20 | // the resource section. Thus the application can use '-?' option to show help message in\r | |
21 | // Shell.\r | |
22 | //\r | |
23 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);\r | |
24 | \r | |
25 | /**\r | |
26 | The user Entry Point for Application. The user code starts with this function\r | |
27 | as the real entry point for the application.\r | |
28 | \r | |
29 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
30 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
31 | \r | |
32 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
33 | @retval other Some error occurs when executing this entry point.\r | |
34 | \r | |
35 | **/\r | |
36 | EFI_STATUS\r | |
37 | EFIAPI\r | |
38 | UefiMain (\r | |
39 | IN EFI_HANDLE ImageHandle,\r | |
40 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
41 | )\r | |
42 | {\r | |
43 | UINT32 Index;\r | |
44 | \r | |
45 | Index = 0;\r | |
46 | \r | |
47 | //\r | |
48 | // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample.\r | |
49 | //\r | |
50 | if (FeaturePcdGet (PcdHelloWorldPrintEnable)) {\r | |
51 | for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) {\r | |
52 | //\r | |
53 | // Use UefiLib Print API to print string to UEFI console\r | |
54 | //\r | |
55 | Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString));\r | |
56 | }\r | |
57 | }\r | |
58 | \r | |
59 | return EFI_SUCCESS;\r | |
60 | }\r |