usb.h (e5f24753c9b415adf12def520f051f60433068b4) usb.h (c60795f41d37600b6ebd79ec99252ec2f5efecd4)
1/*
2 * (C) Copyright 2001
3 * Denis Peter, MPL AG Switzerland
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or

--- 13 unchanged lines hidden (view full) ---

22 *
23 * Note: Part of this code has been derived from linux
24 *
25 */
26#ifndef _USB_H_
27#define _USB_H_
28
29#include <usb_defs.h>
1/*
2 * (C) Copyright 2001
3 * Denis Peter, MPL AG Switzerland
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or

--- 13 unchanged lines hidden (view full) ---

22 *
23 * Note: Part of this code has been derived from linux
24 *
25 */
26#ifndef _USB_H_
27#define _USB_H_
28
29#include <usb_defs.h>
30#include <usbdescriptors.h>
30#include <linux/usb/ch9.h>
31
32/*
33 * The EHCI spec says that we must align to at least 32 bytes. However,
34 * some platforms require larger alignment.
35 */
36#if ARCH_DMA_MINALIGN > 32
37#define USB_DMA_MINALIGN ARCH_DMA_MINALIGN
38#else

--- 23 unchanged lines hidden (view full) ---

62struct devrequest {
63 unsigned char requesttype;
64 unsigned char request;
65 unsigned short value;
66 unsigned short index;
67 unsigned short length;
68} __attribute__ ((packed));
69
31
32/*
33 * The EHCI spec says that we must align to at least 32 bytes. However,
34 * some platforms require larger alignment.
35 */
36#if ARCH_DMA_MINALIGN > 32
37#define USB_DMA_MINALIGN ARCH_DMA_MINALIGN
38#else

--- 23 unchanged lines hidden (view full) ---

62struct devrequest {
63 unsigned char requesttype;
64 unsigned char request;
65 unsigned short value;
66 unsigned short index;
67 unsigned short length;
68} __attribute__ ((packed));
69
70/* All standard descriptors have these 2 fields in common */
71struct usb_descriptor_header {
72 unsigned char bLength;
73 unsigned char bDescriptorType;
74} __attribute__ ((packed));
75
76/* Interface */
77struct usb_interface {
78 struct usb_interface_descriptor desc;
79
80 unsigned char no_of_ep;
81 unsigned char num_altsetting;
82 unsigned char act_altsetting;
83
84 struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
85} __attribute__ ((packed));
86
87/* Configuration information.. */
88struct usb_config {
70/* Interface */
71struct usb_interface {
72 struct usb_interface_descriptor desc;
73
74 unsigned char no_of_ep;
75 unsigned char num_altsetting;
76 unsigned char act_altsetting;
77
78 struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
79} __attribute__ ((packed));
80
81/* Configuration information.. */
82struct usb_config {
89 struct usb_configuration_descriptor desc;
83 struct usb_config_descriptor desc;
90
91 unsigned char no_of_if; /* number of interfaces */
92 struct usb_interface if_desc[USB_MAXINTERFACES];
93} __attribute__ ((packed));
94
95enum {
96 /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
97 PACKET_SIZE_8 = 0,

--- 182 unchanged lines hidden (view full) ---

280 * unsigned int. The encoding is:
281 *
282 * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
283 * - direction: bit 7 (0 = Host-to-Device [Out],
284 * (1 = Device-to-Host [In])
285 * - device: bits 8-14
286 * - endpoint: bits 15-18
287 * - Data0/1: bit 19
84
85 unsigned char no_of_if; /* number of interfaces */
86 struct usb_interface if_desc[USB_MAXINTERFACES];
87} __attribute__ ((packed));
88
89enum {
90 /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
91 PACKET_SIZE_8 = 0,

--- 182 unchanged lines hidden (view full) ---

274 * unsigned int. The encoding is:
275 *
276 * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
277 * - direction: bit 7 (0 = Host-to-Device [Out],
278 * (1 = Device-to-Host [In])
279 * - device: bits 8-14
280 * - endpoint: bits 15-18
281 * - Data0/1: bit 19
288 * - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High)
289 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
290 * 10 = control, 11 = bulk)
291 *
292 * Why? Because it's arbitrary, and whatever encoding we select is really
293 * up to us. This one happens to share a lot of bit positions with the UHCI
294 * specification, so that much of the uhci driver can just mask the bits
295 * appropriately.
296 */
297/* Create various pipes... */
298#define create_pipe(dev,endpoint) \
299 (((dev)->devnum << 8) | ((endpoint) << 15) | \
282 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
283 * 10 = control, 11 = bulk)
284 *
285 * Why? Because it's arbitrary, and whatever encoding we select is really
286 * up to us. This one happens to share a lot of bit positions with the UHCI
287 * specification, so that much of the uhci driver can just mask the bits
288 * appropriately.
289 */
290/* Create various pipes... */
291#define create_pipe(dev,endpoint) \
292 (((dev)->devnum << 8) | ((endpoint) << 15) | \
300 ((dev)->speed << 26) | (dev)->maxpacketsize)
293 (dev)->maxpacketsize)
301#define default_pipe(dev) ((dev)->speed << 26)
302
303#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
304 create_pipe(dev, endpoint))
305#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
306 create_pipe(dev, endpoint) | \
307 USB_DIR_IN)
308#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \

--- 34 unchanged lines hidden (view full) ---

343 USB_PID_OUT)
344
345#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
346#define usb_pipein(pipe) (((pipe) >> 7) & 1)
347#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
348#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
349#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
350#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
294#define default_pipe(dev) ((dev)->speed << 26)
295
296#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
297 create_pipe(dev, endpoint))
298#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
299 create_pipe(dev, endpoint) | \
300 USB_DIR_IN)
301#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \

--- 34 unchanged lines hidden (view full) ---

336 USB_PID_OUT)
337
338#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
339#define usb_pipein(pipe) (((pipe) >> 7) & 1)
340#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
341#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
342#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
343#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
351#define usb_pipespeed(pipe) (((pipe) >> 26) & 3)
352#define usb_pipeslow(pipe) (usb_pipespeed(pipe) == USB_SPEED_LOW)
353#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
354#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
355#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
356#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
357#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
358
359
360/*************************************************************************

--- 43 unchanged lines hidden ---
344#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
345#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
346#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
347#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
348#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
349
350
351/*************************************************************************

--- 43 unchanged lines hidden ---