[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/42] hw/i2c/versatile_i2c: Add SCL/SDA definitions
From: |
Peter Maydell |
Subject: |
[PULL 28/42] hw/i2c/versatile_i2c: Add SCL/SDA definitions |
Date: |
Tue, 23 Jun 2020 12:38:50 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Use self-explicit definitions instead of magic values.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20200617072539.32686-4-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/i2c/versatile_i2c.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c
index 040139d701b..0ce10a1bcc0 100644
--- a/hw/i2c/versatile_i2c.c
+++ b/hw/i2c/versatile_i2c.c
@@ -45,6 +45,9 @@ REG32(CONTROL_GET, 0)
REG32(CONTROL_SET, 0)
REG32(CONTROL_CLR, 4)
+#define SCL BIT(0)
+#define SDA BIT(1)
+
static uint64_t versatile_i2c_read(void *opaque, hwaddr offset,
unsigned size)
{
@@ -76,8 +79,8 @@ static void versatile_i2c_write(void *opaque, hwaddr offset,
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Bad offset 0x%x\n", __func__, (int)offset);
}
- bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & 1) != 0);
- s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & 2) != 0);
+ bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SCL, (s->out & SCL) != 0);
+ s->in = bitbang_i2c_set(&s->bitbang, BITBANG_I2C_SDA, (s->out & SDA) != 0);
}
static const MemoryRegionOps versatile_i2c_ops = {
--
2.20.1
- [PULL 17/42] target/arm: Convert simple fp Neon 2-reg-misc insns, (continued)
- [PULL 17/42] target/arm: Convert simple fp Neon 2-reg-misc insns, Peter Maydell, 2020/06/23
- [PULL 18/42] target/arm: Convert Neon 2-reg-misc fp-compare-with-zero insns to decodetree, Peter Maydell, 2020/06/23
- [PULL 19/42] target/arm: Convert Neon 2-reg-misc VRINT insns to decodetree, Peter Maydell, 2020/06/23
- [PULL 20/42] target/arm: Convert Neon 2-reg-misc VCVT insns to decodetree, Peter Maydell, 2020/06/23
- [PULL 21/42] target/arm: Convert Neon VSWP to decodetree, Peter Maydell, 2020/06/23
- [PULL 23/42] target/arm: Move some functions used only in translate-neon.inc.c to that file, Peter Maydell, 2020/06/23
- [PULL 24/42] target/arm: Remove unnecessary gen_io_end() calls, Peter Maydell, 2020/06/23
- [PULL 22/42] target/arm: Convert Neon VTRN to decodetree, Peter Maydell, 2020/06/23
- [PULL 25/42] target/arm: Remove dead code relating to SABA and UABA, Peter Maydell, 2020/06/23
- [PULL 26/42] hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status, Peter Maydell, 2020/06/23
- [PULL 28/42] hw/i2c/versatile_i2c: Add SCL/SDA definitions,
Peter Maydell <=
- [PULL 27/42] hw/i2c/versatile_i2c: Add definitions for register addresses, Peter Maydell, 2020/06/23
- [PULL 30/42] hw/arm: Use TYPE_VERSATILE_I2C instead of hardcoded string, Peter Maydell, 2020/06/23
- [PULL 29/42] hw/i2c: Add header for ARM SBCon two-wire serial bus interface, Peter Maydell, 2020/06/23
- [PULL 31/42] hw/arm/mps2: Document CMSDK/FPGA APB subsystem sections, Peter Maydell, 2020/06/23
- [PULL 34/42] hw/arm/mps2: Add CMSDK AHB GPIO peripherals as unimplemented devices, Peter Maydell, 2020/06/23
- [PULL 36/42] hw/arm/mps2: Add SPI devices, Peter Maydell, 2020/06/23
- [PULL 37/42] hw/arm/mps2: Add I2C devices, Peter Maydell, 2020/06/23
- [PULL 32/42] hw/arm/mps2: Rename CMSDK AHB peripheral region, Peter Maydell, 2020/06/23
- [PULL 38/42] hw/arm/mps2: Add audio I2S interface as unimplemented device, Peter Maydell, 2020/06/23
- [PULL 39/42] hw/arm/mps2-tz: Use the ARM SBCon two-wire serial bus interface, Peter Maydell, 2020/06/23