Can't use 'class' as a field name! Backward conditional compilation in usbmsc.c

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4350 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-01-31 14:15:36 +00:00
parent 019b83fc54
commit 5d7909fa42
7 changed files with 24 additions and 22 deletions

View File

@ -2412,4 +2412,7 @@
OS to use the socket interface without having a socket descriptor. OS to use the socket interface without having a socket descriptor.
* include/net/psock.h: Removed psock.h. The new interfaces are moved into * include/net/psock.h: Removed psock.h. The new interfaces are moved into
nuttx/net.h which already has similar logic. nuttx/net.h which already has similar logic.
* include/nuttx/usb/usb.h: Can't use 'class' as a field name in USB structures.
This upsets C++ if usb.h is included. 'class' -> 'classid' in this header
file and all places that referenced 'class'
* drivers/usbdev/usbmsc.c: Fixed some backward conditional compilation.

View File

@ -317,7 +317,7 @@ static int max1704x_putreg16(FAR struct max1704x_dev_s *priv, uint8_t regaddr,
static inline int max1704x_getvcell(FAR struct max1704x_dev_s *priv, static inline int max1704x_getvcell(FAR struct max1704x_dev_s *priv,
b16_t *vcell) b16_t *vcell)
{ {
uint16_t regval; uint16_t regval = 0;
int ret; int ret;
ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, &regval); ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, &regval);
@ -339,7 +339,7 @@ static inline int max1704x_getvcell(FAR struct max1704x_dev_s *priv,
static inline int max1704x_getsoc(FAR struct max1704x_dev_s *priv, static inline int max1704x_getsoc(FAR struct max1704x_dev_s *priv,
b16_t *soc) b16_t *soc)
{ {
uint16_t regval; uint16_t regval = 0;
int ret; int ret;
ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, &regval); ret = max1704x_getreg16(priv, MAX1407X_VCELL_ADDR, &regval);

View File

@ -85,11 +85,11 @@ static const struct usb_devdesc_s g_devdesc =
MSBYTE(0x0200) MSBYTE(0x0200)
}, },
#ifdef CONFIG_COMPOSITE_IAD #ifdef CONFIG_COMPOSITE_IAD
USB_CLASS_MISC, /* class */ USB_CLASS_MISC, /* classid */
2, /* subclass */ 2, /* subclass */
1, /* protocol */ 1, /* protocol */
#else #else
USB_CLASS_PER_INTERFACE, /* class */ USB_CLASS_PER_INTERFACE, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
#endif #endif
@ -138,7 +138,7 @@ static const struct usb_qualdesc_s g_qualdesc =
LSBYTE(0x0200), LSBYTE(0x0200),
MSBYTE(0x0200) MSBYTE(0x0200)
}, },
USB_CLASS_VENDOR_SPEC, /* class */ USB_CLASS_VENDOR_SPEC, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
CONFIG_COMPOSITE_EP0MAXPACKET, /* mxpacketsize */ CONFIG_COMPOSITE_EP0MAXPACKET, /* mxpacketsize */

View File

@ -394,7 +394,7 @@ static const struct usb_devdesc_s g_devdesc =
USB_SIZEOF_DEVDESC, /* len */ USB_SIZEOF_DEVDESC, /* len */
USB_DESC_TYPE_DEVICE, /* type */ USB_DESC_TYPE_DEVICE, /* type */
{LSBYTE(0x0200), MSBYTE(0x0200)}, /* usb */ {LSBYTE(0x0200), MSBYTE(0x0200)}, /* usb */
USB_CLASS_PER_INTERFACE, /* class */ USB_CLASS_PER_INTERFACE, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
CONFIG_PL2303_EP0MAXPACKET, /* maxpacketsize */ CONFIG_PL2303_EP0MAXPACKET, /* maxpacketsize */
@ -429,7 +429,7 @@ static const struct usb_ifdesc_s g_ifdesc =
0, /* ifno */ 0, /* ifno */
0, /* alt */ 0, /* alt */
PL2303_NENDPOINTS, /* neps */ PL2303_NENDPOINTS, /* neps */
USB_CLASS_VENDOR_SPEC, /* class */ USB_CLASS_VENDOR_SPEC, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
PL2303_CONFIGSTRID /* iif */ PL2303_CONFIGSTRID /* iif */
@ -472,7 +472,7 @@ static const struct usb_qualdesc_s g_qualdesc =
USB_SIZEOF_QUALDESC, /* len */ USB_SIZEOF_QUALDESC, /* len */
USB_DESC_TYPE_DEVICEQUALIFIER, /* type */ USB_DESC_TYPE_DEVICEQUALIFIER, /* type */
{LSBYTE(0x0200), MSBYTE(0x0200) }, /* USB */ {LSBYTE(0x0200), MSBYTE(0x0200) }, /* USB */
USB_CLASS_VENDOR_SPEC, /* class */ USB_CLASS_VENDOR_SPEC, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
CONFIG_PL2303_EP0MAXPACKET, /* mxpacketsize */ CONFIG_PL2303_EP0MAXPACKET, /* mxpacketsize */

View File

@ -139,7 +139,7 @@ static void usbmsc_disconnect(FAR struct usbdevclass_driver_s *driver,
/* Initialization/Uninitialization ******************************************/ /* Initialization/Uninitialization ******************************************/
static void usbmsc_lununinitialize(struct usbmsc_lun_s *lun); static void usbmsc_lununinitialize(struct usbmsc_lun_s *lun);
#ifndef CONFIG_USBMSC_COMPOSITE #ifdef CONFIG_USBMSC_COMPOSITE
static int usbmsc_exportluns(FAR void *handle); static int usbmsc_exportluns(FAR void *handle);
#endif #endif
@ -1578,7 +1578,7 @@ int usbmsc_unbindlun(FAR void *handle, unsigned int lunno)
* *
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_USBMSC_COMPOSITE #ifdef CONFIG_USBMSC_COMPOSITE
static static
#endif #endif
int usbmsc_exportluns(FAR void *handle) int usbmsc_exportluns(FAR void *handle)
@ -1708,7 +1708,6 @@ void usbmsc_uninitialize(FAR void *handle)
pthread_attr_t attr; pthread_attr_t attr;
#endif #endif
void *value; void *value;
int ret;
int i; int i;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
@ -1743,7 +1742,7 @@ void usbmsc_uninitialize(FAR void *handle)
* garbage * garbage
*/ */
ret = pthread_join(priv->thread, &value); (void)pthread_join(priv->thread, &value);
} }
priv->thread = 0; priv->thread = 0;

View File

@ -77,7 +77,7 @@ static const struct usb_devdesc_s g_devdesc =
USB_SIZEOF_DEVDESC, /* len */ USB_SIZEOF_DEVDESC, /* len */
USB_DESC_TYPE_DEVICE, /* type */ USB_DESC_TYPE_DEVICE, /* type */
{LSBYTE(0x0200), MSBYTE(0x0200)}, /* usb */ {LSBYTE(0x0200), MSBYTE(0x0200)}, /* usb */
USB_CLASS_PER_INTERFACE, /* class */ USB_CLASS_PER_INTERFACE, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
CONFIG_USBMSC_EP0MAXPACKET, /* maxpacketsize */ CONFIG_USBMSC_EP0MAXPACKET, /* maxpacketsize */
@ -130,7 +130,7 @@ static const struct usb_ifdesc_s g_ifdesc =
USBMSC_INTERFACEID, /* ifno */ USBMSC_INTERFACEID, /* ifno */
USBMSC_ALTINTERFACEID, /* alt */ USBMSC_ALTINTERFACEID, /* alt */
USBMSC_NENDPOINTS, /* neps */ USBMSC_NENDPOINTS, /* neps */
USB_CLASS_MASS_STORAGE, /* class */ USB_CLASS_MASS_STORAGE, /* classid */
USBMSC_SUBCLASS_SCSI, /* subclass */ USBMSC_SUBCLASS_SCSI, /* subclass */
USBMSC_PROTO_BULKONLY, /* protocol */ USBMSC_PROTO_BULKONLY, /* protocol */
USBMSC_INTERFACESTRID /* iif */ USBMSC_INTERFACESTRID /* iif */
@ -174,7 +174,7 @@ static const struct usb_qualdesc_s g_qualdesc =
LSBYTE(0x0200), LSBYTE(0x0200),
MSBYTE(0x0200) MSBYTE(0x0200)
}, },
USB_CLASS_PER_INTERFACE, /* class */ USB_CLASS_PER_INTERFACE, /* classid */
0, /* subclass */ 0, /* subclass */
0, /* protocol */ 0, /* protocol */
CONFIG_USBMSC_EP0MAXPACKET, /* mxpacketsize */ CONFIG_USBMSC_EP0MAXPACKET, /* mxpacketsize */

View File

@ -1,8 +1,8 @@
/************************************************************************************ /************************************************************************************
* include/nuttx/usb/usb.h * include/nuttx/usb/usb.h
* *
* Copyright (C) 2008, 2009-2010 Gregory Nutt. All rights reserved. * Copyright (C) 2008, 2009-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -274,7 +274,7 @@ struct usb_devdesc_s
uint8_t len; /* Descriptor length */ uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */ uint8_t type; /* Descriptor type */
uint8_t usb[2]; /* USB version */ uint8_t usb[2]; /* USB version */
uint8_t class; /* Device class */ uint8_t classid; /* Device class */
uint8_t subclass; /* Device sub-class */ uint8_t subclass; /* Device sub-class */
uint8_t protocol; /* Device protocol */ uint8_t protocol; /* Device protocol */
uint8_t mxpacketsize; /* Max packet size (ep0) */ uint8_t mxpacketsize; /* Max packet size (ep0) */
@ -334,7 +334,7 @@ struct usb_ifdesc_s
uint8_t ifno; /* Interface number */ uint8_t ifno; /* Interface number */
uint8_t alt; /* Alternate setting */ uint8_t alt; /* Alternate setting */
uint8_t neps; /* Number of endpoints */ uint8_t neps; /* Number of endpoints */
uint8_t class; /* Interface class */ uint8_t classid; /* Interface class */
uint8_t subclass; /* Interface sub-class */ uint8_t subclass; /* Interface sub-class */
uint8_t protocol; /* Interface protocol */ uint8_t protocol; /* Interface protocol */
uint8_t iif; /* iInterface */ uint8_t iif; /* iInterface */
@ -369,7 +369,7 @@ struct usb_qualdesc_s
uint8_t len; /* Descriptor length */ uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */ uint8_t type; /* Descriptor type */
uint8_t usb[2]; /* USB version */ uint8_t usb[2]; /* USB version */
uint8_t class; /* Qualifier class */ uint8_t classid; /* Qualifier class */
uint8_t subclass; /* Qualifier sub-class */ uint8_t subclass; /* Qualifier sub-class */
uint8_t protocol; /* Qualifier protocol */ uint8_t protocol; /* Qualifier protocol */
uint8_t mxpacketsize; /* Max packet size (ep0) */ uint8_t mxpacketsize; /* Max packet size (ep0) */
@ -394,7 +394,7 @@ struct usb_iaddesc_s
uint8_t type; /* Descriptor type */ uint8_t type; /* Descriptor type */
uint8_t firstif; /* Number of first interface of the function */ uint8_t firstif; /* Number of first interface of the function */
uint8_t nifs; /* Number of interfaces associated with the function */ uint8_t nifs; /* Number of interfaces associated with the function */
uint8_t class; /* Class code*/ uint8_t classid; /* Class code */
uint8_t subclass; /* Sub-class code */ uint8_t subclass; /* Sub-class code */
uint8_t protocol; /* Protocol code */ uint8_t protocol; /* Protocol code */
uint8_t ifunction; /* Index to string identifying the function */ uint8_t ifunction; /* Index to string identifying the function */