qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH for-1.4] libi2c-omap: Fix endianness dependency
Date: Sat, 2 Feb 2013 16:49:28 +0000

On 2 February 2013 16:45, Andreas Färber <address@hidden> wrote:
> From: Andreas Färber <address@hidden>
>
> The libqos driver for omap_i2c currently does not work on Big Endian.
> Introduce helpers for reading from and writing to 16-bit armel registers.
>
> This fixes tmp105-test failures on ppc.
>
> Signed-off-by: Andreas Färber <address@hidden>
> ---
>  tests/libi2c-omap.c |   51 
> ++++++++++++++++++++++++++++++++-------------------
>  1 Datei geändert, 32 Zeilen hinzugefügt(+), 19 Zeilen entfernt(-)
>
> diff --git a/tests/libi2c-omap.c b/tests/libi2c-omap.c
> index 9be57e9..7d50ef2 100644
> --- a/tests/libi2c-omap.c
> +++ b/tests/libi2c-omap.c
> @@ -12,6 +12,7 @@
>  #include <string.h>
>
>  #include "qemu/osdep.h"
> +#include "qemu/bswap.h"
>  #include "libqtest.h"
>
>  enum OMAPI2CRegisters {
> @@ -48,12 +49,24 @@ typedef struct OMAPI2C {
>  } OMAPI2C;
>
>
> +static inline void omap_i2c_read16(uint64_t addr, uint16_t *data)
> +{
> +    memread(addr, data, 2);
> +    *data = le16_to_cpu(*data);
> +}
> +
> +static inline void omap_i2c_write16(uint64_t addr, uint16_t data)
> +{
> +    data = cpu_to_le16(data);
> +    memwrite(addr, &data, 2);
> +}

There's nothing special about the OMAP i2c device that I know of:
shouldn't the test code just be using a generic "write 16 bit value
to memory with appropriate endianness for target CPU" function ?

-- PMM



reply via email to

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