qemu-arm
[Top][All Lists]
Advanced

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

Re: [PATCH] hw/arm/stm32f405: Add preliminary RCC emulation support


From: Peter Maydell
Subject: Re: [PATCH] hw/arm/stm32f405: Add preliminary RCC emulation support
Date: Thu, 5 Mar 2020 19:30:03 +0000

On Thu, 5 Mar 2020 at 19:24, Alistair Francis <address@hidden> wrote:
>
> On Sat, Feb 29, 2020 at 6:12 AM Stephanos Ioannidis <address@hidden> wrote:

> > +typedef union {
> > +    struct {
> > +        uint32_t hsion : 1;
> > +        uint32_t hsirdy : 1;
> > +        uint32_t reserved0 : 1;
> > +        uint32_t hsitrim : 5;
> > +        uint32_t hsical : 8;
> > +        uint32_t hseon : 1;
> > +        uint32_t hserdy : 1;
> > +        uint32_t hsebyp : 1;
> > +        uint32_t csson : 1;
> > +        uint32_t reserved1 : 4;
> > +        uint32_t pllon : 1;
> > +        uint32_t pllrdy : 1;
> > +        uint32_t plli2son : 1;
> > +        uint32_t plli2srdy : 1;
> > +        uint32_t reserved2 : 4;
> > +    };
> > +    uint32_t reg;
> > +} RccCrType;
>
> This is a pretty interesting way to represent the registers

Is it portable, though? I thought C bitfield order and
packing was implementation-defined, which would mean that
you can't guarantee that this union will give you the
required thing in the uint32_t half.

I think it would be better to do this the way that
other device models do it, and avoid bitfields.

thanks
-- PMM



reply via email to

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