From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjKs-0001xT-75 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:01:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUjKj-0002yD-Mq for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:01:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49188 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjKj-0002xz-Fw for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:01:29 -0400 Message-ID: <5339D7A7.9000901@suse.de> Date: Mon, 31 Mar 2014 23:01:27 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1396283195-6819-1-git-send-email-pbonzini@redhat.com> <1396283195-6819-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1396283195-6819-7-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-2.0 6/7] tmp105-test: add a second sensor and test that one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Am 31.03.2014 18:26, schrieb Paolo Bonzini: > This will make it easier to reach the device under test via QOM. >=20 > Signed-off-by: Paolo Bonzini > --- > tests/tmp105-test.c | 17 +++++++++-------- > 5 files changed, 13 insertions(+), 12 deletions(-) >=20 > diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c > index 20a1894..4e640b4 100644 > --- a/tests/tmp105-test.c > +++ b/tests/tmp105-test.c > @@ -15,10 +15,10 @@ > =20 > #define OMAP2_I2C_1_BASE 0x48070000 > =20 > -#define N8X0_ADDR 0x48 > +#define TMP105_TEST_ID "tmp105-test" > +#define TMP105_TEST_ADDR 0x49 > =20 > static I2CAdapter *i2c; > -static uint8_t addr; > =20 > static uint16_t tmp105_get16(I2CAdapter *i2c, uint8_t addr, uint8_t re= g) > { > @@ -61,14 +61,14 @@ static void send_and_receive(void) > { > uint16_t value; > =20 > - value =3D tmp105_get16(i2c, addr, TMP105_REG_TEMPERATURE); > + value =3D tmp105_get16(i2c, TMP105_TEST_ADDR, TMP105_REG_TEMPERATU= RE); > g_assert_cmpuint(value, =3D=3D, 0); > =20 > /* reset */ > - tmp105_set8(i2c, addr, TMP105_REG_CONFIG, 0); > + tmp105_set8(i2c, TMP105_TEST_ADDR, TMP105_REG_CONFIG, 0); > =20 > - tmp105_set16(i2c, addr, TMP105_REG_T_LOW, 0x1234); > - tmp105_set16(i2c, addr, TMP105_REG_T_HIGH, 0x4231); > + tmp105_set16(i2c, TMP105_TEST_ADDR, TMP105_REG_T_LOW, 0x1234); > + tmp105_set16(i2c, TMP105_TEST_ADDR, TMP105_REG_T_HIGH, 0x4231); > } > =20 > int main(int argc, char **argv) > @@ -78,9 +78,10 @@ int main(int argc, char **argv) > =20 > g_test_init(&argc, &argv, NULL); > =20 > - s =3D qtest_start("-machine n800"); > + s =3D qtest_start("-machine n800 " > + "-device tmp105,bus=3Di2c-bus.0,id=3D" TMP105_TEST= _ID > + ",address=3D0x49"); Probably we could do some clever stringify() tricks here to reuse your TMP105_TEST_ADDR constant, but I'll leave it as is for now. Andreas > i2c =3D omap_i2c_create(OMAP2_I2C_1_BASE); > - addr =3D N8X0_ADDR; > =20 > qtest_add_func("/tmp105/tx-rx", send_and_receive); > =20 >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg