From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 25 Mar 2015 12:23:01 -0600 Subject: [U-Boot] [PATCH v2 73/80] dm: usb: Tidy up pipe value decoding In-Reply-To: <1427307788-7496-1-git-send-email-sjg@chromium.org> References: <1427307788-7496-1-git-send-email-sjg@chromium.org> Message-ID: <1427307788-7496-74-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add a few more shifts/masks to make it easier to decode a pipe value (rather than just building it). We need this for USB device emulation. Signed-off-by: Simon Glass --- Changes in v2: None include/usb_defs.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/include/usb_defs.h b/include/usb_defs.h index 27ddc47..8214ba9 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -165,12 +165,14 @@ #define USB_TEST_MODE_FORCE_ENABLE 0x05 -/* "pipe" definitions */ - -#define PIPE_ISOCHRONOUS 0 -#define PIPE_INTERRUPT 1 -#define PIPE_CONTROL 2 -#define PIPE_BULK 3 +/* + * "pipe" definitions, use unsigned so we can compare reliably, since this + * value is shifted up to bits 30/31. + */ +#define PIPE_ISOCHRONOUS 0U +#define PIPE_INTERRUPT 1U +#define PIPE_CONTROL 2U +#define PIPE_BULK 3U #define PIPE_DEVEP_MASK 0x0007ff00 #define USB_ISOCHRONOUS 0 @@ -178,6 +180,15 @@ #define USB_CONTROL 2 #define USB_BULK 3 +#define USB_PIPE_TYPE_SHIFT 30 +#define USB_PIPE_TYPE_MASK (3 << USB_PIPE_TYPE_SHIFT) + +#define USB_PIPE_DEV_SHIFT 8 +#define USB_PIPE_DEV_MASK (0x7f << USB_PIPE_DEV_SHIFT) + +#define USB_PIPE_EP_SHIFT 15 +#define USB_PIPE_EP_MASK (0xf << USB_PIPE_EP_SHIFT) + /* USB-status codes: */ #define USB_ST_ACTIVE 0x1 /* TD is active */ #define USB_ST_STALLED 0x2 /* TD is stalled */ -- 2.2.0.rc0.207.ga3a616c