From 3a89153f238f23d741d61bcc51bf545b7b0dd4cb Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 27 Oct 2009 02:08:26 +0000 Subject: [PATCH] More USB macros; fix warnings git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2178 42af7a65-404d-4744-a932-0658087f49c3 --- drivers/usbdev/usbdev_serial.c | 8 ++++---- include/nuttx/usb.h | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/usbdev/usbdev_serial.c b/drivers/usbdev/usbdev_serial.c index 569b0e118b..4faee3f5d8 100644 --- a/drivers/usbdev/usbdev_serial.c +++ b/drivers/usbdev/usbdev_serial.c @@ -300,10 +300,10 @@ struct usbser_alloc_s /* Transfer helpers *********************************************************/ static uint16 usbclass_fillrequest(FAR struct usbser_dev_s *priv, - char *reqbuf, uint16 reqlen); + ubyte *reqbuf, uint16 reqlen); static int usbclass_sndpacket(FAR struct usbser_dev_s *priv); static inline int usbclass_recvpacket(FAR struct usbser_dev_s *priv, - char *reqbuf, uint16 reqlen); + ubyte *reqbuf, uint16 reqlen); /* Request helpers *********************************************************/ @@ -502,7 +502,7 @@ static const struct usb_qualdesc_s g_qualdesc = * ************************************************************************************/ -static uint16 usbclass_fillrequest(FAR struct usbser_dev_s *priv, char *reqbuf, uint16 reqlen) +static uint16 usbclass_fillrequest(FAR struct usbser_dev_s *priv, ubyte *reqbuf, uint16 reqlen) { FAR uart_dev_t *serdev = &priv->serdev; FAR struct uart_buffer_s *xmit = &serdev->xmit; @@ -646,7 +646,7 @@ static int usbclass_sndpacket(FAR struct usbser_dev_s *priv) ************************************************************************************/ static inline int usbclass_recvpacket(FAR struct usbser_dev_s *priv, - char *reqbuf, uint16 reqlen) + ubyte *reqbuf, uint16 reqlen) { FAR uart_dev_t *serdev = &priv->serdev; FAR struct uart_buffer_s *recv = &serdev->recv; diff --git a/include/nuttx/usb.h b/include/nuttx/usb.h index 4b5835d935..7a2724fa29 100644 --- a/include/nuttx/usb.h +++ b/include/nuttx/usb.h @@ -58,12 +58,16 @@ /* USB directions (in endpoint addresses) */ +#define USB_DIR_MASK (0x80) +#define USB_EPNO_MASK (0x7f) #define USB_DIR_OUT (0x00) /* host-to-device */ #define USB_DIR_IN (0x80) /* device-to-host */ -#define USB_EPNO(addr) ((addr)&0x7f) -#define USB_EPOUT(addr) ((addr)|USB_DIR_OUT) -#define USB_EPIN(addr) ((addr)|USB_DIR_IN) +#define USB_EPNO(addr) ((addr) & USB_EPNO_MASK) +#define USB_EPOUT(addr) ((addr) | USB_DIR_OUT) +#define USB_EPIN(addr) ((addr) | USB_DIR_IN) +#define USB_ISEPIN(addr) (((addr) & USB_DIR_MASK) == USB_DIR_IN) +#define USB_ISEPOUT(addr) (((addr) & USB_DIR_MASK) == USB_DIR_OUT) /* Control Setup Packet. Byte 0=Request */