[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/13] libqos: move common i2c code to libqos
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 03/13] libqos: move common i2c code to libqos |
Date: |
Wed, 10 Apr 2019 14:19:25 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 09/04/19 11:42, Thomas Huth wrote:
>> -static void tmp105_set16(I2CAdapter *i2c, uint8_t addr, uint8_t reg,
>> - uint16_t value)
>> -{
>> - uint8_t cmd[3];
>> - uint8_t resp[2];
>> -
>> - cmd[0] = reg;
>> - cmd[1] = value >> 8;
>> - cmd[2] = value & 255;
>> - i2c_send(i2c, addr, cmd, 3);
>> - i2c_recv(i2c, addr, resp, 2);
>> - g_assert_cmphex(resp[0], ==, cmd[1]);
>> - g_assert_cmphex(resp[1], ==, cmd[2]);
>> -}
> ... but the old set8/16 functions also used i2c_recv() and
> g_assert_cmphex() ... shouldn't this be added to the new functions, too?
That is dependent on the actual device you are working with. I probably
should add some code to the tmp105 test that tests this behavior too.
Paolo