9
0
Fork 0

Fix compilation bugs when DUALSPEED is enabled

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2564 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2010-03-28 21:41:49 +00:00
parent 4eed645b07
commit f763af79a9
3 changed files with 20 additions and 19 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbdev/usbdev_serial.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* This logic emulates the Prolific PL2303 serial/USB converter
@ -318,9 +318,9 @@ static void usbclass_freereq(FAR struct usbdev_ep_s *ep,
static int usbclass_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc);
#ifdef CONFIG_USBDEV_DUALSPEED
static void usbclass_mkepbulkdesc(const struct up_epdesc *indesc,
uint16_t mxpacket, struct usb_epdesc_s *outdesc)
static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed);
static void usbclass_mkepbulkdesc(const struct usb_epdesc *indesc,
uint16_t mxpacket, struct usb_epdesc_s *outdesc);
static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type);
#else
static int16_t usbclass_mkcfgdesc(uint8_t *buf);
#endif
@ -864,7 +864,7 @@ static int usbclass_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc)
****************************************************************************/
#ifdef CONFIG_USBDEV_DUALSPEED
static inline void usbclass_mkepbulkdesc(const FAR struct up_epdesc *indesc,
static inline void usbclass_mkepbulkdesc(const FAR struct usb_epdesc *indesc,
uint16_t mxpacket,
FAR struct usb_epdesc_s *outdesc)
{
@ -888,14 +888,14 @@ static inline void usbclass_mkepbulkdesc(const FAR struct up_epdesc *indesc,
****************************************************************************/
#ifdef CONFIG_USBDEV_DUALSPEED
static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed)
static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type)
#else
static int16_t usbclass_mkcfgdesc(uint8_t *buf)
#endif
{
FAR struct usb_cfgdesc_s *cfgdesc = (struct usb_cfgdesc_s*)buf;
#ifdef CONFIG_USBDEV_DUALSPEED
bool highspeed = (speed == USB_SPEED_HIGH);
bool hispeed = (speed == USB_SPEED_HIGH);
uint16_t bulkmxpacket;
#endif
uint16_t totallen;
@ -1054,7 +1054,7 @@ static int usbclass_setconfig(FAR struct usbser_dev_s *priv, uint8_t config)
/* Configure the IN bulk endpoint */
#ifdef CONFIG_USBDEV_DUALSPEED
if (dev->speed == USB_SPEED_HIGH)
if ((priv->usbdev->speed == USB_SPEED_HIGH)
{
bulkmxpacket = 512;
}
@ -1610,7 +1610,7 @@ static int usbclass_setup(FAR struct usbdev_s *dev, const struct usb_ctrlreq_s *
case USB_DESC_TYPE_CONFIG:
{
#ifdef CONFIG_USBDEV_DUALSPEED
ret = usbclass_mkcfgdesc(ctrlreq->buf, dev->speed);
ret = usbclass_mkcfgdesc(ctrlreq->buf, dev->speed, ctrl->req);
#else
ret = usbclass_mkcfgdesc(ctrlreq->buf);
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbdev/usbdev_storage.c
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Mass storage class device. Bulk-only with SCSI subclass.
@ -119,7 +119,7 @@ static void usbstrg_freereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *req);
static int usbstrg_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc);
#ifdef CONFIG_USBDEV_DUALSPEED
static int16_t usbstrg_mkcfgdesc(uint8_t *buf, uint8_t speed);
static int16_t usbstrg_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type);
#else
static int16_t usbstrg_mkcfgdesc(uint8_t *buf);
#endif
@ -423,14 +423,14 @@ static int usbstrg_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc)
****************************************************************************/
#ifdef CONFIG_USBDEV_DUALSPEED
static int16_t usbstrg_mkcfgdesc(uint8_t *buf, uint8_t speed)
static int16_t usbstrg_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type)
#else
static int16_t usbstrg_mkcfgdesc(uint8_t *buf)
#endif
{
FAR struct usb_cfgdesc_s *cfgdesc = (struct usb_cfgdesc_s*)buf;
#ifdef CONFIG_USBDEV_DUALSPEED
FAR struct usb_epdesc_s *epdesc;
FAR const struct usb_epdesc_s *epdesc;
bool hispeed = (speed == USB_SPEED_HIGH);
uint16_t bulkmxpacket;
#endif
@ -807,7 +807,7 @@ static int usbstrg_setup(FAR struct usbdev_s *dev,
case USB_DESC_TYPE_CONFIG:
{
#ifdef CONFIG_USBDEV_DUALSPEED
ret = usbstrg_mkcfgdesc(ctrlreq->buf, dev->speed, len);
ret = usbstrg_mkcfgdesc(ctrlreq->buf, dev->speed, ctrl->value[1]);
#else
ret = usbstrg_mkcfgdesc(ctrlreq->buf);
#endif
@ -1089,7 +1089,8 @@ int usbstrg_setconfig(FAR struct usbstrg_dev_s *priv, uint8_t config)
FAR struct usbstrg_req_s *privreq;
FAR struct usbdev_req_s *req;
#ifdef CONFIG_USBDEV_DUALSPEED
struct usb_epdesc_s *epdesc;
FAR const struct usb_epdesc_s *epdesc;
bool hispeed = (priv->usbdev->speed == USB_SPEED_HIGH);
uint16_t bulkmxpacket;
#endif
int i;
@ -1151,7 +1152,7 @@ int usbstrg_setconfig(FAR struct usbstrg_dev_s *priv, uint8_t config)
/* Configure the OUT bulk endpoint */
#ifdef CONFIG_USBDEV_DUALSPEED
epdesc = USBSTRG_EPBULKINDESC(hispeed);
epdesc = USBSTRG_EPBULKOUTDESC(hispeed);
ret = EP_CONFIGURE(priv->epbulkout, epdesc, true);
#else
ret = EP_CONFIGURE(priv->epbulkout, &g_fsepbulkoutdesc, true);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbdev/usbdev_storage.h
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Mass storage class device. Bulk-only with SCSI subclass.
@ -304,8 +304,8 @@
/* Macros for dual speed vs. full speed only operation */
#ifdef CONFIG_USBDEV_DUALSPEED
# define USBSTRG_EPBULKINDESC(hs) ((hs) ? (g_hsepbulkindesc) : (g_fsepbulkindesc))
# define USBSTRG_EPBULKOUTDESC(hs) ((hs) ? (g_hsepbulkoutdesc) : (g_fsepbulkoutdesc))
# define USBSTRG_EPBULKINDESC(hs) ((hs) ? (&g_hsepbulkindesc) : (&g_fsepbulkindesc))
# define USBSTRG_EPBULKOUTDESC(hs) ((hs) ? (&g_hsepbulkoutdesc) : (&g_fsepbulkoutdesc))
# define USBSTRG_BULKMAXPACKET(hs) \
((hs) ? USBSTRG_HSBULKMAXPACKET : USBSTRG_FSBULKMAXPACKET)
# define USBSTRG_BULKMXPKTSHIFT(d) \