]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Application/HelloWorld/HelloWorld.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Application / HelloWorld / HelloWorld.c
1 /** @file
2 This sample application bases on HelloWorld PCD setting
3 to print "UEFI Hello World!" to the UEFI Console.
4
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <Uefi.h>
11 #include <Library/PcdLib.h>
12 #include <Library/UefiLib.h>
13 #include <Library/UefiApplicationEntryPoint.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 //
23 GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);
24
25 /**
26 The user Entry Point for Application. The user code starts with this function
27 as the real entry point for the application.
28
29 @param[in] ImageHandle The firmware allocated handle for the EFI image.
30 @param[in] SystemTable A pointer to the EFI System Table.
31
32 @retval EFI_SUCCESS The entry point is executed successfully.
33 @retval other Some error occurs when executing this entry point.
34
35 **/
36 EFI_STATUS
37 EFIAPI
38 UefiMain (
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 }