On 11/25/2011 04:21 PM, Benoît Canet wrote:
> Signed-off-by: Benoît Canet <benoit.ca...@gmail.com>
> ---
>  hw/omap_sx1.c |  113 
> ++++++++++++++++++++++++++++++---------------------------
>  1 files changed, 59 insertions(+), 54 deletions(-)
>
> diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c
> index fe53545..b056bc9 100644
> --- a/hw/omap_sx1.c
> +++ b/hw/omap_sx1.c
> @@ -59,46 +59,42 @@
>   * - 1 RTC
>   */
>  
> -static uint32_t static_readb(void *opaque, target_phys_addr_t offset)
> -{
> -    uint32_t *val = (uint32_t *) opaque;
> -
> -    return *val >> ((offset & 3) << 3);
> -}
> -
> -static uint32_t static_readh(void *opaque, target_phys_addr_t offset)
> -{
> -    uint32_t *val = (uint32_t *) opaque;
> -
> -    return *val >> ((offset & 1) << 3);
> -}
> -
> -static uint32_t static_readw(void *opaque, target_phys_addr_t offset)
> +static uint64_t static_read(void *opaque, target_phys_addr_t offset,
> +                            unsigned size)
>  {
>      uint32_t *val = (uint32_t *) opaque;
> +    uint32_t mask = 0;
> +
> +    switch (size) {
> +    case 1:
> +        mask = 3;
> +        break;
> +    case 2:
> +        mask = 1;
> +        break;
> +    case 4:
> +        mask = 0;
> +        break;
> +    default:
> +        mask = 0;
> +    }

  mask = (4 / size) - 1;

>  
> -    return *val >> ((offset & 0) << 3);
> +    return *val >> ((offset & mask) << 3);
>  }
>  
>  
>

Could also be done by just implementing the length 4 operation (which
just returns *val) and setting .impl.min_access_size =
.impl.max_access_size = 4, but unfortunately that is not implemented.


-- 
error compiling committee.c: too many arguments to function


Reply via email to