From 3df68104cb6cc086b2aeae995f3432ec0bea3a02 Mon Sep 17 00:00:00 2001 From: P L Sai Krishna Date: Thu, 26 Feb 2015 17:34:47 +0530 Subject: [PATCH] usbps: Removed IAR compilation errors. This patch modifies the IAR compilation errors in usbps examples. Signed-off-by: P L Sai Krishna --- .../drivers/usbps/examples/xusbps_ch9.c | 18 +++++++ .../usbps/examples/xusbps_ch9_storage.c | 48 +++++++++++++++++++ .../usbps/examples/xusbps_class_storage.c | 26 ++++++++++ .../usbps/examples/xusbps_class_storage.h | 48 +++++++++++++++++++ .../usbps/examples/xusbps_intr_example.c | 6 +++ 5 files changed, 146 insertions(+) diff --git a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9.c b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9.c index 5e5c4d11..4f256f33 100755 --- a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9.c +++ b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9.c @@ -86,7 +86,13 @@ static int XUsbPs_HandleVendorReq(XUsbPs *InstancePtr, /************************** Variable Definitions *****************************/ +#ifdef __ICCARM__ +#pragma data_alignment = 32 +static u8 Response; +#pragma data_alignment = 4 +#else static u8 Response ALIGNMENT_CACHELINE; +#endif /*****************************************************************************/ /** @@ -163,7 +169,13 @@ static void XUsbPs_StdDevReq(XUsbPs *InstancePtr, XUsbPs_Local *UsbLocalPtr; int ReplyLen; +#ifdef __ICCARM__ +#pragma data_alignment = 32 +static u8 Reply[XUSBPS_REQ_REPLY_LEN]; +#pragma data_alignment = 4 +#else static u8 Reply[XUSBPS_REQ_REPLY_LEN] ALIGNMENT_CACHELINE; +#endif /* Check that the requested reply length is not bigger than our reply * buffer. This should never happen... @@ -571,8 +583,14 @@ static int XUsbPs_HandleVendorReq(XUsbPs *InstancePtr, u32 BufferLen; u32 Handle; u32 Reg; +#ifdef __ICCARM__ +#pragma data_alignment = 32 +const static u8 Reply[8] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17}; +#pragma data_alignment = 4 +#else const static u8 Reply[8] ALIGNMENT_CACHELINE = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17}; +#endif u8 EpNum = 0; int Status; int Direction; diff --git a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9_storage.c b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9_storage.c index 71ccc76e..1bf2e946 100755 --- a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9_storage.c +++ b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9_storage.c @@ -61,6 +61,9 @@ /**************************** Type Definitions *******************************/ +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 bLength; u8 bDescriptorType; @@ -76,8 +79,16 @@ typedef struct { u8 iProduct; u8 iSerialNumber; u8 bNumConfigurations; +#ifdef __ICCARM__ +}USB_STD_DEV_DESC; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_STD_DEV_DESC; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 bLength; u8 bDescriptorType; @@ -87,8 +98,16 @@ typedef struct { u8 iConfiguration; u8 bmAttributes; u8 bMaxPower; +#ifdef __ICCARM__ +}USB_STD_CFG_DESC; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_STD_CFG_DESC; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 bLength; u8 bDescriptorType; @@ -99,8 +118,16 @@ typedef struct { u8 bInterfaceSubClass; u8 bInterfaceProtocol; u8 iInterface; +#ifdef __ICCARM__ +}USB_STD_IF_DESC; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_STD_IF_DESC; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 bLength; u8 bDescriptorType; @@ -108,20 +135,41 @@ typedef struct { u8 bmAttributes; u16 wMaxPacketSize; u8 bInterval; +#ifdef __ICCARM__ +}USB_STD_EP_DESC; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_STD_EP_DESC; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 bLength; u8 bDescriptorType; u16 wLANGID[1]; +#ifdef __ICCARM__ +}USB_STD_STRING_DESC; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_STD_STRING_DESC; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { USB_STD_CFG_DESC stdCfg; USB_STD_IF_DESC ifCfg; USB_STD_EP_DESC epCfg1; USB_STD_EP_DESC epCfg2; +#ifdef __ICCARM__ +}USB_CONFIG; +#pragma pack(pop) +#else }__attribute__((__packed__))USB_CONFIG; +#endif /************************** Function Prototypes ******************************/ diff --git a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.c b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.c index cdb69e41..9b175fe0 100755 --- a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.c +++ b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.c @@ -72,6 +72,31 @@ /* Pre-manufactured response to the SCSI Inquirey command. */ +#ifdef __ICCARM__ +#pragma data_alignment = 32 +const static SCSI_INQUIRY scsiInquiry = { + 0x00, + 0x80, + 0x00, + 0x01, + 0x1f, + 0x00, + 0x00, + 0x00, + {"Xilinx "}, /* Vendor ID: must be 8 characters long. */ + {"PS USB VirtDisk"}, /* Product ID: must be 16 characters long. */ + {"1.00"} /* Revision: must be 4 characters long. */ +}; +static u8 MaxLUN = 0; +/* Buffer for virtual flash disk space. */ +static u8 VirtFlash[VFLASH_SIZE]; + +static USB_CBW lastCBW; + +/* Local transmit buffer for simple replies. */ +static u8 txBuffer[128]; +#pragma data_alignment = 4 +#else const static SCSI_INQUIRY scsiInquiry ALIGNMENT_CACHELINE = { 0x00, 0x80, @@ -93,6 +118,7 @@ static USB_CBW lastCBW ALIGNMENT_CACHELINE; /* Local transmit buffer for simple replies. */ static u8 txBuffer[128] ALIGNMENT_CACHELINE; +#endif /*****************************************************************************/ /** diff --git a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.h b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.h index ddf38bc6..af3474ed 100755 --- a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.h +++ b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_class_storage.h @@ -103,6 +103,9 @@ extern "C" { * the contents of those structures are not important in the context of this * example. */ +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u32 dCBWSignature; u32 dCBWTag; @@ -111,8 +114,16 @@ typedef struct { u8 cCBWLUN; u8 bCBWCBLength; u8 CBWCB[16]; +#ifdef __ICCARM__ +} USB_CBW; +#pragma pack(pop) +#else } __attribute__((__packed__))USB_CBW; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 deviceType; u8 rmb; @@ -125,8 +136,16 @@ typedef struct { u8 vendorID[8]; u8 productID[16]; u8 revision[4]; +#ifdef __ICCARM__ +} SCSI_INQUIRY; +#pragma pack(pop) +#else } __attribute__((__packed__))SCSI_INQUIRY; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 reserved[3]; u8 listLength; @@ -134,13 +153,29 @@ typedef struct { u8 descCode; u8 blockLengthMSB; u16 blockLength; +#ifdef __ICCARM__ +} SCSI_CAP_LIST; +#pragma pack(pop) +#else } __attribute__((__packed__))SCSI_CAP_LIST; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u32 numBlocks; u32 blockSize; +#ifdef __ICCARM__ +} SCSI_READ_CAPACITY; +#pragma pack(pop) +#else } __attribute__((__packed__))SCSI_READ_CAPACITY; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 opCode; u8 reserved1; @@ -148,8 +183,16 @@ typedef struct { u8 reserved2; u16 length; u8 control; +#ifdef __ICCARM__ +} SCSI_READ_WRITE; +#pragma pack(pop) +#else } __attribute__((__packed__))SCSI_READ_WRITE; +#endif +#ifdef __ICCARM__ +#pragma pack(push, 1) +#endif typedef struct { u8 opCode; u8 immed; @@ -157,7 +200,12 @@ typedef struct { u8 reserved2; u8 start; u8 control; +#ifdef __ICCARM__ +} SCSI_START_STOP; +#pragma pack(pop) +#else } __attribute__((__packed__))SCSI_START_STOP; +#endif /***************** Macros (Inline Functions) Definitions *********************/ diff --git a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_intr_example.c b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_intr_example.c index e3ade510..eae9265d 100755 --- a/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_intr_example.c +++ b/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_intr_example.c @@ -69,7 +69,13 @@ /************************** Constant Definitions *****************************/ #define MEMORY_SIZE (64 * 1024) +#ifdef __ICCARM__ +#pragma data_alignment = 32 +u8 Buffer[MEMORY_SIZE]; +#pragma data_alignment = 4 +#else u8 Buffer[MEMORY_SIZE] ALIGNMENT_CACHELINE; +#endif /**************************** Type Definitions *******************************/