]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Application/HelloWorld/HelloWorld.c
MdeModulePkg: Add sample help information for HelloWorld application.
[mirror_edk2.git] / MdeModulePkg / Application / HelloWorld / HelloWorld.c
CommitLineData
b7d286b6 1/** @file\r
109e9a61
LG
2 This sample application bases on HelloWorld PCD setting \r
3 to print "UEFI Hello World!" to the UEFI Console.\r
4\r
0d4a6c3d 5 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 6 This program and the accompanying materials \r
b7d286b6 7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14**/\r
15\r
ab9140c8 16#include <Uefi.h>\r
223c22d8 17#include <Library/PcdLib.h>\r
ab9140c8
A
18#include <Library/UefiLib.h>\r
19#include <Library/UefiApplicationEntryPoint.h>\r
b7d286b6 20\r
0d4a6c3d
QS
21//\r
22// String token ID of help message text.\r
23// Shell supports to find help message in the resource section of an application image if\r
24// .MAN file is not found. This global variable is added to make build tool recognizes\r
25// that the help string is consumed by user and then build tool will add the string into\r
26// the resource section. Thus the application can use '-?' option to show help message in\r
27// Shell.\r
28//\r
29GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);\r
b9575d60
A
30\r
31/**\r
32 The user Entry Point for Application. The user code starts with this function\r
109e9a61 33 as the real entry point for the application.\r
b9575d60
A
34\r
35 @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
36 @param[in] SystemTable A pointer to the EFI System Table.\r
37 \r
38 @retval EFI_SUCCESS The entry point is executed successfully.\r
39 @retval other Some error occurs when executing this entry point.\r
40\r
41**/\r
b7d286b6 42EFI_STATUS\r
43EFIAPI\r
44UefiMain (\r
45 IN EFI_HANDLE ImageHandle,\r
46 IN EFI_SYSTEM_TABLE *SystemTable\r
47 )\r
b7d286b6 48{\r
223c22d8
LG
49 UINT32 Index;\r
50 \r
51 Index = 0;\r
b7d286b6 52 \r
223c22d8
LG
53 //\r
54 // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample.\r
55 //\r
56 if (FeaturePcdGet (PcdHelloWorldPrintEnable)) {\r
57 for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) {\r
109e9a61
LG
58 //\r
59 // Use UefiLib Print API to print string to UEFI console\r
60 //\r
223c22d8
LG
61 Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString));\r
62 }\r
63 }\r
b7d286b6 64\r
65 return EFI_SUCCESS;\r
66}\r