Received: from eggs.gnu.org ([2001:4830:134:3::10]:58087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOpnC-0000Xf-0N for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:19:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZOpn5-0001Hw-5A for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:19:17 -0400 Received: from zose-mta03.web4all.fr ([185.49.20.44]:35050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZOpn5-0001Hh-0I for qemu-devel@nongnu.org; Mon, 10 Aug 2015 12:19:11 -0400 Message-ID: <55C8CEFD.2060301@tribudubois.net> Date: Mon, 10 Aug 2015 18:19:09 +0200 From: Jean-Christophe DUBOIS MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v13 18/19] i.MX: Add qtest support for I2C device emulator. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers Le 07/08/2015 15:05, Peter Maydell a =C3=A9crit : > On 16 July 2015 at 22:21, Jean-Christophe Dubois = wrote: >> This is using a ds1338 RTC chip on the I2C bus. This RTC chip is >> not present on the real 3DS PDK board. >> >> Signed-off-by: Jean-Christophe Dubois > 'make check' doesn't pass with this patch, because it tries to start > an "imx25_3ds" machine, which doesn't exist. Thanks, I will fix it. > >> +#define bcd2bin(x) (((x) & 0x0f) + ((x) >> 4) * 10) > Why not just make this an inline function? > >> +static void send_and_receive(void) >> +{ >> + uint8_t cmd[1]; >> + uint8_t resp[7]; >> + time_t now =3D time(NULL); >> + struct tm *tm_ptr =3D gmtime(&now); >> + >> + /* reset the index in the RTC memory */ >> + cmd[0] =3D 0; >> + i2c_send(i2c, addr, cmd, 1); >> + >> + /* retrieve the date */ >> + i2c_recv(i2c, addr, resp, 7); >> + >> + /* check retreived time againt local time */ > "retrieved" > > -- PMM >