On 2021.06.07 08:53, Sunny Wang wrote:
Make the changes below for making it clearer.
     - Rename GpioPinSet() to GpioPinConfigure()
     - Rename parameter Val to Config and change its type to BOOLEAN

Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@arm.com>
Cc: Sami Mujawar <sami.muja...@arm.com>
Cc: Jeremy Linton <jeremy.lin...@arm.com>
Cc: Pete Batard <p...@akeo.ie>
Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Mario Bălănică <mariobalanic...@gmail.com>
Signed-off-by: Sunny Wang <sunny.w...@arm.com>
---
  Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h | 10 +++++++---
  Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c |  9 +++++----
  2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h 
b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
index 75c2c8be51..1f7d2204e0 100644
--- a/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
+++ b/Silicon/Broadcom/Bcm283x/Include/Library/GpioLib.h
@@ -3,6 +3,7 @@
   *  GPIO manipulation.
   *
   *  Copyright (c) 2018, Andrei Warkentin <andrey.warken...@gmail.com>
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
   *
   *  SPDX-License-Identifier: BSD-2-Clause-Patent
   *
@@ -13,6 +14,9 @@
#include <IndustryStandard/Bcm2836Gpio.h> +#define CLEAR_GPIO 0
+#define SET_GPIO      1
+
  VOID
  GpioPinFuncSet (
    IN  UINTN Pin,
@@ -25,9 +29,9 @@ GpioPinFuncGet (
    );
VOID
-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
    );
UINTN
diff --git a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c 
b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
index a4b4af59eb..eaf53e5369 100644
--- a/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
+++ b/Silicon/Broadcom/Bcm283x/Library/GpioLib/GpioLib.c
@@ -4,6 +4,7 @@
   *
   *  Copyright (c) 2020, Pete Batard <p...@akeo.ie>
   *  Copyright (c) 2018, Andrei Warkentin <andrey.warken...@gmail.com>
+ *  Copyright (c) 2021, ARM Limited. All rights reserved.
   *
   *  SPDX-License-Identifier: BSD-2-Clause-Patent
   *
@@ -85,9 +86,9 @@ GpioPinFuncGet (
  }
VOID
-GpioPinSet (
-  IN  UINTN Pin,
-  IN  UINTN Val
+GpioPinConfigure (
+  IN  UINTN   Pin,
+  IN  BOOLEAN Config
    )
  {
    EFI_PHYSICAL_ADDRESS Reg;
@@ -102,7 +103,7 @@ GpioPinSet (
    //
    // Different base addresses are used for clear and set
    //
-  Reg = (Val == 0) ? GPIO_GPCLR0 : GPIO_GPSET0;
+  Reg = (Config == CLEAR_GPIO) ? GPIO_GPCLR0 : GPIO_GPSET0;
    Reg += RegIndex * sizeof (UINT32);
    MmioWrite32 (Reg, 1 << SelIndex);
  }


Reviewed-by: Pete Batard <p...@akeo.ie>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76432): https://edk2.groups.io/g/devel/message/76432
Mute This Topic: https://groups.io/mt/83365132/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to