Hi.
I want to do my bit fields in my code, like bit field TI.
I do so:
in my Global_Var.c file i write code.
struct StatusSeviceTransmition{
Uint16 Enable_Transmition :1;
Uint16 ch1_transmit :1;
Uint16 ch2_transmit :1;
Uint16 ch3_transmit :1;
Uint16 ch4_transmit :1;
Uint16 rsv11 :11;
};
union TransmitionService_REG{
Uint16 all;
struct StatusSeviceTransmition bit;
};
struct Service_REG{
union TransmitionService_REG TransmitionService_REG;
};
struct Service_REG SERVICE_REG;
And so, on in my Global_Var.h file I write next:
struct StatusSeviceTransmition{
Uint16 Enable_Transmition :1;
Uint16 ch1_transmit :1;
Uint16 ch2_transmit :1;
Uint16 ch3_transmit :1;
Uint16 ch4_transmit :1;
Uint16 rsv11 :11;
};
union TransmitionService_REG{
Uint16 all;
struct StatusSeviceTransmition bit;
};
struct Service_REG{
union TransmitionService_REG TransmitionService_REG;
};
extern struct Service_REG SERVICE_REG;
In main.c file I write:
SERVICE_REG.TransmitionService_REG.bit.Enable_Transmition = 1;
Code Composer make build and sort of OK. But I'm not sure that my bit field right declared. At first, in my Global_Var.h file, I write extern between struct, like this:
extern struct StatusSeviceTransmition{
Uint16 Enable_Transmition :1;
Uint16 ch1_transmit :1;
Uint16 ch2_transmit :1;
Uint16 ch3_transmit :1;
Uint16 ch4_transmit :1;
Uint16 rsv11 :11;
};
and builder make this warning: warning #1054-D: a storage class may not be specified here.
Tell me, is I'm correct declared my structure? If not, so how it make right?