From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.124]) by mx.groups.io with SMTP id smtpd.web12.10400.1609949369283746981 for ; Wed, 06 Jan 2021 08:09:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=I1xwAN+N; spf=pass (domain: os.amperecomputing.com, ip: 40.107.94.124, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MSqJHG79XeZE4HV6rP30z8XV8uqSC0oYMz0Agi7wD+yaTerPQQ2midnczLnqj89WcxV3s0d87NUNusUqF0SYbi91qJH7EgurXSHICsNTK517IwypwdqqsiO7wh0vK8v9Me9EfztXKrqhjy4DG2gSVWqhWZ82KQzolAp0a+6iOJF0YhzEbzEr5bmCxAbPdJPAMzl9CxRe/1gIZUxCmU++YefPTO+uuFY+choF4UtcEkK+Gtm8wDWcnCaEBSoWtJTxo9ji27TzqBMeyUDaFoOmho/EI5fSAlHA9iZlMvhc/sAz8s+xf2Wj3phkD/wYbh3SINQ+YpVPEy6RNGYiyv5y0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dLUGKGlrrqGFIk8DiIG8oum+tGPZaOzU6Z31+PY5ZDA=; b=gXYRDAhSrOQG0QFtJMCFcz/QgJqCe1fxubmg3OJA1cz0sKEtV9GMz4jKA1F+04gSa3669FZ3r2gx9QIv4Z/OJqasrlUj1lZj2ytpC8CoHynktXhXGtLQDbdHgI05d23U1z1YZtAkcBkuvkoNHp0bMCW6WuNW2kimTWsk+/2Q0Kw9Js7PUVmFyQL1s88o9NSjcqP5e1rCgzFkMrWa9cKdQZ+eKJTdXr5mLmb50ArQAKKTfswb43RKKI7d75EH3tbC8Ek4zx09P4t4O2++0iMObPXwwB9z3W2aWyUyvp8xiA7pXNQocfg+SBmtVa1E+1vM0xM7Su3IywqMxTm3ANPldg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dLUGKGlrrqGFIk8DiIG8oum+tGPZaOzU6Z31+PY5ZDA=; b=I1xwAN+NKGflmoJSVWNjwdVdbdjVBg/SZ1GtgU+bIBVJy/uysH4Z1yIvcXphSxZqwgU5HY+Q37K5uSKCNlHJ48DcQSSy8g3+KFfvkbfVyJaibRJOkwBFlJUDDqOJkMjzHfij3rQpvFA4BqtlVcqBIdLCn4XM19CHtsGhWY3OqDk= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2538.prod.exchangelabs.com (2603:10b6:3:3e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Wed, 6 Jan 2021 16:09:28 +0000 Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::c814:9a08:5c2e:4076%5]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021 16:09:28 +0000 From: "Nhi Pham" To: devel@edk2.groups.io Cc: Nhi Pham , Leif Lindholm , Ard Biesheuvel Subject: [PATCH v2 1/4] EmbeddedPkg/TimeBaseLib: Update comment blocks for API functions Date: Wed, 6 Jan 2021 23:09:00 +0700 Message-Id: <20210106160903.27679-2-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210106160903.27679-1-nhi@os.amperecomputing.com> References: <20210106160903.27679-1-nhi@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR02CA0220.apcprd02.prod.outlook.com (2603:1096:201:20::32) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (118.69.219.201) by HK2PR02CA0220.apcprd02.prod.outlook.com (2603:1096:201:20::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Wed, 6 Jan 2021 16:09:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc3dd6a0-21b4-487a-2163-08d8b25d71c9 X-MS-TrafficTypeDiagnostic: DM5PR01MB2538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MtN0Z7sKjpxcexQ2TyUTiuLh9UVJz5qAWdMLEFPemS3RTjdzfvQ78GqLnRT4g965AIWvsPjeBvkPdK2N+8dHqolyuiqGwu1M92kV8VjSoZEHQSDYICzq94WS0dV4rwa3qvFKqbSZZgVa2+Nqcuq7YYLz8MFdm5L0d3RjZ3STJD74ScfA6xyBQASW8RoLGWiXfU9MPdGAffUnsBjRfYuqv8vJWS/rWxIKrP8BWajIfKBJPqQKkqtj97KPypCk6IL4fRt6kJn6scqurSxAzjFcgUtIqL/tqSmR0zt5xSyKTg4la7KGiuMM8/x97QVUulkHtDE/sxuOFrkxCGD+FQQ9h9hqJotXP20q8bU6jroVbXV4RyMo1k5YEf1ybqw7rnexXX4cs+HpLD5auq0paZ0CD6uYRYlvYg4WhHxrUfcOSD2BW05Xx4CUYzXEFfB2Im2eu1u2jgSb8Sx90jrF3MpALA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR01MB5849.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(376002)(346002)(396003)(39850400004)(2616005)(6506007)(956004)(316002)(1076003)(6666004)(69590400011)(2906002)(8676002)(15650500001)(478600001)(6486002)(8936002)(54906003)(186003)(26005)(83380400001)(16526019)(6916009)(66556008)(6512007)(86362001)(4326008)(66476007)(52116002)(5660300002)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?wdvPajKh+kCJTdEOmUz82ZT7Wpf7KOzE7eTwNTeUpfKMG/a/qtckSSbv5RVS?= =?us-ascii?Q?gh3eeHlTQEbHkqi1D5RbN7LubBDhJ1MouR8BdduvNkJ09bitFbS+VIARfbou?= =?us-ascii?Q?1slyVqpxiHRUWsihK7BC5NfBozLVbzmJDeWWN0au34uBepAM7ra2b54jiYt7?= =?us-ascii?Q?E4gmWbQV1qyaoYWyMej9Kd7uDG6Ct/hZ+qBkLs70UeBzKCoZ1XrbntoPe39e?= =?us-ascii?Q?8s2yOrBiJGIf6anydq1qyE/T5GQJhF8PsQ3rkkdb9F4zb63H8rOp/k28mORH?= =?us-ascii?Q?G0uEN9Y5bnboHVQwpEBoYIiPaXQY2xDWpqxR2A8efju4BPRlIZwUPJgHGgPc?= =?us-ascii?Q?pSvFj92UIGohhBq38/9K5rkThQUoUXalbsBgCU0sAQNnRaxZmMS3oMn+d9zf?= =?us-ascii?Q?IUo/2C6KX02sYbCSZ9pgqwtXnuJX40T6UFiVis5FLt9vokfm5h47qiBuP1p5?= =?us-ascii?Q?z1L7/18fzPWcSga83dH8igsx1lVOPh5HNTSiQ9CvaQpEP9bMqInoyOxoz/ul?= =?us-ascii?Q?Y5tAHAMMEFdXer8mZN7ht2/Komop6neoUpa2UceycVmfGYqgQDYjUKYIDKAm?= =?us-ascii?Q?kfEbjayC1jx0wzg950L1lw3f4ESHJkhY0jFibZ0kD49jCou+x5LoiuGeizrT?= =?us-ascii?Q?pI2H6nGyk/jsTdqKhP89PML2kWqUUx7t9w/twCgbVV4VTb2QNrI320Unl5PC?= =?us-ascii?Q?csWX6XT7FUrkk3IjIA7HLDegRHCI7l8Yro420n0ImRWHl+e+p40bvfQME4h+?= =?us-ascii?Q?rGMFnbAmptqm/ezu2gqrDWztRoF/KNyx9CeoKJnX7QDWPSkufYCoPtTdjMlj?= =?us-ascii?Q?26DIfvMcq0ZF6X+4qCV/Ypx18fafBMKhJfy6fz2t83FcGFVt8H80edAp0KVt?= =?us-ascii?Q?xqC2y+wRTfHQtRgeHEY2HHvTnyBVa0xaeo6XuNekzk3Lz0BEYE5UmI5KW8Bx?= =?us-ascii?Q?xPNBWHzVHBiucyN+bPkkvhTiUOdA30n+imR6lcFY/S7YkPFa3CsNt2rKlG8x?= =?us-ascii?Q?YybO?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2021 16:09:28.3214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-Network-Message-Id: bc3dd6a0-21b4-487a-2163-08d8b25d71c9 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ACCoXNacJub2bJj4ok0JaI+Wped0h4v+Z7q5QZ81KdD152p0GmuR4JFyP54BS6JqrR5D6ZZlRxJmjOKrzb5vtRoGcuYndH1uPfBtXZaRfkk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2538 Content-Type: text/plain This updates Doxygen comment blocks for API library functions. Cc: Leif Lindholm Cc: Ard Biesheuvel Signed-off-by: Nhi Pham --- EmbeddedPkg/Include/Library/TimeBaseLib.h | 54 +++++++++++++++-- EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c | 64 +++++++++++++++++--- 2 files changed, 104 insertions(+), 14 deletions(-) diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h index 90853c3f4b93..a9f3c6588b75 100644 --- a/EmbeddedPkg/Include/Library/TimeBaseLib.h +++ b/EmbeddedPkg/Include/Library/TimeBaseLib.h @@ -2,6 +2,7 @@ * * Copyright (c) 2016, Hisilicon Limited. All rights reserved. * Copyright (c) 2016-2019, Linaro Limited. All rights reserved. +* Copyright (c) 2021, Ampere Computing LLC. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -52,18 +53,45 @@ #define SEC_PER_HOUR ((UINTN) 3600) #define SEC_PER_DAY ((UINTN) 86400) +/** + Check if it is a leap year. + + @param Time The UEFI time to be checked. + + @retval TRUE It is a leap year. + @retval FALSE It is NOT a leap year. + +**/ BOOLEAN EFIAPI IsLeapYear ( IN EFI_TIME *Time ); +/** + Check if the day in the UEFI time is valid. + + @param Time The UEFI time to be checked. + + @retval TRUE Valid. + @retval FALSE Invalid. + +**/ BOOLEAN EFIAPI IsDayValid ( IN EFI_TIME *Time ); +/** + Check if the UEFI time is valid. + + @param Time The UEFI time to be checked. + + @retval TRUE Valid. + @retval FALSE Invalid. + +**/ BOOLEAN EFIAPI IsTimeValid ( @@ -71,8 +99,12 @@ IsTimeValid ( ); /** - Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME - **/ + Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME. + + @param EpochSeconds Epoch seconds. + @param Time The time converted to UEFI format. + +**/ VOID EFIAPI EpochToEfiTime ( @@ -81,8 +113,13 @@ EpochToEfiTime ( ); /** - Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) - **/ + Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC). + + @param Time The UEFI time to be converted. + + @return Number of seconds. + +**/ UINTN EFIAPI EfiTimeToEpoch ( @@ -90,8 +127,13 @@ EfiTimeToEpoch ( ); /** - returns Day of the week [0-6] 0=Sunday - **/ + Get the day of the week from the UEFI time. + + @param Time The UEFI time to be calculated. + + @return The day of the week: Sunday=0, Monday=1, ... Saturday=6 + +**/ UINTN EfiTimeToWday ( IN EFI_TIME *Time diff --git a/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c b/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c index 78fc7b6cd2e5..c9048d765960 100644 --- a/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c +++ b/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c @@ -2,6 +2,7 @@ * * Copyright (c) 2016, Hisilicon Limited. All rights reserved. * Copyright (c) 2016-2019, Linaro Limited. All rights reserved. +* Copyright (c) 2021, Ampere Computing LLC. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -13,8 +14,12 @@ #include /** - Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME - **/ + Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME. + + @param EpochSeconds Epoch seconds. + @param Time The time converted to UEFI format. + +**/ VOID EFIAPI EpochToEfiTime ( @@ -71,8 +76,13 @@ EpochToEfiTime ( } /** - Calculate Epoch days - **/ + Calculate Epoch days. + + @param Time The UEFI time to be calculated. + + @return Number of days. + +**/ UINTN EFIAPI EfiGetEpochDays ( @@ -96,9 +106,15 @@ EfiGetEpochDays ( return EpochDays; } + /** - Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) - **/ + Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC). + + @param Time The UEFI time to be converted. + + @return Number of seconds. + +**/ UINTN EFIAPI EfiTimeToEpoch ( @@ -116,8 +132,13 @@ EfiTimeToEpoch ( } /** - returns Day of the week [0-6] 0=Sunday - **/ + Get the day of the week from the UEFI time. + + @param Time The UEFI time to be calculated. + + @return The day of the week: Sunday=0, Monday=1, ... Saturday=6 + +**/ UINTN EfiTimeToWday ( IN EFI_TIME *Time @@ -132,6 +153,15 @@ EfiTimeToWday ( return (EpochDays + 4) % 7; } +/** + Check if it is a leap year. + + @param Time The UEFI time to be checked. + + @retval TRUE It is a leap year. + @retval FALSE It is NOT a leap year. + +**/ BOOLEAN EFIAPI IsLeapYear ( @@ -153,6 +183,15 @@ IsLeapYear ( } } +/** + Check if the day in the UEFI time is valid. + + @param Time The UEFI time to be checked. + + @retval TRUE Valid. + @retval FALSE Invalid. + +**/ BOOLEAN EFIAPI IsDayValid ( @@ -171,6 +210,15 @@ IsDayValid ( return TRUE; } +/** + Check if the UEFI time is valid. + + @param Time The UEFI time to be checked. + + @retval TRUE Valid. + @retval FALSE Invalid. + +**/ BOOLEAN EFIAPI IsTimeValid( -- 2.17.1