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

Re: [bluetooth-dev] Issues with structres

You're right.  No magic here.  You can define the struct as follows:

typedef struct cmd_pkt
  u8 type;
  u16 ocf:10;
  u16 ogf:6;
  u8 len;

just like you said...make sure the bits line up correctly...

Ken Steck

Deepu Chandy Thomas wrote:
> Hello All,
>         I was breezing through the bluetooth stack source code and had a
> doubt
>  In hci.c line no: 246 cmd_pkt is defined as
> typedef struct cmd_pkt {
>           u32 type:8;
>         u32 ocf:10;
>         u32 ogf:6;
>         u32 len:8;
>         u8 data[256];
> } cmd_pkt;
> Same is repeated with event_struct (line 324)
> What is the logic in coding u32 type:8? Wouldn't a u8 suffice in this case
> or is there some greating meaning.
> The problem I face is I am porting it a word aligned compiler.
> Regards,
> Deepu Chandy Thomas