Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/xilinx Fix MASK_DATA_SET macro



details:   https://anonhg.NetBSD.org/src/rev/d9b9d00475aa
branches:  trunk
changeset: 372154:d9b9d00475aa
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 29 01:19:36 2022 +0000

description:
Fix MASK_DATA_SET macro

diffstat:

 sys/arch/arm/xilinx/zynq_gpio.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 0e17b791a8a0 -r d9b9d00475aa sys/arch/arm/xilinx/zynq_gpio.c
--- a/sys/arch/arm/xilinx/zynq_gpio.c   Sat Oct 29 00:19:21 2022 +0000
+++ b/sys/arch/arm/xilinx/zynq_gpio.c   Sat Oct 29 01:19:36 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zynq_gpio.c,v 1.2 2022/10/27 22:35:31 jmcneill Exp $ */
+/* $NetBSD: zynq_gpio.c,v 1.3 2022/10/29 01:19:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zynq_gpio.c,v 1.2 2022/10/27 22:35:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_gpio.c,v 1.3 2022/10/29 01:19:36 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -46,7 +46,8 @@
 #define        ZYNQ_GPIO_NPINS         (4 * 32)
 
 #define        MASK_DATA_REG(pin)      (0x000 + 0x4 * ((pin) / 16))
-#define        MASK_DATA_SET(pin, val) ((((pin) % 16) << 16) | ((val) << ((pin) % 16)))
+#define        MASK_DATA_SET(pin, val) \
+       ((1 << (((pin) % 16) + 16)) | ((val) << ((pin) % 16)))
 #define        DATA_RO_REG(pin)        (0x060 + 0x4 * ((pin) / 32))
 #define        DATA_RO_BIT(pin)        __BIT((pin) % 32)
 #define        DIRM_REG(pin)           (0x204 + 0x40 * ((pin) / 32))



Home | Main Index | Thread Index | Old Index