From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNhLP-0003qy-LV for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:05:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNhLL-0008RU-Lq for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:05:55 -0400 Received: from mail-vk0-f53.google.com ([209.85.213.53]:36359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNhLL-0008Qb-Hi for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:05:51 -0400 Received: by vkci6 with SMTP id i6so38327715vkc.3 for ; Fri, 07 Aug 2015 06:05:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Fri, 7 Aug 2015 14:05:31 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 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: Jean-Christophe Dubois Cc: QEMU Developers 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. > +#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 = time(NULL); > + struct tm *tm_ptr = gmtime(&now); > + > + /* reset the index in the RTC memory */ > + cmd[0] = 0; > + i2c_send(i2c, addr, cmd, 1); > + > + /* retrieve the date */ > + i2c_recv(i2c, addr, resp, 7); > + > + /* check retreived time againt local time */ "retrieved" -- PMM