This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

initialization of packed unsigned int

I am trying to implement Mass storage device class using nxpusblib and got stuck in initialization of a packed structure. The structure is

typedef ATTR_IAR_PACKED struct { unsigned DeviceType : 5; unsigned PeripheralQualifier : 3;

unsigned Reserved : 7; unsigned Removable : 1;

uint8_t Version;

unsigned ResponseDataFormat : 4; unsigned Reserved2 : 1; unsigned NormACA : 1; unsigned TrmTsk : 1; unsigned AERC : 1;

uint8_t AdditionalLength; uint8_t Reserved3[2];

unsigned SoftReset : 1; unsigned CmdQue : 1; unsigned Reserved4 : 1; unsigned Linked : 1; unsigned Sync : 1; unsigned WideBus16Bit : 1; unsigned WideBus32Bit : 1; unsigned RelAddr : 1;

uint8_t VendorID[8]; uint8_t ProductID[16]; uint8_t RevisionID[4]; } ATTR_PACKED SCSI_Inquiry_Response_t;

initializing it as

static const SCSI_Inquiry_Response_t InquiryData = { DEVICE_TYPE_BLOCK, 0,

true,

0,

2, false, false, false,

0x1F,

false, false, false, false, false, false, false,

"NXP", "Dataflash Disk", {'0','.','0','0'}, };

The compiler gives error saying
..\src\app\SCSI.c(66): error: #144: a value of type "char *" cannot be used to initialize an entity of type "__packed unsigned int"
..\src\app\SCSI.c(67): error: #144: a value of type "char *" cannot be used to initialize an entity of type "__packed unsigned int"

these errors are from initalization of
uint8_t VendorID[8];
uint8_t ProductID[16];

I am using KeilUvision

0