From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.77]) by mx.groups.io with SMTP id smtpd.web12.16982.1597245832324658486 for ; Wed, 12 Aug 2020 08:23:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=HZK2Gv7q; spf=pass (domain: arm.com, ip: 40.107.0.77, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=umfjmn24x9CuTRjJwVb5Z+enYXLfgGYry9hpxrYKTvE=; b=HZK2Gv7qdtpxhX9CfIpQBoX1OGpsAAFL+YKSE4saPw4X62Zyt8Bn59tDmlUNHC4nu19UbX7Kk0TOgRDiMmA7hdf10b5D/ymc47MiO7ERoX0jn6nfvFBUnA/kFjbVt1uWP+Kdf2bkmPaWGW/OurF503/dTmXgcP/pVsPn7wqu9pM= Received: from MR2P264CA0159.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:1::22) by DB7PR08MB3817.eurprd08.prod.outlook.com (2603:10a6:10:77::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.17; Wed, 12 Aug 2020 15:23:49 +0000 Received: from VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:501:1:cafe::ca) by MR2P264CA0159.outlook.office365.com (2603:10a6:501:1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Wed, 12 Aug 2020 15:23:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT057.mail.protection.outlook.com (10.152.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Wed, 12 Aug 2020 15:23:49 +0000 Received: ("Tessian outbound 7fc8f57bdedc:v64"); Wed, 12 Aug 2020 15:23:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ddd696711c568be4 X-CR-MTA-TID: 64aa7808 Received: from 0a008541c073.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 74DFACFA-98F2-4C8B-A0BB-31DF37D8B93E.1; Wed, 12 Aug 2020 15:23:44 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0a008541c073.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 12 Aug 2020 15:23:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bd4tPQCZiR9vLtKp9PUHaMEFp60HSZJk8487baAN7dImk/gaj/Xok6rMDHODyCEhUC7rvc9E75gSh3isVmnCX6wKgJ1EOIjbH+kDc784m/VYyOPy+RZRzLfRctOXDy3m6KHIUuU62QQbIS/ES8iypcEYhm8/Rd2yUHsFUHCwNNGtbWaifvlU9HEDnvdtnLmaz+p573zoNAs+bi3IKX0PJ0pIsXL35Mm+j9/YSEOlGx2Ehb3uPCtvclj+4wkquw/mNfpkXrY5FmV8yF0WqvOXIVFzaNRqyWVwEMPaTGUK59ky/cAu4MT347Ts7MzWpqNBq+Gn+/4xgbcxRebHLzGIVQ== 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=umfjmn24x9CuTRjJwVb5Z+enYXLfgGYry9hpxrYKTvE=; b=Hzjw4mmMqKuGBtGvCgs+N3xs61TFqUGX+MG6C1acoHBgYtWJuWK5CBw7T44XljQXOc0Pda24/o6wOYZVT/kLStqI6h0oysKYWUkVpxO2SgPLogPBoKcOrUIDS42827t2CNPuThgFAAf2zsGf1zxvy009oteu6sQXkpWqlcs0IlcpayyLsxQHPddQCTqtd0U4FkhpJtYQOsP9InU9pwtCplQSeLC7HUzhsUL61WImViaVXNtRs7ffu4V+w9GArkPckiT1TcpWN9pZXn2hJCHm0K8hyr/fAFaAkt+krmIFtdUDqTFG6LlzhRwvywAj1b8R1twa2R42Usk7/XG27iJIvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=umfjmn24x9CuTRjJwVb5Z+enYXLfgGYry9hpxrYKTvE=; b=HZK2Gv7qdtpxhX9CfIpQBoX1OGpsAAFL+YKSE4saPw4X62Zyt8Bn59tDmlUNHC4nu19UbX7Kk0TOgRDiMmA7hdf10b5D/ymc47MiO7ERoX0jn6nfvFBUnA/kFjbVt1uWP+Kdf2bkmPaWGW/OurF503/dTmXgcP/pVsPn7wqu9pM= Received: from AM6PR10CA0089.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::30) by AM4PR0802MB2195.eurprd08.prod.outlook.com (2603:10a6:200:5d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15; Wed, 12 Aug 2020 15:23:42 +0000 Received: from AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::9a) by AM6PR10CA0089.outlook.office365.com (2603:10a6:209:8c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Wed, 12 Aug 2020 15:23:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT049.mail.protection.outlook.com (10.152.17.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3283.16 via Frontend Transport; Wed, 12 Aug 2020 15:23:42 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 12 Aug 2020 15:23:41 +0000 Received: from E107187.Arm.com (10.57.41.222) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Wed, 12 Aug 2020 15:23:41 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH v1 26/30] DynamicTablesPkg: Add AsciiFromHex helper function Date: Wed, 12 Aug 2020 16:22:32 +0100 Message-ID: <20200812152236.31164-27-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20200812152236.31164-1-sami.mujawar@arm.com> References: <20200812152236.31164-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3488f8e-2b49-4980-a1b8-08d83ed3b6a5 X-MS-TrafficTypeDiagnostic: AM4PR0802MB2195:|DB7PR08MB3817: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4303;OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(39860400002)(346002)(396003)(376002)(136003)(46966005)(6916009)(1076003)(186003)(4326008)(8936002)(426003)(44832011)(54906003)(316002)(2616005)(81166007)(83380400001)(70586007)(336012)(2906002)(6666004)(82310400002)(36756003)(47076004)(5660300002)(82740400003)(70206006)(8676002)(7696005)(26005)(86362001)(478600001)(356005);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2195 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ba7bd9ad-a615-4a6d-bd02-08d83ed3b262 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FIcb5rgvRviZowH1UYK0AAjOXNNGDTopFYnIs02m+YaUkJxjRVz2lSOGgPzE+FFe+d3UbV0paM/LO+MvGS45d2j0RaGGz9/9A3uW2P4sonQxOY/ZFw1XbBlrrnfQ1y1MEziH/sjq8OlEunB+rM1HQ+KqzsKa49a7M9xLMDWPCejRw0CstBnLMqcdKOhY7S2xToKNSRfwqIGkaKbVcUmDuYSKVqbEPX8Cs2PdUFWYp21TdHNhBGmymss0IhDiLGrp44LjFw7JjO4pqhzk5L2bY+BjKDGgpxpAwhuVWkZ2/3+kiPW3vLP9Ms+I2pMllrmrVp0ATMxKx983XXPgaqNwnUDqeBroiS9U7z1i6OmrJp2dyHY2Ey8UmFENqeydEacDFIBW9ilTgz3jYH0dLgsdhw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFTY:;SFS:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966005)(2616005)(2906002)(82740400003)(70206006)(26005)(36756003)(83380400001)(36906005)(6666004)(186003)(4326008)(70586007)(81166007)(316002)(426003)(1076003)(86362001)(54906003)(8676002)(7696005)(5660300002)(478600001)(82310400002)(47076004)(8936002)(336012)(6916009)(44832011);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2020 15:23:49.5185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3488f8e-2b49-4980-a1b8-08d83ed3b6a5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3817 Content-Type: text/plain AsciiFromHex is a function converts a hex number to an ASCII character. This function is used across multiple generators, so add it to the TableHelperLib. Signed-off-by: Pierre Gondois Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Include/Library/TableHelperLib.h | 15 +++++++++- DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c | 30 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h index e4a8dfa046bd97d89f0297ccad521f317bed5c36..099a0a4544e3d1f746d4be8533cb006786f11611 100644 --- a/DynamicTablesPkg/Include/Library/TableHelperLib.h +++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -107,4 +107,17 @@ FindDuplicateValue ( IN PFN_IS_EQUAL EqualTestFunction ); +/** Convert a hex number to its ASCII code. + + @param [in] x Hex number to convert. + Must be 0 <= x < 16. + + @return The ASCII code corresponding to x. +**/ +UINT8 +EFIAPI +AsciiFromHex ( + IN UINT8 x + ); + #endif // TABLE_HELPER_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c index fc6cf3b088da1f7ad89dd4356b414bede9e80575..0d9daad3b05b6e82089f92afb6de4eeee5af9a28 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c @@ -1,8 +1,9 @@ /** @file Table Helper -Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. -SPDX-License-Identifier: BSD-2-Clause-Patent + Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include @@ -244,3 +245,28 @@ FindDuplicateValue ( } return FALSE; } + +/** Convert a hex number to its ASCII code. + + @param [in] x Hex number to convert. + Must be 0 <= x < 16. + + @return The ASCII code corresponding to x. +**/ +UINT8 +EFIAPI +AsciiFromHex ( + IN UINT8 x + ) +{ + if (x < 10) { + return (UINT8)(x + '0'); + } + + if (x < 16) { + return (UINT8)(x - 10 + 'A'); + } + + ASSERT (FALSE); + return (UINT8)0; +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'