Creation of Cybook 2416 (actually Gen4) repository
This commit is contained in:
5
include/linux/usb/Kbuild
Normal file
5
include/linux/usb/Kbuild
Normal file
@@ -0,0 +1,5 @@
|
||||
unifdef-y += audio.h
|
||||
unifdef-y += cdc.h
|
||||
unifdef-y += ch9.h
|
||||
unifdef-y += midi.h
|
||||
|
||||
53
include/linux/usb/audio.h
Normal file
53
include/linux/usb/audio.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* <linux/usb/audio.h> -- USB Audio definitions.
|
||||
*
|
||||
* Copyright (C) 2006 Thumtronics Pty Ltd.
|
||||
* Developed for Thumtronics by Grey Innovation
|
||||
* Ben Williamson <ben.williamson@greyinnovation.com>
|
||||
*
|
||||
* This software is distributed under the terms of the GNU General Public
|
||||
* License ("GPL") version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This file holds USB constants and structures defined
|
||||
* by the USB Device Class Definition for Audio Devices.
|
||||
* Comments below reference relevant sections of that document:
|
||||
*
|
||||
* http://www.usb.org/developers/devclass_docs/audio10.pdf
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_USB_AUDIO_H
|
||||
#define __LINUX_USB_AUDIO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* A.2 Audio Interface Subclass Codes */
|
||||
#define USB_SUBCLASS_AUDIOCONTROL 0x01
|
||||
#define USB_SUBCLASS_AUDIOSTREAMING 0x02
|
||||
#define USB_SUBCLASS_MIDISTREAMING 0x03
|
||||
|
||||
/* 4.3.2 Class-Specific AC Interface Descriptor */
|
||||
struct usb_ac_header_descriptor {
|
||||
__u8 bLength; // 8+n
|
||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
||||
__u8 bDescriptorSubtype; // USB_MS_HEADER
|
||||
__le16 bcdADC; // 0x0100
|
||||
__le16 wTotalLength; // includes Unit and Terminal desc.
|
||||
__u8 bInCollection; // n
|
||||
__u8 baInterfaceNr[]; // [n]
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
|
||||
|
||||
/* As above, but more useful for defining your own descriptors: */
|
||||
#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
|
||||
struct usb_ac_header_descriptor_##n { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubtype; \
|
||||
__le16 bcdADC; \
|
||||
__le16 wTotalLength; \
|
||||
__u8 bInCollection; \
|
||||
__u8 baInterfaceNr[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
#endif
|
||||
212
include/linux/usb/cdc.h
Normal file
212
include/linux/usb/cdc.h
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* USB Communications Device Class (CDC) definitions
|
||||
*
|
||||
* CDC says how to talk to lots of different types of network adapters,
|
||||
* notably ethernet adapters and various modems. It's used mostly with
|
||||
* firmware based USB peripherals.
|
||||
*/
|
||||
|
||||
#define USB_CDC_SUBCLASS_ACM 0x02
|
||||
#define USB_CDC_SUBCLASS_ETHERNET 0x06
|
||||
#define USB_CDC_SUBCLASS_WHCM 0x08
|
||||
#define USB_CDC_SUBCLASS_DMM 0x09
|
||||
#define USB_CDC_SUBCLASS_MDLM 0x0a
|
||||
#define USB_CDC_SUBCLASS_OBEX 0x0b
|
||||
|
||||
#define USB_CDC_PROTO_NONE 0
|
||||
|
||||
#define USB_CDC_ACM_PROTO_AT_V25TER 1
|
||||
#define USB_CDC_ACM_PROTO_AT_PCCA101 2
|
||||
#define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3
|
||||
#define USB_CDC_ACM_PROTO_AT_GSM 4
|
||||
#define USB_CDC_ACM_PROTO_AT_3G 5
|
||||
#define USB_CDC_ACM_PROTO_AT_CDMA 6
|
||||
#define USB_CDC_ACM_PROTO_VENDOR 0xff
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Class-Specific descriptors ... there are a couple dozen of them
|
||||
*/
|
||||
|
||||
#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
|
||||
#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
|
||||
#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
|
||||
#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
|
||||
#define USB_CDC_COUNTRY_TYPE 0x07
|
||||
#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
|
||||
#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
|
||||
#define USB_CDC_WHCM_TYPE 0x11
|
||||
#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
|
||||
#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
|
||||
#define USB_CDC_DMM_TYPE 0x14
|
||||
#define USB_CDC_OBEX_TYPE 0x15
|
||||
|
||||
/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
|
||||
struct usb_cdc_header_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__le16 bcdCDC;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "Call Management Descriptor" from CDC spec 5.2.3.2 */
|
||||
struct usb_cdc_call_mgmt_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__u8 bmCapabilities;
|
||||
#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01
|
||||
#define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02
|
||||
|
||||
__u8 bDataInterface;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */
|
||||
struct usb_cdc_acm_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__u8 bmCapabilities;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* capabilities from 5.2.3.3 */
|
||||
|
||||
#define USB_CDC_COMM_FEATURE 0x01
|
||||
#define USB_CDC_CAP_LINE 0x02
|
||||
#define USB_CDC_CAP_BRK 0x04
|
||||
#define USB_CDC_CAP_NOTIFY 0x08
|
||||
|
||||
/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
|
||||
struct usb_cdc_union_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__u8 bMasterInterface0;
|
||||
__u8 bSlaveInterface0;
|
||||
/* ... and there could be other slave interfaces */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
|
||||
struct usb_cdc_network_terminal_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__u8 bEntityId;
|
||||
__u8 iName;
|
||||
__u8 bChannelIndex;
|
||||
__u8 bPhysicalInterface;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */
|
||||
struct usb_cdc_ether_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__u8 iMACAddress;
|
||||
__le32 bmEthernetStatistics;
|
||||
__le16 wMaxSegmentSize;
|
||||
__le16 wNumberMCFilters;
|
||||
__u8 bNumberPowerFilters;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */
|
||||
struct usb_cdc_mdlm_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
__le16 bcdVersion;
|
||||
__u8 bGUID[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */
|
||||
struct usb_cdc_mdlm_detail_desc {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
|
||||
/* type is associated with mdlm_desc.bGUID */
|
||||
__u8 bGuidDescriptorType;
|
||||
__u8 bDetailData[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Class-Specific Control Requests (6.2)
|
||||
*
|
||||
* section 3.6.2.1 table 4 has the ACM profile, for modems.
|
||||
* section 3.8.2 table 10 has the ethernet profile.
|
||||
*
|
||||
* Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant,
|
||||
* heavily dependent on the encapsulated (proprietary) command mechanism.
|
||||
*/
|
||||
|
||||
#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
|
||||
#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
|
||||
#define USB_CDC_REQ_SET_LINE_CODING 0x20
|
||||
#define USB_CDC_REQ_GET_LINE_CODING 0x21
|
||||
#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
|
||||
#define USB_CDC_REQ_SEND_BREAK 0x23
|
||||
#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
|
||||
#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
|
||||
#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
|
||||
#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
|
||||
#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
|
||||
|
||||
/* Line Coding Structure from CDC spec 6.2.13 */
|
||||
struct usb_cdc_line_coding {
|
||||
__le32 dwDTERate;
|
||||
__u8 bCharFormat;
|
||||
#define USB_CDC_1_STOP_BITS 0
|
||||
#define USB_CDC_1_5_STOP_BITS 1
|
||||
#define USB_CDC_2_STOP_BITS 2
|
||||
|
||||
__u8 bParityType;
|
||||
#define USB_CDC_NO_PARITY 0
|
||||
#define USB_CDC_ODD_PARITY 1
|
||||
#define USB_CDC_EVEN_PARITY 2
|
||||
#define USB_CDC_MARK_PARITY 3
|
||||
#define USB_CDC_SPACE_PARITY 4
|
||||
|
||||
__u8 bDataBits;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* table 62; bits in multicast filter */
|
||||
#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0)
|
||||
#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */
|
||||
#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2)
|
||||
#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3)
|
||||
#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Class-Specific Notifications (6.3) sent by interrupt transfers
|
||||
*
|
||||
* section 3.8.2 table 11 of the CDC spec lists Ethernet notifications
|
||||
* section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS
|
||||
* RNDIS also defines its own bit-incompatible notifications
|
||||
*/
|
||||
|
||||
#define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00
|
||||
#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01
|
||||
#define USB_CDC_NOTIFY_SERIAL_STATE 0x20
|
||||
#define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a
|
||||
|
||||
struct usb_cdc_notification {
|
||||
__u8 bmRequestType;
|
||||
__u8 bNotificationType;
|
||||
__le16 wValue;
|
||||
__le16 wIndex;
|
||||
__le16 wLength;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
577
include/linux/usb/ch9.h
Normal file
577
include/linux/usb/ch9.h
Normal file
@@ -0,0 +1,577 @@
|
||||
/*
|
||||
* This file holds USB constants and structures that are needed for
|
||||
* USB device APIs. These are used by the USB device model, which is
|
||||
* defined in chapter 9 of the USB 2.0 specification and in the
|
||||
* Wireless USB 1.0 (spread around). Linux has several APIs in C that
|
||||
* need these:
|
||||
*
|
||||
* - the master/host side Linux-USB kernel driver API;
|
||||
* - the "usbfs" user space API; and
|
||||
* - the Linux "gadget" slave/device/peripheral side driver API.
|
||||
*
|
||||
* USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
|
||||
* act either as a USB master/host or as a USB slave/device. That means
|
||||
* the master and slave side APIs benefit from working well together.
|
||||
*
|
||||
* There's also "Wireless USB", using low power short range radios for
|
||||
* peripheral interconnection but otherwise building on the USB framework.
|
||||
*
|
||||
* Note all descriptors are declared '__attribute__((packed))' so that:
|
||||
*
|
||||
* [a] they never get padded, either internally (USB spec writers
|
||||
* probably handled that) or externally;
|
||||
*
|
||||
* [b] so that accessing bigger-than-a-bytes fields will never
|
||||
* generate bus errors on any platform, even when the location of
|
||||
* its descriptor inside a bundle isn't "naturally aligned", and
|
||||
*
|
||||
* [c] for consistency, removing all doubt even when it appears to
|
||||
* someone that the two other points are non-issues for that
|
||||
* particular descriptor type.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_USB_CH9_H
|
||||
#define __LINUX_USB_CH9_H
|
||||
|
||||
#include <linux/types.h> /* __u8 etc */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* CONTROL REQUEST SUPPORT */
|
||||
|
||||
/*
|
||||
* USB directions
|
||||
*
|
||||
* This bit flag is used in endpoint descriptors' bEndpointAddress field.
|
||||
* It's also one of three fields in control requests bRequestType.
|
||||
*/
|
||||
#define USB_DIR_OUT 0 /* to device */
|
||||
#define USB_DIR_IN 0x80 /* to host */
|
||||
|
||||
/*
|
||||
* USB types, the second of three bRequestType fields
|
||||
*/
|
||||
#define USB_TYPE_MASK (0x03 << 5)
|
||||
#define USB_TYPE_STANDARD (0x00 << 5)
|
||||
#define USB_TYPE_CLASS (0x01 << 5)
|
||||
#define USB_TYPE_VENDOR (0x02 << 5)
|
||||
#define USB_TYPE_RESERVED (0x03 << 5)
|
||||
|
||||
/*
|
||||
* USB recipients, the third of three bRequestType fields
|
||||
*/
|
||||
#define USB_RECIP_MASK 0x1f
|
||||
#define USB_RECIP_DEVICE 0x00
|
||||
#define USB_RECIP_INTERFACE 0x01
|
||||
#define USB_RECIP_ENDPOINT 0x02
|
||||
#define USB_RECIP_OTHER 0x03
|
||||
/* From Wireless USB 1.0 */
|
||||
#define USB_RECIP_PORT 0x04
|
||||
#define USB_RECIP_RPIPE 0x05
|
||||
|
||||
/*
|
||||
* Standard requests, for the bRequest field of a SETUP packet.
|
||||
*
|
||||
* These are qualified by the bRequestType field, so that for example
|
||||
* TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
|
||||
* by a GET_STATUS request.
|
||||
*/
|
||||
#define USB_REQ_GET_STATUS 0x00
|
||||
#define USB_REQ_CLEAR_FEATURE 0x01
|
||||
#define USB_REQ_SET_FEATURE 0x03
|
||||
#define USB_REQ_SET_ADDRESS 0x05
|
||||
#define USB_REQ_GET_DESCRIPTOR 0x06
|
||||
#define USB_REQ_SET_DESCRIPTOR 0x07
|
||||
#define USB_REQ_GET_CONFIGURATION 0x08
|
||||
#define USB_REQ_SET_CONFIGURATION 0x09
|
||||
#define USB_REQ_GET_INTERFACE 0x0A
|
||||
#define USB_REQ_SET_INTERFACE 0x0B
|
||||
#define USB_REQ_SYNCH_FRAME 0x0C
|
||||
|
||||
#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
|
||||
#define USB_REQ_GET_ENCRYPTION 0x0E
|
||||
#define USB_REQ_RPIPE_ABORT 0x0E
|
||||
#define USB_REQ_SET_HANDSHAKE 0x0F
|
||||
#define USB_REQ_RPIPE_RESET 0x0F
|
||||
#define USB_REQ_GET_HANDSHAKE 0x10
|
||||
#define USB_REQ_SET_CONNECTION 0x11
|
||||
#define USB_REQ_SET_SECURITY_DATA 0x12
|
||||
#define USB_REQ_GET_SECURITY_DATA 0x13
|
||||
#define USB_REQ_SET_WUSB_DATA 0x14
|
||||
#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
|
||||
#define USB_REQ_LOOPBACK_DATA_READ 0x16
|
||||
#define USB_REQ_SET_INTERFACE_DS 0x17
|
||||
|
||||
/*
|
||||
* USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
|
||||
* are read as a bit array returned by USB_REQ_GET_STATUS. (So there
|
||||
* are at most sixteen features of each type.)
|
||||
*/
|
||||
#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
|
||||
#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
|
||||
#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
|
||||
#define USB_DEVICE_BATTERY 2 /* (wireless) */
|
||||
#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
|
||||
#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
|
||||
#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
|
||||
#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
|
||||
#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
|
||||
|
||||
#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
|
||||
|
||||
|
||||
/**
|
||||
* struct usb_ctrlrequest - SETUP data for a USB device control request
|
||||
* @bRequestType: matches the USB bmRequestType field
|
||||
* @bRequest: matches the USB bRequest field
|
||||
* @wValue: matches the USB wValue field (le16 byte order)
|
||||
* @wIndex: matches the USB wIndex field (le16 byte order)
|
||||
* @wLength: matches the USB wLength field (le16 byte order)
|
||||
*
|
||||
* This structure is used to send control requests to a USB device. It matches
|
||||
* the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
|
||||
* USB spec for a fuller description of the different fields, and what they are
|
||||
* used for.
|
||||
*
|
||||
* Note that the driver for any interface can issue control requests.
|
||||
* For most devices, interfaces don't coordinate with each other, so
|
||||
* such requests may be made at any time.
|
||||
*/
|
||||
struct usb_ctrlrequest {
|
||||
__u8 bRequestType;
|
||||
__u8 bRequest;
|
||||
__le16 wValue;
|
||||
__le16 wIndex;
|
||||
__le16 wLength;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
|
||||
* (rarely) accepted by SET_DESCRIPTOR.
|
||||
*
|
||||
* Note that all multi-byte values here are encoded in little endian
|
||||
* byte order "on the wire". But when exposed through Linux-USB APIs,
|
||||
* they've been converted to cpu byte order.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Descriptor types ... USB 2.0 spec table 9.5
|
||||
*/
|
||||
#define USB_DT_DEVICE 0x01
|
||||
#define USB_DT_CONFIG 0x02
|
||||
#define USB_DT_STRING 0x03
|
||||
#define USB_DT_INTERFACE 0x04
|
||||
#define USB_DT_ENDPOINT 0x05
|
||||
#define USB_DT_DEVICE_QUALIFIER 0x06
|
||||
#define USB_DT_OTHER_SPEED_CONFIG 0x07
|
||||
#define USB_DT_INTERFACE_POWER 0x08
|
||||
/* these are from a minor usb 2.0 revision (ECN) */
|
||||
#define USB_DT_OTG 0x09
|
||||
#define USB_DT_DEBUG 0x0a
|
||||
#define USB_DT_INTERFACE_ASSOCIATION 0x0b
|
||||
/* these are from the Wireless USB spec */
|
||||
#define USB_DT_SECURITY 0x0c
|
||||
#define USB_DT_KEY 0x0d
|
||||
#define USB_DT_ENCRYPTION_TYPE 0x0e
|
||||
#define USB_DT_BOS 0x0f
|
||||
#define USB_DT_DEVICE_CAPABILITY 0x10
|
||||
#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
|
||||
#define USB_DT_WIRE_ADAPTER 0x21
|
||||
#define USB_DT_RPIPE 0x22
|
||||
|
||||
/* conventional codes for class-specific descriptors */
|
||||
#define USB_DT_CS_DEVICE 0x21
|
||||
#define USB_DT_CS_CONFIG 0x22
|
||||
#define USB_DT_CS_STRING 0x23
|
||||
#define USB_DT_CS_INTERFACE 0x24
|
||||
#define USB_DT_CS_ENDPOINT 0x25
|
||||
|
||||
/* All standard descriptors have these 2 fields at the beginning */
|
||||
struct usb_descriptor_header {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_DEVICE: Device descriptor */
|
||||
struct usb_device_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 bcdUSB;
|
||||
__u8 bDeviceClass;
|
||||
__u8 bDeviceSubClass;
|
||||
__u8 bDeviceProtocol;
|
||||
__u8 bMaxPacketSize0;
|
||||
__le16 idVendor;
|
||||
__le16 idProduct;
|
||||
__le16 bcdDevice;
|
||||
__u8 iManufacturer;
|
||||
__u8 iProduct;
|
||||
__u8 iSerialNumber;
|
||||
__u8 bNumConfigurations;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_DEVICE_SIZE 18
|
||||
|
||||
|
||||
/*
|
||||
* Device and/or Interface Class codes
|
||||
* as found in bDeviceClass or bInterfaceClass
|
||||
* and defined by www.usb.org documents
|
||||
*/
|
||||
#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
|
||||
#define USB_CLASS_AUDIO 1
|
||||
#define USB_CLASS_COMM 2
|
||||
#define USB_CLASS_HID 3
|
||||
#define USB_CLASS_PHYSICAL 5
|
||||
#define USB_CLASS_STILL_IMAGE 6
|
||||
#define USB_CLASS_PRINTER 7
|
||||
#define USB_CLASS_MASS_STORAGE 8
|
||||
#define USB_CLASS_HUB 9
|
||||
#define USB_CLASS_CDC_DATA 0x0a
|
||||
#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
|
||||
#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
|
||||
#define USB_CLASS_VIDEO 0x0e
|
||||
#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
|
||||
#define USB_CLASS_MISC 0xef
|
||||
#define USB_CLASS_APP_SPEC 0xfe
|
||||
#define USB_CLASS_VENDOR_SPEC 0xff
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_CONFIG: Configuration descriptor information.
|
||||
*
|
||||
* USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
|
||||
* descriptor type is different. Highspeed-capable devices can look
|
||||
* different depending on what speed they're currently running. Only
|
||||
* devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
|
||||
* descriptors.
|
||||
*/
|
||||
struct usb_config_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 wTotalLength;
|
||||
__u8 bNumInterfaces;
|
||||
__u8 bConfigurationValue;
|
||||
__u8 iConfiguration;
|
||||
__u8 bmAttributes;
|
||||
__u8 bMaxPower;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_CONFIG_SIZE 9
|
||||
|
||||
/* from config descriptor bmAttributes */
|
||||
#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
|
||||
#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
|
||||
#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
|
||||
#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_STRING: String descriptor */
|
||||
struct usb_string_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 wData[1]; /* UTF-16LE encoded */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* note that "string" zero is special, it holds language codes that
|
||||
* the device supports, not Unicode characters.
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_INTERFACE: Interface descriptor */
|
||||
struct usb_interface_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bInterfaceNumber;
|
||||
__u8 bAlternateSetting;
|
||||
__u8 bNumEndpoints;
|
||||
__u8 bInterfaceClass;
|
||||
__u8 bInterfaceSubClass;
|
||||
__u8 bInterfaceProtocol;
|
||||
__u8 iInterface;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_INTERFACE_SIZE 9
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_ENDPOINT: Endpoint descriptor */
|
||||
struct usb_endpoint_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bmAttributes;
|
||||
__le16 wMaxPacketSize;
|
||||
__u8 bInterval;
|
||||
|
||||
/* NOTE: these two are _only_ in audio endpoints. */
|
||||
/* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
|
||||
__u8 bRefresh;
|
||||
__u8 bSynchAddress;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_ENDPOINT_SIZE 7
|
||||
#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
|
||||
|
||||
|
||||
/*
|
||||
* Endpoints
|
||||
*/
|
||||
#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
|
||||
#define USB_ENDPOINT_DIR_MASK 0x80
|
||||
|
||||
#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
|
||||
#define USB_ENDPOINT_XFER_CONTROL 0
|
||||
#define USB_ENDPOINT_XFER_ISOC 1
|
||||
#define USB_ENDPOINT_XFER_BULK 2
|
||||
#define USB_ENDPOINT_XFER_INT 3
|
||||
#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
|
||||
struct usb_qualifier_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 bcdUSB;
|
||||
__u8 bDeviceClass;
|
||||
__u8 bDeviceSubClass;
|
||||
__u8 bDeviceProtocol;
|
||||
__u8 bMaxPacketSize0;
|
||||
__u8 bNumConfigurations;
|
||||
__u8 bRESERVED;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_OTG (from OTG 1.0a supplement) */
|
||||
struct usb_otg_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bmAttributes; /* support for HNP, SRP, etc */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* from usb_otg_descriptor.bmAttributes */
|
||||
#define USB_OTG_SRP (1 << 0)
|
||||
#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
|
||||
struct usb_debug_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
/* bulk endpoints with 8 byte maxpacket */
|
||||
__u8 bDebugInEndpoint;
|
||||
__u8 bDebugOutEndpoint;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
|
||||
struct usb_interface_assoc_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bFirstInterface;
|
||||
__u8 bInterfaceCount;
|
||||
__u8 bFunctionClass;
|
||||
__u8 bFunctionSubClass;
|
||||
__u8 bFunctionProtocol;
|
||||
__u8 iFunction;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_SECURITY: group of wireless security descriptors, including
|
||||
* encryption types available for setting up a CC/association.
|
||||
*/
|
||||
struct usb_security_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 wTotalLength;
|
||||
__u8 bNumEncryptionTypes;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
|
||||
* may be retrieved.
|
||||
*/
|
||||
struct usb_key_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 tTKID[3];
|
||||
__u8 bReserved;
|
||||
__u8 bKeyData[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
|
||||
struct usb_encryption_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bEncryptionType;
|
||||
#define USB_ENC_TYPE_UNSECURE 0
|
||||
#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
|
||||
#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
|
||||
#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
|
||||
__u8 bEncryptionValue; /* use in SET_ENCRYPTION */
|
||||
__u8 bAuthKeyIndex;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_BOS: group of wireless capabilities */
|
||||
struct usb_bos_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__le16 wTotalLength;
|
||||
__u8 bNumDeviceCaps;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
|
||||
struct usb_dev_cap_header {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDevCapabilityType;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define USB_CAP_TYPE_WIRELESS_USB 1
|
||||
|
||||
struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDevCapabilityType;
|
||||
|
||||
__u8 bmAttributes;
|
||||
#define USB_WIRELESS_P2P_DRD (1 << 1)
|
||||
#define USB_WIRELESS_BEACON_MASK (3 << 2)
|
||||
#define USB_WIRELESS_BEACON_SELF (1 << 2)
|
||||
#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
|
||||
#define USB_WIRELESS_BEACON_NONE (3 << 2)
|
||||
__le16 wPHYRates; /* bit rates, Mbps */
|
||||
#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
|
||||
#define USB_WIRELESS_PHY_80 (1 << 1)
|
||||
#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
|
||||
#define USB_WIRELESS_PHY_160 (1 << 3)
|
||||
#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
|
||||
#define USB_WIRELESS_PHY_320 (1 << 5)
|
||||
#define USB_WIRELESS_PHY_400 (1 << 6)
|
||||
#define USB_WIRELESS_PHY_480 (1 << 7)
|
||||
__u8 bmTFITXPowerInfo; /* TFI power levels */
|
||||
__u8 bmFFITXPowerInfo; /* FFI power levels */
|
||||
__le16 bmBandGroup;
|
||||
__u8 bReserved;
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
|
||||
* each endpoint descriptor for a wireless device
|
||||
*/
|
||||
struct usb_wireless_ep_comp_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
|
||||
__u8 bMaxBurst;
|
||||
__u8 bMaxSequence;
|
||||
__le16 wMaxStreamDelay;
|
||||
__le16 wOverTheAirPacketSize;
|
||||
__u8 bOverTheAirInterval;
|
||||
__u8 bmCompAttributes;
|
||||
#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
|
||||
#define USB_ENDPOINT_SWITCH_NO 0
|
||||
#define USB_ENDPOINT_SWITCH_SWITCH 1
|
||||
#define USB_ENDPOINT_SWITCH_SCALE 2
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
|
||||
* host and a device for connection set up, mutual authentication, and
|
||||
* exchanging short lived session keys. The handshake depends on a CC.
|
||||
*/
|
||||
struct usb_handshake {
|
||||
__u8 bMessageNumber;
|
||||
__u8 bStatus;
|
||||
__u8 tTKID[3];
|
||||
__u8 bReserved;
|
||||
__u8 CDID[16];
|
||||
__u8 nonce[16];
|
||||
__u8 MIC[8];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
|
||||
* A CC may also be set up using non-wireless secure channels (including
|
||||
* wired USB!), and some devices may support CCs with multiple hosts.
|
||||
*/
|
||||
struct usb_connection_context {
|
||||
__u8 CHID[16]; /* persistent host id */
|
||||
__u8 CDID[16]; /* device id (unique w/in host context) */
|
||||
__u8 CK[16]; /* connection key */
|
||||
} __attribute__((packed));
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* USB 2.0 defines three speeds, here's how Linux identifies them */
|
||||
|
||||
enum usb_device_speed {
|
||||
USB_SPEED_UNKNOWN = 0, /* enumerating */
|
||||
USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
|
||||
USB_SPEED_HIGH, /* usb 2.0 */
|
||||
USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
|
||||
};
|
||||
|
||||
enum usb_device_state {
|
||||
/* NOTATTACHED isn't in the USB spec, and this state acts
|
||||
* the same as ATTACHED ... but it's clearer this way.
|
||||
*/
|
||||
USB_STATE_NOTATTACHED = 0,
|
||||
|
||||
/* chapter 9 and authentication (wireless) device states */
|
||||
USB_STATE_ATTACHED,
|
||||
USB_STATE_POWERED, /* wired */
|
||||
USB_STATE_UNAUTHENTICATED, /* auth */
|
||||
USB_STATE_RECONNECTING, /* auth */
|
||||
USB_STATE_DEFAULT, /* limited function */
|
||||
USB_STATE_ADDRESS,
|
||||
USB_STATE_CONFIGURED, /* most functions */
|
||||
|
||||
USB_STATE_SUSPENDED
|
||||
|
||||
/* NOTE: there are actually four different SUSPENDED
|
||||
* states, returning to POWERED, DEFAULT, ADDRESS, or
|
||||
* CONFIGURED respectively when SOF tokens flow again.
|
||||
*/
|
||||
};
|
||||
|
||||
#endif /* __LINUX_USB_CH9_H */
|
||||
25
include/linux/usb/input.h
Normal file
25
include/linux/usb/input.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __USB_INPUT_H
|
||||
#define __USB_INPUT_H
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Dmitry Torokhov
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published by
|
||||
* the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/usb.h>
|
||||
#include <linux/input.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
static inline void
|
||||
usb_to_input_id(const struct usb_device *dev, struct input_id *id)
|
||||
{
|
||||
id->bustype = BUS_USB;
|
||||
id->vendor = le16_to_cpu(dev->descriptor.idVendor);
|
||||
id->product = le16_to_cpu(dev->descriptor.idProduct);
|
||||
id->version = le16_to_cpu(dev->descriptor.bcdDevice);
|
||||
}
|
||||
|
||||
#endif
|
||||
33
include/linux/usb/iowarrior.h
Normal file
33
include/linux/usb/iowarrior.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _IOWARRIOR_H_
|
||||
#define _IOWARRIOR_H_
|
||||
|
||||
#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
|
||||
|
||||
/* Define the ioctl commands for reading and writing data */
|
||||
#define IOW_WRITE _IOW(CODEMERCS_MAGIC_NUMBER, 1, __u8 *)
|
||||
#define IOW_READ _IOW(CODEMERCS_MAGIC_NUMBER, 2, __u8 *)
|
||||
|
||||
/*
|
||||
A struct for available device info which is read
|
||||
with the ioctl IOW_GETINFO.
|
||||
To be compatible with 2.4 userspace which didn't have an easy way to get
|
||||
this information.
|
||||
*/
|
||||
struct iowarrior_info {
|
||||
__u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
|
||||
__u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
|
||||
__u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
|
||||
__u32 revision; /* revision number of the chip */
|
||||
__u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
|
||||
__u32 power; /* power consumption of the device in mA */
|
||||
__u32 if_num; /* the number of the endpoint */
|
||||
__u32 report_size; /* size of the data-packets on this interface */
|
||||
};
|
||||
|
||||
/*
|
||||
Get some device-information (product-id , serial-number etc.)
|
||||
in order to identify a chip.
|
||||
*/
|
||||
#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
|
||||
|
||||
#endif /* _IOWARRIOR_H_ */
|
||||
29
include/linux/usb/isp116x.h
Normal file
29
include/linux/usb/isp116x.h
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
/*
|
||||
* Board initialization code should put one of these into dev->platform_data
|
||||
* and place the isp116x onto platform_bus.
|
||||
*/
|
||||
|
||||
struct isp116x_platform_data {
|
||||
/* Enable internal resistors on downstream ports */
|
||||
unsigned sel15Kres:1;
|
||||
/* On-chip overcurrent detection */
|
||||
unsigned oc_enable:1;
|
||||
/* INT output polarity */
|
||||
unsigned int_act_high:1;
|
||||
/* INT edge or level triggered */
|
||||
unsigned int_edge_triggered:1;
|
||||
/* Enable wakeup by devices on usb bus (e.g. wakeup
|
||||
by attachment/detachment or by device activity
|
||||
such as moving a mouse). When chosen, this option
|
||||
prevents stopping internal clock, increasing
|
||||
thereby power consumption in suspended state. */
|
||||
unsigned remote_wakeup_enable:1;
|
||||
/* Inter-io delay (ns). The chip is picky about access timings; it
|
||||
expects at least:
|
||||
150ns delay between consecutive accesses to DATA_REG,
|
||||
300ns delay between access to ADDR_REG and DATA_REG
|
||||
OE, WE MUST NOT be changed during these intervals
|
||||
*/
|
||||
void (*delay) (struct device * dev, int delay);
|
||||
};
|
||||
112
include/linux/usb/midi.h
Normal file
112
include/linux/usb/midi.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* <linux/usb/midi.h> -- USB MIDI definitions.
|
||||
*
|
||||
* Copyright (C) 2006 Thumtronics Pty Ltd.
|
||||
* Developed for Thumtronics by Grey Innovation
|
||||
* Ben Williamson <ben.williamson@greyinnovation.com>
|
||||
*
|
||||
* This software is distributed under the terms of the GNU General Public
|
||||
* License ("GPL") version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This file holds USB constants and structures defined
|
||||
* by the USB Device Class Definition for MIDI Devices.
|
||||
* Comments below reference relevant sections of that document:
|
||||
*
|
||||
* http://www.usb.org/developers/devclass_docs/midi10.pdf
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_USB_MIDI_H
|
||||
#define __LINUX_USB_MIDI_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* A.1 MS Class-Specific Interface Descriptor Subtypes */
|
||||
#define USB_MS_HEADER 0x01
|
||||
#define USB_MS_MIDI_IN_JACK 0x02
|
||||
#define USB_MS_MIDI_OUT_JACK 0x03
|
||||
#define USB_MS_ELEMENT 0x04
|
||||
|
||||
/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */
|
||||
#define USB_MS_GENERAL 0x01
|
||||
|
||||
/* A.3 MS MIDI IN and OUT Jack Types */
|
||||
#define USB_MS_EMBEDDED 0x01
|
||||
#define USB_MS_EXTERNAL 0x02
|
||||
|
||||
/* 6.1.2.1 Class-Specific MS Interface Header Descriptor */
|
||||
struct usb_ms_header_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubtype;
|
||||
__le16 bcdMSC;
|
||||
__le16 wTotalLength;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_MS_HEADER_SIZE 7
|
||||
|
||||
/* 6.1.2.2 MIDI IN Jack Descriptor */
|
||||
struct usb_midi_in_jack_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
||||
__u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
|
||||
__u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
|
||||
__u8 bJackID;
|
||||
__u8 iJack;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_MIDI_IN_SIZE 6
|
||||
|
||||
struct usb_midi_source_pin {
|
||||
__u8 baSourceID;
|
||||
__u8 baSourcePin;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* 6.1.2.3 MIDI OUT Jack Descriptor */
|
||||
struct usb_midi_out_jack_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
||||
__u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
|
||||
__u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
|
||||
__u8 bJackID;
|
||||
__u8 bNrInputPins; // p
|
||||
struct usb_midi_source_pin pins[]; // [p]
|
||||
/*__u8 iJack; -- ommitted due to variable-sized pins[] */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
|
||||
|
||||
/* As above, but more useful for defining your own descriptors: */
|
||||
#define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \
|
||||
struct usb_midi_out_jack_descriptor_##p { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubtype; \
|
||||
__u8 bJackType; \
|
||||
__u8 bJackID; \
|
||||
__u8 bNrInputPins; \
|
||||
struct usb_midi_source_pin pins[p]; \
|
||||
__u8 iJack; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
|
||||
struct usb_ms_endpoint_descriptor {
|
||||
__u8 bLength; // 4+n
|
||||
__u8 bDescriptorType; // USB_DT_CS_ENDPOINT
|
||||
__u8 bDescriptorSubtype; // USB_MS_GENERAL
|
||||
__u8 bNumEmbMIDIJack; // n
|
||||
__u8 baAssocJackID[]; // [n]
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
|
||||
|
||||
/* As above, but more useful for defining your own descriptors: */
|
||||
#define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \
|
||||
struct usb_ms_endpoint_descriptor_##n { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubtype; \
|
||||
__u8 bNumEmbMIDIJack; \
|
||||
__u8 baAssocJackID[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
#endif
|
||||
444
include/linux/usb/net2280.h
Normal file
444
include/linux/usb/net2280.h
Normal file
@@ -0,0 +1,444 @@
|
||||
/*
|
||||
* NetChip 2280 high/full speed USB device controller.
|
||||
* Unlike many such controllers, this one talks PCI.
|
||||
*/
|
||||
#ifndef __LINUX_USB_NET2280_H
|
||||
#define __LINUX_USB_NET2280_H
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
|
||||
* Copyright (C) 2003 David Brownell
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* NET2280 MEMORY MAPPED REGISTERS
|
||||
*
|
||||
* The register layout came from the chip documentation, and the bit
|
||||
* number definitions were extracted from chip specification.
|
||||
*
|
||||
* Use the shift operator ('<<') to build bit masks, with readl/writel
|
||||
* to access the registers through PCI.
|
||||
*/
|
||||
|
||||
/* main registers, BAR0 + 0x0000 */
|
||||
struct net2280_regs {
|
||||
// offset 0x0000
|
||||
u32 devinit;
|
||||
#define LOCAL_CLOCK_FREQUENCY 8
|
||||
#define FORCE_PCI_RESET 7
|
||||
#define PCI_ID 6
|
||||
#define PCI_ENABLE 5
|
||||
#define FIFO_SOFT_RESET 4
|
||||
#define CFG_SOFT_RESET 3
|
||||
#define PCI_SOFT_RESET 2
|
||||
#define USB_SOFT_RESET 1
|
||||
#define M8051_RESET 0
|
||||
u32 eectl;
|
||||
#define EEPROM_ADDRESS_WIDTH 23
|
||||
#define EEPROM_CHIP_SELECT_ACTIVE 22
|
||||
#define EEPROM_PRESENT 21
|
||||
#define EEPROM_VALID 20
|
||||
#define EEPROM_BUSY 19
|
||||
#define EEPROM_CHIP_SELECT_ENABLE 18
|
||||
#define EEPROM_BYTE_READ_START 17
|
||||
#define EEPROM_BYTE_WRITE_START 16
|
||||
#define EEPROM_READ_DATA 8
|
||||
#define EEPROM_WRITE_DATA 0
|
||||
u32 eeclkfreq;
|
||||
u32 _unused0;
|
||||
// offset 0x0010
|
||||
|
||||
u32 pciirqenb0; /* interrupt PCI master ... */
|
||||
#define SETUP_PACKET_INTERRUPT_ENABLE 7
|
||||
#define ENDPOINT_F_INTERRUPT_ENABLE 6
|
||||
#define ENDPOINT_E_INTERRUPT_ENABLE 5
|
||||
#define ENDPOINT_D_INTERRUPT_ENABLE 4
|
||||
#define ENDPOINT_C_INTERRUPT_ENABLE 3
|
||||
#define ENDPOINT_B_INTERRUPT_ENABLE 2
|
||||
#define ENDPOINT_A_INTERRUPT_ENABLE 1
|
||||
#define ENDPOINT_0_INTERRUPT_ENABLE 0
|
||||
u32 pciirqenb1;
|
||||
#define PCI_INTERRUPT_ENABLE 31
|
||||
#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
|
||||
#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
|
||||
#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
|
||||
#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
|
||||
#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
|
||||
#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18
|
||||
#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
|
||||
#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
|
||||
#define GPIO_INTERRUPT_ENABLE 13
|
||||
#define DMA_D_INTERRUPT_ENABLE 12
|
||||
#define DMA_C_INTERRUPT_ENABLE 11
|
||||
#define DMA_B_INTERRUPT_ENABLE 10
|
||||
#define DMA_A_INTERRUPT_ENABLE 9
|
||||
#define EEPROM_DONE_INTERRUPT_ENABLE 8
|
||||
#define VBUS_INTERRUPT_ENABLE 7
|
||||
#define CONTROL_STATUS_INTERRUPT_ENABLE 6
|
||||
#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
|
||||
#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
|
||||
#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
|
||||
#define RESUME_INTERRUPT_ENABLE 1
|
||||
#define SOF_INTERRUPT_ENABLE 0
|
||||
u32 cpu_irqenb0; /* ... or onboard 8051 */
|
||||
#define SETUP_PACKET_INTERRUPT_ENABLE 7
|
||||
#define ENDPOINT_F_INTERRUPT_ENABLE 6
|
||||
#define ENDPOINT_E_INTERRUPT_ENABLE 5
|
||||
#define ENDPOINT_D_INTERRUPT_ENABLE 4
|
||||
#define ENDPOINT_C_INTERRUPT_ENABLE 3
|
||||
#define ENDPOINT_B_INTERRUPT_ENABLE 2
|
||||
#define ENDPOINT_A_INTERRUPT_ENABLE 1
|
||||
#define ENDPOINT_0_INTERRUPT_ENABLE 0
|
||||
u32 cpu_irqenb1;
|
||||
#define CPU_INTERRUPT_ENABLE 31
|
||||
#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
|
||||
#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
|
||||
#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
|
||||
#define PCI_INTA_INTERRUPT_ENABLE 24
|
||||
#define PCI_PME_INTERRUPT_ENABLE 23
|
||||
#define PCI_SERR_INTERRUPT_ENABLE 22
|
||||
#define PCI_PERR_INTERRUPT_ENABLE 21
|
||||
#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
|
||||
#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
|
||||
#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
|
||||
#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
|
||||
#define GPIO_INTERRUPT_ENABLE 13
|
||||
#define DMA_D_INTERRUPT_ENABLE 12
|
||||
#define DMA_C_INTERRUPT_ENABLE 11
|
||||
#define DMA_B_INTERRUPT_ENABLE 10
|
||||
#define DMA_A_INTERRUPT_ENABLE 9
|
||||
#define EEPROM_DONE_INTERRUPT_ENABLE 8
|
||||
#define VBUS_INTERRUPT_ENABLE 7
|
||||
#define CONTROL_STATUS_INTERRUPT_ENABLE 6
|
||||
#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
|
||||
#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
|
||||
#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
|
||||
#define RESUME_INTERRUPT_ENABLE 1
|
||||
#define SOF_INTERRUPT_ENABLE 0
|
||||
|
||||
// offset 0x0020
|
||||
u32 _unused1;
|
||||
u32 usbirqenb1;
|
||||
#define USB_INTERRUPT_ENABLE 31
|
||||
#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27
|
||||
#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26
|
||||
#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25
|
||||
#define PCI_INTA_INTERRUPT_ENABLE 24
|
||||
#define PCI_PME_INTERRUPT_ENABLE 23
|
||||
#define PCI_SERR_INTERRUPT_ENABLE 22
|
||||
#define PCI_PERR_INTERRUPT_ENABLE 21
|
||||
#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20
|
||||
#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19
|
||||
#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17
|
||||
#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16
|
||||
#define GPIO_INTERRUPT_ENABLE 13
|
||||
#define DMA_D_INTERRUPT_ENABLE 12
|
||||
#define DMA_C_INTERRUPT_ENABLE 11
|
||||
#define DMA_B_INTERRUPT_ENABLE 10
|
||||
#define DMA_A_INTERRUPT_ENABLE 9
|
||||
#define EEPROM_DONE_INTERRUPT_ENABLE 8
|
||||
#define VBUS_INTERRUPT_ENABLE 7
|
||||
#define CONTROL_STATUS_INTERRUPT_ENABLE 6
|
||||
#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4
|
||||
#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3
|
||||
#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2
|
||||
#define RESUME_INTERRUPT_ENABLE 1
|
||||
#define SOF_INTERRUPT_ENABLE 0
|
||||
u32 irqstat0;
|
||||
#define INTA_ASSERTED 12
|
||||
#define SETUP_PACKET_INTERRUPT 7
|
||||
#define ENDPOINT_F_INTERRUPT 6
|
||||
#define ENDPOINT_E_INTERRUPT 5
|
||||
#define ENDPOINT_D_INTERRUPT 4
|
||||
#define ENDPOINT_C_INTERRUPT 3
|
||||
#define ENDPOINT_B_INTERRUPT 2
|
||||
#define ENDPOINT_A_INTERRUPT 1
|
||||
#define ENDPOINT_0_INTERRUPT 0
|
||||
u32 irqstat1;
|
||||
#define POWER_STATE_CHANGE_INTERRUPT 27
|
||||
#define PCI_ARBITER_TIMEOUT_INTERRUPT 26
|
||||
#define PCI_PARITY_ERROR_INTERRUPT 25
|
||||
#define PCI_INTA_INTERRUPT 24
|
||||
#define PCI_PME_INTERRUPT 23
|
||||
#define PCI_SERR_INTERRUPT 22
|
||||
#define PCI_PERR_INTERRUPT 21
|
||||
#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20
|
||||
#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19
|
||||
#define PCI_RETRY_ABORT_INTERRUPT 17
|
||||
#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16
|
||||
#define SOF_DOWN_INTERRUPT 14
|
||||
#define GPIO_INTERRUPT 13
|
||||
#define DMA_D_INTERRUPT 12
|
||||
#define DMA_C_INTERRUPT 11
|
||||
#define DMA_B_INTERRUPT 10
|
||||
#define DMA_A_INTERRUPT 9
|
||||
#define EEPROM_DONE_INTERRUPT 8
|
||||
#define VBUS_INTERRUPT 7
|
||||
#define CONTROL_STATUS_INTERRUPT 6
|
||||
#define ROOT_PORT_RESET_INTERRUPT 4
|
||||
#define SUSPEND_REQUEST_INTERRUPT 3
|
||||
#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
|
||||
#define RESUME_INTERRUPT 1
|
||||
#define SOF_INTERRUPT 0
|
||||
// offset 0x0030
|
||||
u32 idxaddr;
|
||||
u32 idxdata;
|
||||
u32 fifoctl;
|
||||
#define PCI_BASE2_RANGE 16
|
||||
#define IGNORE_FIFO_AVAILABILITY 3
|
||||
#define PCI_BASE2_SELECT 2
|
||||
#define FIFO_CONFIGURATION_SELECT 0
|
||||
u32 _unused2;
|
||||
// offset 0x0040
|
||||
u32 memaddr;
|
||||
#define START 28
|
||||
#define DIRECTION 27
|
||||
#define FIFO_DIAGNOSTIC_SELECT 24
|
||||
#define MEMORY_ADDRESS 0
|
||||
u32 memdata0;
|
||||
u32 memdata1;
|
||||
u32 _unused3;
|
||||
// offset 0x0050
|
||||
u32 gpioctl;
|
||||
#define GPIO3_LED_SELECT 12
|
||||
#define GPIO3_INTERRUPT_ENABLE 11
|
||||
#define GPIO2_INTERRUPT_ENABLE 10
|
||||
#define GPIO1_INTERRUPT_ENABLE 9
|
||||
#define GPIO0_INTERRUPT_ENABLE 8
|
||||
#define GPIO3_OUTPUT_ENABLE 7
|
||||
#define GPIO2_OUTPUT_ENABLE 6
|
||||
#define GPIO1_OUTPUT_ENABLE 5
|
||||
#define GPIO0_OUTPUT_ENABLE 4
|
||||
#define GPIO3_DATA 3
|
||||
#define GPIO2_DATA 2
|
||||
#define GPIO1_DATA 1
|
||||
#define GPIO0_DATA 0
|
||||
u32 gpiostat;
|
||||
#define GPIO3_INTERRUPT 3
|
||||
#define GPIO2_INTERRUPT 2
|
||||
#define GPIO1_INTERRUPT 1
|
||||
#define GPIO0_INTERRUPT 0
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* usb control, BAR0 + 0x0080 */
|
||||
struct net2280_usb_regs {
|
||||
// offset 0x0080
|
||||
u32 stdrsp;
|
||||
#define STALL_UNSUPPORTED_REQUESTS 31
|
||||
#define SET_TEST_MODE 16
|
||||
#define GET_OTHER_SPEED_CONFIGURATION 15
|
||||
#define GET_DEVICE_QUALIFIER 14
|
||||
#define SET_ADDRESS 13
|
||||
#define ENDPOINT_SET_CLEAR_HALT 12
|
||||
#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11
|
||||
#define GET_STRING_DESCRIPTOR_2 10
|
||||
#define GET_STRING_DESCRIPTOR_1 9
|
||||
#define GET_STRING_DESCRIPTOR_0 8
|
||||
#define GET_SET_INTERFACE 6
|
||||
#define GET_SET_CONFIGURATION 5
|
||||
#define GET_CONFIGURATION_DESCRIPTOR 4
|
||||
#define GET_DEVICE_DESCRIPTOR 3
|
||||
#define GET_ENDPOINT_STATUS 2
|
||||
#define GET_INTERFACE_STATUS 1
|
||||
#define GET_DEVICE_STATUS 0
|
||||
u32 prodvendid;
|
||||
#define PRODUCT_ID 16
|
||||
#define VENDOR_ID 0
|
||||
u32 relnum;
|
||||
u32 usbctl;
|
||||
#define SERIAL_NUMBER_INDEX 16
|
||||
#define PRODUCT_ID_STRING_ENABLE 13
|
||||
#define VENDOR_ID_STRING_ENABLE 12
|
||||
#define USB_ROOT_PORT_WAKEUP_ENABLE 11
|
||||
#define VBUS_PIN 10
|
||||
#define TIMED_DISCONNECT 9
|
||||
#define SUSPEND_IMMEDIATELY 7
|
||||
#define SELF_POWERED_USB_DEVICE 6
|
||||
#define REMOTE_WAKEUP_SUPPORT 5
|
||||
#define PME_POLARITY 4
|
||||
#define USB_DETECT_ENABLE 3
|
||||
#define PME_WAKEUP_ENABLE 2
|
||||
#define DEVICE_REMOTE_WAKEUP_ENABLE 1
|
||||
#define SELF_POWERED_STATUS 0
|
||||
// offset 0x0090
|
||||
u32 usbstat;
|
||||
#define HIGH_SPEED 7
|
||||
#define FULL_SPEED 6
|
||||
#define GENERATE_RESUME 5
|
||||
#define GENERATE_DEVICE_REMOTE_WAKEUP 4
|
||||
u32 xcvrdiag;
|
||||
#define FORCE_HIGH_SPEED_MODE 31
|
||||
#define FORCE_FULL_SPEED_MODE 30
|
||||
#define USB_TEST_MODE 24
|
||||
#define LINE_STATE 16
|
||||
#define TRANSCEIVER_OPERATION_MODE 2
|
||||
#define TRANSCEIVER_SELECT 1
|
||||
#define TERMINATION_SELECT 0
|
||||
u32 setup0123;
|
||||
u32 setup4567;
|
||||
// offset 0x0090
|
||||
u32 _unused0;
|
||||
u32 ouraddr;
|
||||
#define FORCE_IMMEDIATE 7
|
||||
#define OUR_USB_ADDRESS 0
|
||||
u32 ourconfig;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* pci control, BAR0 + 0x0100 */
|
||||
struct net2280_pci_regs {
|
||||
// offset 0x0100
|
||||
u32 pcimstctl;
|
||||
#define PCI_ARBITER_PARK_SELECT 13
|
||||
#define PCI_MULTI LEVEL_ARBITER 12
|
||||
#define PCI_RETRY_ABORT_ENABLE 11
|
||||
#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10
|
||||
#define DMA_READ_MULTIPLE_ENABLE 9
|
||||
#define DMA_READ_LINE_ENABLE 8
|
||||
#define PCI_MASTER_COMMAND_SELECT 6
|
||||
#define MEM_READ_OR_WRITE 0
|
||||
#define IO_READ_OR_WRITE 1
|
||||
#define CFG_READ_OR_WRITE 2
|
||||
#define PCI_MASTER_START 5
|
||||
#define PCI_MASTER_READ_WRITE 4
|
||||
#define PCI_MASTER_WRITE 0
|
||||
#define PCI_MASTER_READ 1
|
||||
#define PCI_MASTER_BYTE_WRITE_ENABLES 0
|
||||
u32 pcimstaddr;
|
||||
u32 pcimstdata;
|
||||
u32 pcimststat;
|
||||
#define PCI_ARBITER_CLEAR 2
|
||||
#define PCI_EXTERNAL_ARBITER 1
|
||||
#define PCI_HOST_MODE 0
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* dma control, BAR0 + 0x0180 ... array of four structs like this,
|
||||
* for channels 0..3. see also struct net2280_dma: descriptor
|
||||
* that can be loaded into some of these registers.
|
||||
*/
|
||||
struct net2280_dma_regs { /* [11.7] */
|
||||
// offset 0x0180, 0x01a0, 0x01c0, 0x01e0,
|
||||
u32 dmactl;
|
||||
#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
|
||||
#define DMA_CLEAR_COUNT_ENABLE 21
|
||||
#define DESCRIPTOR_POLLING_RATE 19
|
||||
#define POLL_CONTINUOUS 0
|
||||
#define POLL_1_USEC 1
|
||||
#define POLL_100_USEC 2
|
||||
#define POLL_1_MSEC 3
|
||||
#define DMA_VALID_BIT_POLLING_ENABLE 18
|
||||
#define DMA_VALID_BIT_ENABLE 17
|
||||
#define DMA_SCATTER_GATHER_ENABLE 16
|
||||
#define DMA_OUT_AUTO_START_ENABLE 4
|
||||
#define DMA_PREEMPT_ENABLE 3
|
||||
#define DMA_FIFO_VALIDATE 2
|
||||
#define DMA_ENABLE 1
|
||||
#define DMA_ADDRESS_HOLD 0
|
||||
u32 dmastat;
|
||||
#define DMA_ABORT_DONE_INTERRUPT 27
|
||||
#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25
|
||||
#define DMA_TRANSACTION_DONE_INTERRUPT 24
|
||||
#define DMA_ABORT 1
|
||||
#define DMA_START 0
|
||||
u32 _unused0 [2];
|
||||
// offset 0x0190, 0x01b0, 0x01d0, 0x01f0,
|
||||
u32 dmacount;
|
||||
#define VALID_BIT 31
|
||||
#define DMA_DIRECTION 30
|
||||
#define DMA_DONE_INTERRUPT_ENABLE 29
|
||||
#define END_OF_CHAIN 28
|
||||
#define DMA_BYTE_COUNT_MASK ((1<<24)-1)
|
||||
#define DMA_BYTE_COUNT 0
|
||||
u32 dmaaddr;
|
||||
u32 dmadesc;
|
||||
u32 _unused1;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* dedicated endpoint registers, BAR0 + 0x0200 */
|
||||
|
||||
struct net2280_dep_regs { /* [11.8] */
|
||||
// offset 0x0200, 0x0210, 0x220, 0x230, 0x240
|
||||
u32 dep_cfg;
|
||||
// offset 0x0204, 0x0214, 0x224, 0x234, 0x244
|
||||
u32 dep_rsp;
|
||||
u32 _unused [2];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
|
||||
* like this, for ep0 then the configurable endpoints A..F
|
||||
* ep0 reserved for control; E and F have only 64 bytes of fifo
|
||||
*/
|
||||
struct net2280_ep_regs { /* [11.9] */
|
||||
// offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0
|
||||
u32 ep_cfg;
|
||||
#define ENDPOINT_BYTE_COUNT 16
|
||||
#define ENDPOINT_ENABLE 10
|
||||
#define ENDPOINT_TYPE 8
|
||||
#define ENDPOINT_DIRECTION 7
|
||||
#define ENDPOINT_NUMBER 0
|
||||
u32 ep_rsp;
|
||||
#define SET_NAK_OUT_PACKETS 15
|
||||
#define SET_EP_HIDE_STATUS_PHASE 14
|
||||
#define SET_EP_FORCE_CRC_ERROR 13
|
||||
#define SET_INTERRUPT_MODE 12
|
||||
#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11
|
||||
#define SET_NAK_OUT_PACKETS_MODE 10
|
||||
#define SET_ENDPOINT_TOGGLE 9
|
||||
#define SET_ENDPOINT_HALT 8
|
||||
#define CLEAR_NAK_OUT_PACKETS 7
|
||||
#define CLEAR_EP_HIDE_STATUS_PHASE 6
|
||||
#define CLEAR_EP_FORCE_CRC_ERROR 5
|
||||
#define CLEAR_INTERRUPT_MODE 4
|
||||
#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3
|
||||
#define CLEAR_NAK_OUT_PACKETS_MODE 2
|
||||
#define CLEAR_ENDPOINT_TOGGLE 1
|
||||
#define CLEAR_ENDPOINT_HALT 0
|
||||
u32 ep_irqenb;
|
||||
#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6
|
||||
#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5
|
||||
#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3
|
||||
#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2
|
||||
#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1
|
||||
#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0
|
||||
u32 ep_stat;
|
||||
#define FIFO_VALID_COUNT 24
|
||||
#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22
|
||||
#define TIMEOUT 21
|
||||
#define USB_STALL_SENT 20
|
||||
#define USB_IN_NAK_SENT 19
|
||||
#define USB_IN_ACK_RCVD 18
|
||||
#define USB_OUT_PING_NAK_SENT 17
|
||||
#define USB_OUT_ACK_SENT 16
|
||||
#define FIFO_OVERFLOW 13
|
||||
#define FIFO_UNDERFLOW 12
|
||||
#define FIFO_FULL 11
|
||||
#define FIFO_EMPTY 10
|
||||
#define FIFO_FLUSH 9
|
||||
#define SHORT_PACKET_OUT_DONE_INTERRUPT 6
|
||||
#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5
|
||||
#define NAK_OUT_PACKETS 4
|
||||
#define DATA_PACKET_RECEIVED_INTERRUPT 3
|
||||
#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
|
||||
#define DATA_OUT_PING_TOKEN_INTERRUPT 1
|
||||
#define DATA_IN_TOKEN_INTERRUPT 0
|
||||
// offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0
|
||||
u32 ep_avail;
|
||||
u32 ep_data;
|
||||
u32 _unused0 [2];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif /* __LINUX_USB_NET2280_H */
|
||||
131
include/linux/usb/otg.h
Normal file
131
include/linux/usb/otg.h
Normal file
@@ -0,0 +1,131 @@
|
||||
// include/linux/usb/otg.h
|
||||
|
||||
/*
|
||||
* These APIs may be used between USB controllers. USB device drivers
|
||||
* (for either host or peripheral roles) don't use these calls; they
|
||||
* continue to use just usb_device and usb_gadget.
|
||||
*/
|
||||
|
||||
|
||||
/* OTG defines lots of enumeration states before device reset */
|
||||
enum usb_otg_state {
|
||||
OTG_STATE_UNDEFINED = 0,
|
||||
|
||||
/* single-role peripheral, and dual-role default-b */
|
||||
OTG_STATE_B_IDLE,
|
||||
OTG_STATE_B_SRP_INIT,
|
||||
OTG_STATE_B_PERIPHERAL,
|
||||
|
||||
/* extra dual-role default-b states */
|
||||
OTG_STATE_B_WAIT_ACON,
|
||||
OTG_STATE_B_HOST,
|
||||
|
||||
/* dual-role default-a */
|
||||
OTG_STATE_A_IDLE,
|
||||
OTG_STATE_A_WAIT_VRISE,
|
||||
OTG_STATE_A_WAIT_BCON,
|
||||
OTG_STATE_A_HOST,
|
||||
OTG_STATE_A_SUSPEND,
|
||||
OTG_STATE_A_PERIPHERAL,
|
||||
OTG_STATE_A_WAIT_VFALL,
|
||||
OTG_STATE_A_VBUS_ERR,
|
||||
};
|
||||
|
||||
/*
|
||||
* the otg driver needs to interact with both device side and host side
|
||||
* usb controllers. it decides which controller is active at a given
|
||||
* moment, using the transceiver, ID signal, HNP and sometimes static
|
||||
* configuration information (including "board isn't wired for otg").
|
||||
*/
|
||||
struct otg_transceiver {
|
||||
struct device *dev;
|
||||
const char *label;
|
||||
|
||||
u8 default_a;
|
||||
enum usb_otg_state state;
|
||||
|
||||
struct usb_bus *host;
|
||||
struct usb_gadget *gadget;
|
||||
|
||||
/* to pass extra port status to the root hub */
|
||||
u16 port_status;
|
||||
u16 port_change;
|
||||
|
||||
/* bind/unbind the host controller */
|
||||
int (*set_host)(struct otg_transceiver *otg,
|
||||
struct usb_bus *host);
|
||||
|
||||
/* bind/unbind the peripheral controller */
|
||||
int (*set_peripheral)(struct otg_transceiver *otg,
|
||||
struct usb_gadget *gadget);
|
||||
|
||||
/* effective for B devices, ignored for A-peripheral */
|
||||
int (*set_power)(struct otg_transceiver *otg,
|
||||
unsigned mA);
|
||||
|
||||
/* for non-OTG B devices: set transceiver into suspend mode */
|
||||
int (*set_suspend)(struct otg_transceiver *otg,
|
||||
int suspend);
|
||||
|
||||
/* for B devices only: start session with A-Host */
|
||||
int (*start_srp)(struct otg_transceiver *otg);
|
||||
|
||||
/* start or continue HNP role switch */
|
||||
int (*start_hnp)(struct otg_transceiver *otg);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* for board-specific init logic */
|
||||
extern int otg_set_transceiver(struct otg_transceiver *);
|
||||
|
||||
|
||||
/* for usb host and peripheral controller drivers */
|
||||
extern struct otg_transceiver *otg_get_transceiver(void);
|
||||
|
||||
static inline int
|
||||
otg_start_hnp(struct otg_transceiver *otg)
|
||||
{
|
||||
return otg->start_hnp(otg);
|
||||
}
|
||||
|
||||
|
||||
/* for HCDs */
|
||||
static inline int
|
||||
otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
|
||||
{
|
||||
return otg->set_host(otg, host);
|
||||
}
|
||||
|
||||
|
||||
/* for usb peripheral controller drivers */
|
||||
static inline int
|
||||
otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
|
||||
{
|
||||
return otg->set_peripheral(otg, periph);
|
||||
}
|
||||
|
||||
static inline int
|
||||
otg_set_power(struct otg_transceiver *otg, unsigned mA)
|
||||
{
|
||||
return otg->set_power(otg, mA);
|
||||
}
|
||||
|
||||
static inline int
|
||||
otg_set_suspend(struct otg_transceiver *otg, int suspend)
|
||||
{
|
||||
if (otg->set_suspend != NULL)
|
||||
return otg->set_suspend(otg, suspend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
otg_start_srp(struct otg_transceiver *otg)
|
||||
{
|
||||
return otg->start_srp(otg);
|
||||
}
|
||||
|
||||
|
||||
/* for OTG controller drivers (and maybe other stuff) */
|
||||
extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
|
||||
11
include/linux/usb/quirks.h
Normal file
11
include/linux/usb/quirks.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file holds the definitions of quirks found in USB devices.
|
||||
* Only quirks that affect the whole device, not an interface,
|
||||
* belong here.
|
||||
*/
|
||||
|
||||
/* device must not be autosuspended */
|
||||
#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
|
||||
|
||||
/* string descriptors must not be fetched using a 255-byte read */
|
||||
#define USB_QUIRK_STRING_FETCH_255 0x00000002
|
||||
311
include/linux/usb/serial.h
Normal file
311
include/linux/usb/serial.h
Normal file
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* USB Serial Converter stuff
|
||||
*
|
||||
* Copyright (C) 1999 - 2005
|
||||
* Greg Kroah-Hartman (greg@kroah.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LINUX_USB_SERIAL_H
|
||||
#define __LINUX_USB_SERIAL_H
|
||||
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
|
||||
#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
|
||||
|
||||
#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */
|
||||
|
||||
/* parity check flag */
|
||||
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
|
||||
|
||||
/**
|
||||
* usb_serial_port: structure for the specific ports of a device.
|
||||
* @serial: pointer back to the struct usb_serial owner of this port.
|
||||
* @tty: pointer to the corresponding tty for this port.
|
||||
* @lock: spinlock to grab when updating portions of this structure.
|
||||
* @mutex: mutex used to synchronize serial_open() and serial_close()
|
||||
* access for this port.
|
||||
* @number: the number of the port (the minor number).
|
||||
* @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
|
||||
* @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
|
||||
* @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
|
||||
* for this port.
|
||||
* @interrupt_out_buffer: pointer to the interrupt out buffer for this port.
|
||||
* @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
|
||||
* @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
|
||||
* @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
|
||||
* for this port.
|
||||
* @bulk_in_buffer: pointer to the bulk in buffer for this port.
|
||||
* @read_urb: pointer to the bulk in struct urb for this port.
|
||||
* @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
|
||||
* port.
|
||||
* @bulk_out_buffer: pointer to the bulk out buffer for this port.
|
||||
* @bulk_out_size: the size of the bulk_out_buffer, in bytes.
|
||||
* @write_urb: pointer to the bulk out struct urb for this port.
|
||||
* @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
|
||||
* port.
|
||||
* @write_wait: a wait_queue_head_t used by the port.
|
||||
* @work: work queue entry for the line discipline waking up.
|
||||
* @open_count: number of times this port has been opened.
|
||||
* @throttled: nonzero if the read urb is inactive to throttle the device
|
||||
* @throttle_req: nonzero if the tty wants to throttle us
|
||||
*
|
||||
* This structure is used by the usb-serial core and drivers for the specific
|
||||
* ports of a device.
|
||||
*/
|
||||
struct usb_serial_port {
|
||||
struct usb_serial * serial;
|
||||
struct tty_struct * tty;
|
||||
spinlock_t lock;
|
||||
struct mutex mutex;
|
||||
unsigned char number;
|
||||
|
||||
unsigned char * interrupt_in_buffer;
|
||||
struct urb * interrupt_in_urb;
|
||||
__u8 interrupt_in_endpointAddress;
|
||||
|
||||
unsigned char * interrupt_out_buffer;
|
||||
int interrupt_out_size;
|
||||
struct urb * interrupt_out_urb;
|
||||
__u8 interrupt_out_endpointAddress;
|
||||
|
||||
unsigned char * bulk_in_buffer;
|
||||
int bulk_in_size;
|
||||
struct urb * read_urb;
|
||||
__u8 bulk_in_endpointAddress;
|
||||
|
||||
unsigned char * bulk_out_buffer;
|
||||
int bulk_out_size;
|
||||
struct urb * write_urb;
|
||||
int write_urb_busy;
|
||||
__u8 bulk_out_endpointAddress;
|
||||
|
||||
wait_queue_head_t write_wait;
|
||||
struct work_struct work;
|
||||
int open_count;
|
||||
char throttled;
|
||||
char throttle_req;
|
||||
struct device dev;
|
||||
};
|
||||
#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
|
||||
|
||||
/* get and set the port private data pointer helper functions */
|
||||
static inline void *usb_get_serial_port_data (struct usb_serial_port *port)
|
||||
{
|
||||
return dev_get_drvdata(&port->dev);
|
||||
}
|
||||
|
||||
static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data)
|
||||
{
|
||||
dev_set_drvdata(&port->dev, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_serial - structure used by the usb-serial core for a device
|
||||
* @dev: pointer to the struct usb_device for this device
|
||||
* @type: pointer to the struct usb_serial_driver for this device
|
||||
* @interface: pointer to the struct usb_interface for this device
|
||||
* @minor: the starting minor number for this device
|
||||
* @num_ports: the number of ports this device has
|
||||
* @num_interrupt_in: number of interrupt in endpoints we have
|
||||
* @num_interrupt_out: number of interrupt out endpoints we have
|
||||
* @num_bulk_in: number of bulk in endpoints we have
|
||||
* @num_bulk_out: number of bulk out endpoints we have
|
||||
* @port: array of struct usb_serial_port structures for the different ports.
|
||||
* @private: place to put any driver specific information that is needed. The
|
||||
* usb-serial driver is required to manage this data, the usb-serial core
|
||||
* will not touch this. Use usb_get_serial_data() and
|
||||
* usb_set_serial_data() to access this.
|
||||
*/
|
||||
struct usb_serial {
|
||||
struct usb_device * dev;
|
||||
struct usb_serial_driver * type;
|
||||
struct usb_interface * interface;
|
||||
unsigned char minor;
|
||||
unsigned char num_ports;
|
||||
unsigned char num_port_pointers;
|
||||
char num_interrupt_in;
|
||||
char num_interrupt_out;
|
||||
char num_bulk_in;
|
||||
char num_bulk_out;
|
||||
struct usb_serial_port * port[MAX_NUM_PORTS];
|
||||
struct kref kref;
|
||||
void * private;
|
||||
};
|
||||
#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
|
||||
|
||||
#define NUM_DONT_CARE (-1)
|
||||
|
||||
/* get and set the serial private data pointer helper functions */
|
||||
static inline void *usb_get_serial_data (struct usb_serial *serial)
|
||||
{
|
||||
return serial->private;
|
||||
}
|
||||
|
||||
static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
|
||||
{
|
||||
serial->private = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* usb_serial_driver - describes a usb serial driver
|
||||
* @description: pointer to a string that describes this driver. This string used
|
||||
* in the syslog messages when a device is inserted or removed.
|
||||
* @id_table: pointer to a list of usb_device_id structures that define all
|
||||
* of the devices this structure can support.
|
||||
* @num_interrupt_in: the number of interrupt in endpoints this device will
|
||||
* have.
|
||||
* @num_interrupt_out: the number of interrupt out endpoints this device will
|
||||
* have.
|
||||
* @num_bulk_in: the number of bulk in endpoints this device will have.
|
||||
* @num_bulk_out: the number of bulk out endpoints this device will have.
|
||||
* @num_ports: the number of different ports this device will have.
|
||||
* @calc_num_ports: pointer to a function to determine how many ports this
|
||||
* device has dynamically. It will be called after the probe()
|
||||
* callback is called, but before attach()
|
||||
* @probe: pointer to the driver's probe function.
|
||||
* This will be called when the device is inserted into the system,
|
||||
* but before the device has been fully initialized by the usb_serial
|
||||
* subsystem. Use this function to download any firmware to the device,
|
||||
* or any other early initialization that might be needed.
|
||||
* Return 0 to continue on with the initialization sequence. Anything
|
||||
* else will abort it.
|
||||
* @attach: pointer to the driver's attach function.
|
||||
* This will be called when the struct usb_serial structure is fully set
|
||||
* set up. Do any local initialization of the device, or any private
|
||||
* memory structure allocation at this point in time.
|
||||
* @shutdown: pointer to the driver's shutdown function. This will be
|
||||
* called when the device is removed from the system.
|
||||
* @usb_driver: pointer to the struct usb_driver that controls this
|
||||
* device. This is necessary to allow dynamic ids to be added to
|
||||
* the driver from sysfs.
|
||||
*
|
||||
* This structure is defines a USB Serial driver. It provides all of
|
||||
* the information that the USB serial core code needs. If the function
|
||||
* pointers are defined, then the USB serial core code will call them when
|
||||
* the corresponding tty port functions are called. If they are not
|
||||
* called, the generic serial function will be used instead.
|
||||
*
|
||||
* The driver.owner field should be set to the module owner of this driver.
|
||||
* The driver.name field should be set to the name of this driver (remember
|
||||
* it will show up in sysfs, so it needs to be short and to the point.
|
||||
* Useing the module name is a good idea.)
|
||||
*/
|
||||
struct usb_serial_driver {
|
||||
const char *description;
|
||||
const struct usb_device_id *id_table;
|
||||
char num_interrupt_in;
|
||||
char num_interrupt_out;
|
||||
char num_bulk_in;
|
||||
char num_bulk_out;
|
||||
char num_ports;
|
||||
|
||||
struct list_head driver_list;
|
||||
struct device_driver driver;
|
||||
struct usb_driver *usb_driver;
|
||||
struct usb_dynids dynids;
|
||||
|
||||
int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
|
||||
int (*attach) (struct usb_serial *serial);
|
||||
int (*calc_num_ports) (struct usb_serial *serial);
|
||||
|
||||
void (*shutdown) (struct usb_serial *serial);
|
||||
|
||||
int (*port_probe) (struct usb_serial_port *port);
|
||||
int (*port_remove) (struct usb_serial_port *port);
|
||||
|
||||
/* serial function calls */
|
||||
int (*open) (struct usb_serial_port *port, struct file * filp);
|
||||
void (*close) (struct usb_serial_port *port, struct file * filp);
|
||||
int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count);
|
||||
int (*write_room) (struct usb_serial_port *port);
|
||||
int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
|
||||
void (*set_termios) (struct usb_serial_port *port, struct ktermios * old);
|
||||
void (*break_ctl) (struct usb_serial_port *port, int break_state);
|
||||
int (*chars_in_buffer) (struct usb_serial_port *port);
|
||||
void (*throttle) (struct usb_serial_port *port);
|
||||
void (*unthrottle) (struct usb_serial_port *port);
|
||||
int (*tiocmget) (struct usb_serial_port *port, struct file *file);
|
||||
int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
|
||||
|
||||
void (*read_int_callback)(struct urb *urb);
|
||||
void (*write_int_callback)(struct urb *urb);
|
||||
void (*read_bulk_callback)(struct urb *urb);
|
||||
void (*write_bulk_callback)(struct urb *urb);
|
||||
};
|
||||
#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver)
|
||||
|
||||
extern int usb_serial_register(struct usb_serial_driver *driver);
|
||||
extern void usb_serial_deregister(struct usb_serial_driver *driver);
|
||||
extern void usb_serial_port_softint(struct usb_serial_port *port);
|
||||
|
||||
extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
|
||||
extern void usb_serial_disconnect(struct usb_interface *iface);
|
||||
|
||||
extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
|
||||
extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
|
||||
|
||||
/* USB Serial console functions */
|
||||
#ifdef CONFIG_USB_SERIAL_CONSOLE
|
||||
extern void usb_serial_console_init (int debug, int minor);
|
||||
extern void usb_serial_console_exit (void);
|
||||
extern void usb_serial_console_disconnect(struct usb_serial *serial);
|
||||
#else
|
||||
static inline void usb_serial_console_init (int debug, int minor) { }
|
||||
static inline void usb_serial_console_exit (void) { }
|
||||
static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
|
||||
#endif
|
||||
|
||||
/* Functions needed by other parts of the usbserial core */
|
||||
extern struct usb_serial *usb_serial_get_by_index (unsigned int minor);
|
||||
extern void usb_serial_put(struct usb_serial *serial);
|
||||
extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp);
|
||||
extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count);
|
||||
extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp);
|
||||
extern int usb_serial_generic_write_room (struct usb_serial_port *port);
|
||||
extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
|
||||
extern void usb_serial_generic_read_bulk_callback (struct urb *urb);
|
||||
extern void usb_serial_generic_write_bulk_callback (struct urb *urb);
|
||||
extern void usb_serial_generic_throttle (struct usb_serial_port *port);
|
||||
extern void usb_serial_generic_unthrottle (struct usb_serial_port *port);
|
||||
extern void usb_serial_generic_shutdown (struct usb_serial *serial);
|
||||
extern int usb_serial_generic_register (int debug);
|
||||
extern void usb_serial_generic_deregister (void);
|
||||
|
||||
extern int usb_serial_bus_register (struct usb_serial_driver *device);
|
||||
extern void usb_serial_bus_deregister (struct usb_serial_driver *device);
|
||||
|
||||
extern struct usb_serial_driver usb_serial_generic_device;
|
||||
extern struct bus_type usb_serial_bus_type;
|
||||
extern struct tty_driver *usb_serial_tty_driver;
|
||||
|
||||
static inline void usb_serial_debug_data(int debug,
|
||||
struct device *dev,
|
||||
const char *function, int size,
|
||||
const unsigned char *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (debug) {
|
||||
dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
|
||||
for (i = 0; i < size; ++i)
|
||||
printk ("%.2x ", data[i]);
|
||||
printk ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Use our own dbg macro */
|
||||
#undef dbg
|
||||
#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)
|
||||
|
||||
|
||||
|
||||
#endif /* ifdef __LINUX_USB_SERIAL_H */
|
||||
|
||||
26
include/linux/usb/sl811.h
Normal file
26
include/linux/usb/sl811.h
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
/*
|
||||
* board initialization should put one of these into dev->platform_data
|
||||
* and place the sl811hs onto platform_bus named "sl811-hcd".
|
||||
*/
|
||||
|
||||
struct sl811_platform_data {
|
||||
unsigned can_wakeup:1;
|
||||
|
||||
/* given port_power, msec/2 after power on till power good */
|
||||
u8 potpg;
|
||||
|
||||
/* mA/2 power supplied on this port (max = default = 250) */
|
||||
u8 power;
|
||||
|
||||
/* sl811 relies on an external source of VBUS current */
|
||||
void (*port_power)(struct device *dev, int is_on);
|
||||
|
||||
/* pulse sl811 nRST (probably with a GPIO) */
|
||||
void (*reset)(struct device *dev);
|
||||
|
||||
// some boards need something like these:
|
||||
// int (*check_overcurrent)(struct device *dev);
|
||||
// void (*clock_enable)(struct device *dev, int is_on);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user