| 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 | This program and the accompanying materials\r |
| 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 |
| 16 | #include <Uefi.h>\r |
| 17 | #include <Library/PcdLib.h>\r |
| 18 | #include <Library/UefiLib.h>\r |
| 19 | #include <Library/UefiApplicationEntryPoint.h>\r |
| 20 | \r |
| 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 |
| 29 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);\r |
| 30 | \r |
| 31 | /**\r |
| 32 | The user Entry Point for Application. The user code starts with this function\r |
| 33 | as the real entry point for the application.\r |
| 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 |
| 42 | EFI_STATUS\r |
| 43 | EFIAPI\r |
| 44 | UefiMain (\r |
| 45 | IN EFI_HANDLE ImageHandle,\r |
| 46 | IN EFI_SYSTEM_TABLE *SystemTable\r |
| 47 | )\r |
| 48 | {\r |
| 49 | UINT32 Index;\r |
| 50 | \r |
| 51 | Index = 0;\r |
| 52 | \r |
| 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 |
| 58 | //\r |
| 59 | // Use UefiLib Print API to print string to UEFI console\r |
| 60 | //\r |
| 61 | Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString));\r |
| 62 | }\r |
| 63 | }\r |
| 64 | \r |
| 65 | return EFI_SUCCESS;\r |
| 66 | }\r |