On Thu, 5 Mar 2020 at 19:24, Alistair Francis <alistai...@gmail.com> wrote: > > On Sat, Feb 29, 2020 at 6:12 AM Stephanos Ioannidis <r...@stephanos.io> 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