qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v13 18/19] i.MX: Add qtest support for I2C devic


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v13 18/19] i.MX: Add qtest support for I2C device emulator.
Date: Fri, 7 Aug 2015 14:05:31 +0100

On 16 July 2015 at 22:21, Jean-Christophe Dubois <address@hidden> 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 <address@hidden>

'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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]