USB: fix codingstyle issues in include/linux/usb/
Fixes a number of coding style issues in the USB public header files. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
969ab2ee9d
commit
41dceed51f
|
@ -27,13 +27,13 @@
|
||||||
|
|
||||||
/* 4.3.2 Class-Specific AC Interface Descriptor */
|
/* 4.3.2 Class-Specific AC Interface Descriptor */
|
||||||
struct usb_ac_header_descriptor {
|
struct usb_ac_header_descriptor {
|
||||||
__u8 bLength; // 8+n
|
__u8 bLength; /* 8+n */
|
||||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
__u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
|
||||||
__u8 bDescriptorSubtype; // USB_MS_HEADER
|
__u8 bDescriptorSubtype; /* USB_MS_HEADER */
|
||||||
__le16 bcdADC; // 0x0100
|
__le16 bcdADC; /* 0x0100 */
|
||||||
__le16 wTotalLength; // includes Unit and Terminal desc.
|
__le16 wTotalLength; /* includes Unit and Terminal desc. */
|
||||||
__u8 bInCollection; // n
|
__u8 bInCollection; /* n */
|
||||||
__u8 baInterfaceNr[]; // [n]
|
__u8 baInterfaceNr[]; /* [n] */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
|
#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
|
||||||
|
|
|
@ -29,16 +29,16 @@
|
||||||
* Class-Specific descriptors ... there are a couple dozen of them
|
* Class-Specific descriptors ... there are a couple dozen of them
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
|
#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
|
||||||
#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
|
#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
|
||||||
#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
|
#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
|
||||||
#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
|
#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
|
||||||
#define USB_CDC_COUNTRY_TYPE 0x07
|
#define USB_CDC_COUNTRY_TYPE 0x07
|
||||||
#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
|
#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
|
||||||
#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
|
#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
|
||||||
#define USB_CDC_WHCM_TYPE 0x11
|
#define USB_CDC_WHCM_TYPE 0x11
|
||||||
#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
|
#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
|
||||||
#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
|
#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
|
||||||
#define USB_CDC_DMM_TYPE 0x14
|
#define USB_CDC_DMM_TYPE 0x14
|
||||||
#define USB_CDC_OBEX_TYPE 0x15
|
#define USB_CDC_OBEX_TYPE 0x15
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,10 @@ struct usb_ep;
|
||||||
*
|
*
|
||||||
* Bulk endpoints can use any size buffers, and can also be used for interrupt
|
* Bulk endpoints can use any size buffers, and can also be used for interrupt
|
||||||
* transfers. interrupt-only endpoints can be much less functional.
|
* transfers. interrupt-only endpoints can be much less functional.
|
||||||
|
*
|
||||||
|
* NOTE: this is analagous to 'struct urb' on the host side, except that
|
||||||
|
* it's thinner and promotes more pre-allocation.
|
||||||
*/
|
*/
|
||||||
// NOTE this is analagous to 'struct urb' on the host side,
|
|
||||||
// except that it's thinner and promotes more pre-allocation.
|
|
||||||
|
|
||||||
struct usb_request {
|
struct usb_request {
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -168,10 +169,10 @@ struct usb_ep {
|
||||||
*
|
*
|
||||||
* returns zero, or a negative error code.
|
* returns zero, or a negative error code.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_enable(struct usb_ep *ep,
|
||||||
usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
|
const struct usb_endpoint_descriptor *desc)
|
||||||
{
|
{
|
||||||
return ep->ops->enable (ep, desc);
|
return ep->ops->enable(ep, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,10 +187,9 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
|
||||||
*
|
*
|
||||||
* returns zero, or a negative error code.
|
* returns zero, or a negative error code.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_disable(struct usb_ep *ep)
|
||||||
usb_ep_disable (struct usb_ep *ep)
|
|
||||||
{
|
{
|
||||||
return ep->ops->disable (ep);
|
return ep->ops->disable(ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,10 +206,10 @@ usb_ep_disable (struct usb_ep *ep)
|
||||||
*
|
*
|
||||||
* Returns the request, or null if one could not be allocated.
|
* Returns the request, or null if one could not be allocated.
|
||||||
*/
|
*/
|
||||||
static inline struct usb_request *
|
static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
|
||||||
usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
|
gfp_t gfp_flags)
|
||||||
{
|
{
|
||||||
return ep->ops->alloc_request (ep, gfp_flags);
|
return ep->ops->alloc_request(ep, gfp_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,10 +221,10 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
|
||||||
* Caller guarantees the request is not queued, and that it will
|
* Caller guarantees the request is not queued, and that it will
|
||||||
* no longer be requeued (or otherwise used).
|
* no longer be requeued (or otherwise used).
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void usb_ep_free_request(struct usb_ep *ep,
|
||||||
usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
|
struct usb_request *req)
|
||||||
{
|
{
|
||||||
ep->ops->free_request (ep, req);
|
ep->ops->free_request(ep, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,10 +281,10 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
|
||||||
* report errors; errors will also be
|
* report errors; errors will also be
|
||||||
* reported when the usb peripheral is disconnected.
|
* reported when the usb peripheral is disconnected.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_queue(struct usb_ep *ep,
|
||||||
usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
|
struct usb_request *req, gfp_t gfp_flags)
|
||||||
{
|
{
|
||||||
return ep->ops->queue (ep, req, gfp_flags);
|
return ep->ops->queue(ep, req, gfp_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,9 +301,9 @@ usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
|
||||||
* restrictions prevent drivers from supporting configuration changes,
|
* restrictions prevent drivers from supporting configuration changes,
|
||||||
* even to configuration zero (a "chapter 9" requirement).
|
* even to configuration zero (a "chapter 9" requirement).
|
||||||
*/
|
*/
|
||||||
static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
|
static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
|
||||||
{
|
{
|
||||||
return ep->ops->dequeue (ep, req);
|
return ep->ops->dequeue(ep, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -327,10 +327,9 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
|
||||||
* transfer requests are still queued, or if the controller hardware
|
* transfer requests are still queued, or if the controller hardware
|
||||||
* (usually a FIFO) still holds bytes that the host hasn't collected.
|
* (usually a FIFO) still holds bytes that the host hasn't collected.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_set_halt(struct usb_ep *ep)
|
||||||
usb_ep_set_halt (struct usb_ep *ep)
|
|
||||||
{
|
{
|
||||||
return ep->ops->set_halt (ep, 1);
|
return ep->ops->set_halt(ep, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,10 +345,9 @@ usb_ep_set_halt (struct usb_ep *ep)
|
||||||
* Note that some hardware can't support this request (like pxa2xx_udc),
|
* Note that some hardware can't support this request (like pxa2xx_udc),
|
||||||
* and accordingly can't correctly implement interface altsettings.
|
* and accordingly can't correctly implement interface altsettings.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_clear_halt(struct usb_ep *ep)
|
||||||
usb_ep_clear_halt (struct usb_ep *ep)
|
|
||||||
{
|
{
|
||||||
return ep->ops->set_halt (ep, 0);
|
return ep->ops->set_halt(ep, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,11 +365,10 @@ usb_ep_clear_halt (struct usb_ep *ep)
|
||||||
* errno if the endpoint doesn't use a FIFO or doesn't support such
|
* errno if the endpoint doesn't use a FIFO or doesn't support such
|
||||||
* precise handling.
|
* precise handling.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_ep_fifo_status(struct usb_ep *ep)
|
||||||
usb_ep_fifo_status (struct usb_ep *ep)
|
|
||||||
{
|
{
|
||||||
if (ep->ops->fifo_status)
|
if (ep->ops->fifo_status)
|
||||||
return ep->ops->fifo_status (ep);
|
return ep->ops->fifo_status(ep);
|
||||||
else
|
else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
@ -385,11 +382,10 @@ usb_ep_fifo_status (struct usb_ep *ep)
|
||||||
* must never be used except when endpoint is not being used for any
|
* must never be used except when endpoint is not being used for any
|
||||||
* protocol translation.
|
* protocol translation.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void usb_ep_fifo_flush(struct usb_ep *ep)
|
||||||
usb_ep_fifo_flush (struct usb_ep *ep)
|
|
||||||
{
|
{
|
||||||
if (ep->ops->fifo_flush)
|
if (ep->ops->fifo_flush)
|
||||||
ep->ops->fifo_flush (ep);
|
ep->ops->fifo_flush(ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,10 +465,10 @@ struct usb_gadget {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void set_gadget_data (struct usb_gadget *gadget, void *data)
|
static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
|
||||||
{ dev_set_drvdata (&gadget->dev, data); }
|
{ dev_set_drvdata(&gadget->dev, data); }
|
||||||
static inline void *get_gadget_data (struct usb_gadget *gadget)
|
static inline void *get_gadget_data(struct usb_gadget *gadget)
|
||||||
{ return dev_get_drvdata (&gadget->dev); }
|
{ return dev_get_drvdata(&gadget->dev); }
|
||||||
|
|
||||||
/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
|
/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
|
||||||
#define gadget_for_each_ep(tmp,gadget) \
|
#define gadget_for_each_ep(tmp,gadget) \
|
||||||
|
@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* usb_gadget_frame_number - returns the current frame number
|
* usb_gadget_frame_number - returns the current frame number
|
||||||
* @gadget: controller that reports the frame number
|
* @gadget: controller that reports the frame number
|
||||||
|
@ -519,9 +514,9 @@ static inline int gadget_is_otg(struct usb_gadget *g)
|
||||||
* Returns the usb frame number, normally eleven bits from a SOF packet,
|
* Returns the usb frame number, normally eleven bits from a SOF packet,
|
||||||
* or negative errno if this device doesn't support this capability.
|
* or negative errno if this device doesn't support this capability.
|
||||||
*/
|
*/
|
||||||
static inline int usb_gadget_frame_number (struct usb_gadget *gadget)
|
static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
|
||||||
{
|
{
|
||||||
return gadget->ops->get_frame (gadget);
|
return gadget->ops->get_frame(gadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,11 +532,11 @@ static inline int usb_gadget_frame_number (struct usb_gadget *gadget)
|
||||||
* even if OTG isn't otherwise in use. OTG devices may also start
|
* even if OTG isn't otherwise in use. OTG devices may also start
|
||||||
* remote wakeup even when hosts don't explicitly enable it.
|
* remote wakeup even when hosts don't explicitly enable it.
|
||||||
*/
|
*/
|
||||||
static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
|
static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
|
||||||
{
|
{
|
||||||
if (!gadget->ops->wakeup)
|
if (!gadget->ops->wakeup)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->wakeup (gadget);
|
return gadget->ops->wakeup(gadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -553,12 +548,11 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* returns zero on success, else negative errno.
|
* returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
|
||||||
usb_gadget_set_selfpowered (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->set_selfpowered)
|
if (!gadget->ops->set_selfpowered)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->set_selfpowered (gadget, 1);
|
return gadget->ops->set_selfpowered(gadget, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -571,12 +565,11 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* returns zero on success, else negative errno.
|
* returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
|
||||||
usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->set_selfpowered)
|
if (!gadget->ops->set_selfpowered)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->set_selfpowered (gadget, 0);
|
return gadget->ops->set_selfpowered(gadget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -591,12 +584,11 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* Returns zero on success, else negative errno.
|
* Returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
|
||||||
usb_gadget_vbus_connect(struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->vbus_session)
|
if (!gadget->ops->vbus_session)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->vbus_session (gadget, 1);
|
return gadget->ops->vbus_session(gadget, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -611,12 +603,11 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* Returns zero on success, else negative errno.
|
* Returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
|
||||||
usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->vbus_draw)
|
if (!gadget->ops->vbus_draw)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->vbus_draw (gadget, mA);
|
return gadget->ops->vbus_draw(gadget, mA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -629,12 +620,11 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
|
||||||
*
|
*
|
||||||
* Returns zero on success, else negative errno.
|
* Returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
|
||||||
usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->vbus_session)
|
if (!gadget->ops->vbus_session)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->vbus_session (gadget, 0);
|
return gadget->ops->vbus_session(gadget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -648,12 +638,11 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* Returns zero on success, else negative errno.
|
* Returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_connect(struct usb_gadget *gadget)
|
||||||
usb_gadget_connect (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->pullup)
|
if (!gadget->ops->pullup)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->pullup (gadget, 1);
|
return gadget->ops->pullup(gadget, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -671,16 +660,14 @@ usb_gadget_connect (struct usb_gadget *gadget)
|
||||||
*
|
*
|
||||||
* Returns zero on success, else negative errno.
|
* Returns zero on success, else negative errno.
|
||||||
*/
|
*/
|
||||||
static inline int
|
static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
|
||||||
usb_gadget_disconnect (struct usb_gadget *gadget)
|
|
||||||
{
|
{
|
||||||
if (!gadget->ops->pullup)
|
if (!gadget->ops->pullup)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return gadget->ops->pullup (gadget, 0);
|
return gadget->ops->pullup(gadget, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -764,7 +751,7 @@ struct usb_gadget_driver {
|
||||||
void (*suspend)(struct usb_gadget *);
|
void (*suspend)(struct usb_gadget *);
|
||||||
void (*resume)(struct usb_gadget *);
|
void (*resume)(struct usb_gadget *);
|
||||||
|
|
||||||
// FIXME support safe rmmod
|
/* FIXME support safe rmmod */
|
||||||
struct device_driver driver;
|
struct device_driver driver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -790,7 +777,7 @@ struct usb_gadget_driver {
|
||||||
* the bind() functions will be in init sections.
|
* the bind() functions will be in init sections.
|
||||||
* This function must be called in a context that can sleep.
|
* This function must be called in a context that can sleep.
|
||||||
*/
|
*/
|
||||||
int usb_gadget_register_driver (struct usb_gadget_driver *driver);
|
int usb_gadget_register_driver(struct usb_gadget_driver *driver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* usb_gadget_unregister_driver - unregister a gadget driver
|
* usb_gadget_unregister_driver - unregister a gadget driver
|
||||||
|
@ -805,7 +792,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver);
|
||||||
* will in in exit sections, so may not be linked in some kernels.
|
* will in in exit sections, so may not be linked in some kernels.
|
||||||
* This function must be called in a context that can sleep.
|
* This function must be called in a context that can sleep.
|
||||||
*/
|
*/
|
||||||
int usb_gadget_unregister_driver (struct usb_gadget_driver *driver);
|
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -838,7 +825,7 @@ struct usb_gadget_strings {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* put descriptor for string with that id into buf (buflen >= 256) */
|
/* put descriptor for string with that id into buf (buflen >= 256) */
|
||||||
int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf);
|
int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -856,10 +843,10 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
|
||||||
|
|
||||||
/* utility wrapping a simple endpoint selection policy */
|
/* utility wrapping a simple endpoint selection policy */
|
||||||
|
|
||||||
extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *,
|
extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
|
||||||
struct usb_endpoint_descriptor *) __devinit;
|
struct usb_endpoint_descriptor *) __devinit;
|
||||||
|
|
||||||
extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit;
|
extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type {
|
||||||
GADGETFS_DISCONNECT,
|
GADGETFS_DISCONNECT,
|
||||||
GADGETFS_SETUP,
|
GADGETFS_SETUP,
|
||||||
GADGETFS_SUSPEND,
|
GADGETFS_SUSPEND,
|
||||||
// and likely more !
|
/* and likely more ! */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NOTE: this structure must stay the same size and layout on
|
/* NOTE: this structure must stay the same size and layout on
|
||||||
|
@ -44,15 +44,17 @@ enum usb_gadgetfs_event_type {
|
||||||
*/
|
*/
|
||||||
struct usb_gadgetfs_event {
|
struct usb_gadgetfs_event {
|
||||||
union {
|
union {
|
||||||
// NOP, DISCONNECT, SUSPEND: nothing
|
/* NOP, DISCONNECT, SUSPEND: nothing
|
||||||
// ... some hardware can't report disconnection
|
* ... some hardware can't report disconnection
|
||||||
|
*/
|
||||||
|
|
||||||
// CONNECT: just the speed
|
/* CONNECT: just the speed */
|
||||||
enum usb_device_speed speed;
|
enum usb_device_speed speed;
|
||||||
|
|
||||||
// SETUP: packet; DATA phase i/o precedes next event
|
/* SETUP: packet; DATA phase i/o precedes next event
|
||||||
// (setup.bmRequestType & USB_DIR_IN) flags direction
|
*(setup.bmRequestType & USB_DIR_IN) flags direction
|
||||||
// ... includes SET_CONFIGURATION, SET_INTERFACE
|
* ... includes SET_CONFIGURATION, SET_INTERFACE
|
||||||
|
*/
|
||||||
struct usb_ctrlrequest setup;
|
struct usb_ctrlrequest setup;
|
||||||
} u;
|
} u;
|
||||||
enum usb_gadgetfs_event_type type;
|
enum usb_gadgetfs_event_type type;
|
||||||
|
@ -73,14 +75,14 @@ struct usb_gadgetfs_event {
|
||||||
* THIS returns how many bytes are "unclaimed" in the endpoint fifo
|
* THIS returns how many bytes are "unclaimed" in the endpoint fifo
|
||||||
* (needed for precise fault handling, when the hardware allows it)
|
* (needed for precise fault handling, when the hardware allows it)
|
||||||
*/
|
*/
|
||||||
#define GADGETFS_FIFO_STATUS _IO('g',1)
|
#define GADGETFS_FIFO_STATUS _IO('g', 1)
|
||||||
|
|
||||||
/* discards any unclaimed data in the fifo. */
|
/* discards any unclaimed data in the fifo. */
|
||||||
#define GADGETFS_FIFO_FLUSH _IO('g',2)
|
#define GADGETFS_FIFO_FLUSH _IO('g', 2)
|
||||||
|
|
||||||
/* resets endpoint halt+toggle; used to implement set_interface.
|
/* resets endpoint halt+toggle; used to implement set_interface.
|
||||||
* some hardware (like pxa2xx) can't support this.
|
* some hardware (like pxa2xx) can't support this.
|
||||||
*/
|
*/
|
||||||
#define GADGETFS_CLEAR_HALT _IO('g',3)
|
#define GADGETFS_CLEAR_HALT _IO('g', 3)
|
||||||
|
|
||||||
#endif /* __LINUX_USB_GADGETFS_H */
|
#endif /* __LINUX_USB_GADGETFS_H */
|
||||||
|
|
|
@ -14,14 +14,23 @@
|
||||||
this information.
|
this information.
|
||||||
*/
|
*/
|
||||||
struct iowarrior_info {
|
struct iowarrior_info {
|
||||||
__u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
|
/* 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) */
|
__u32 vendor;
|
||||||
__u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
|
/* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */
|
||||||
__u32 revision; /* revision number of the chip */
|
__u32 product;
|
||||||
__u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
|
/* the serial number of our chip (if a serial-number is not available
|
||||||
__u32 power; /* power consumption of the device in mA */
|
* this is empty string) */
|
||||||
__u32 if_num; /* the number of the endpoint */
|
__u8 serial[9];
|
||||||
__u32 report_size; /* size of the data-packets on this interface */
|
/* revision number of the chip */
|
||||||
|
__u32 revision;
|
||||||
|
/* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
|
||||||
|
__u32 speed;
|
||||||
|
/* power consumption of the device in mA */
|
||||||
|
__u32 power;
|
||||||
|
/* the number of the endpoint */
|
||||||
|
__u32 if_num;
|
||||||
|
/* size of the data-packets on this interface */
|
||||||
|
__u32 report_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -25,5 +25,5 @@ struct isp116x_platform_data {
|
||||||
300ns delay between access to ADDR_REG and DATA_REG
|
300ns delay between access to ADDR_REG and DATA_REG
|
||||||
OE, WE MUST NOT be changed during these intervals
|
OE, WE MUST NOT be changed during these intervals
|
||||||
*/
|
*/
|
||||||
void (*delay) (struct device * dev, int delay);
|
void (*delay) (struct device *dev, int delay);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,9 +47,9 @@ struct usb_ms_header_descriptor {
|
||||||
/* 6.1.2.2 MIDI IN Jack Descriptor */
|
/* 6.1.2.2 MIDI IN Jack Descriptor */
|
||||||
struct usb_midi_in_jack_descriptor {
|
struct usb_midi_in_jack_descriptor {
|
||||||
__u8 bLength;
|
__u8 bLength;
|
||||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
__u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
|
||||||
__u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
|
__u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */
|
||||||
__u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
|
__u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
|
||||||
__u8 bJackID;
|
__u8 bJackID;
|
||||||
__u8 iJack;
|
__u8 iJack;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
@ -64,12 +64,12 @@ struct usb_midi_source_pin {
|
||||||
/* 6.1.2.3 MIDI OUT Jack Descriptor */
|
/* 6.1.2.3 MIDI OUT Jack Descriptor */
|
||||||
struct usb_midi_out_jack_descriptor {
|
struct usb_midi_out_jack_descriptor {
|
||||||
__u8 bLength;
|
__u8 bLength;
|
||||||
__u8 bDescriptorType; // USB_DT_CS_INTERFACE
|
__u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
|
||||||
__u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
|
__u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */
|
||||||
__u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
|
__u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
|
||||||
__u8 bJackID;
|
__u8 bJackID;
|
||||||
__u8 bNrInputPins; // p
|
__u8 bNrInputPins; /* p */
|
||||||
struct usb_midi_source_pin pins[]; // [p]
|
struct usb_midi_source_pin pins[]; /* [p] */
|
||||||
/*__u8 iJack; -- ommitted due to variable-sized pins[] */
|
/*__u8 iJack; -- ommitted due to variable-sized pins[] */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p { \
|
||||||
|
|
||||||
/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
|
/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
|
||||||
struct usb_ms_endpoint_descriptor {
|
struct usb_ms_endpoint_descriptor {
|
||||||
__u8 bLength; // 4+n
|
__u8 bLength; /* 4+n */
|
||||||
__u8 bDescriptorType; // USB_DT_CS_ENDPOINT
|
__u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
|
||||||
__u8 bDescriptorSubtype; // USB_MS_GENERAL
|
__u8 bDescriptorSubtype; /* USB_MS_GENERAL */
|
||||||
__u8 bNumEmbMIDIJack; // n
|
__u8 bNumEmbMIDIJack; /* n */
|
||||||
__u8 baAssocJackID[]; // [n]
|
__u8 baAssocJackID[]; /* [n] */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
|
#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/* main registers, BAR0 + 0x0000 */
|
/* main registers, BAR0 + 0x0000 */
|
||||||
struct net2280_regs {
|
struct net2280_regs {
|
||||||
// offset 0x0000
|
/* offset 0x0000 */
|
||||||
u32 devinit;
|
u32 devinit;
|
||||||
#define LOCAL_CLOCK_FREQUENCY 8
|
#define LOCAL_CLOCK_FREQUENCY 8
|
||||||
#define FORCE_PCI_RESET 7
|
#define FORCE_PCI_RESET 7
|
||||||
|
@ -61,7 +61,7 @@ struct net2280_regs {
|
||||||
#define EEPROM_WRITE_DATA 0
|
#define EEPROM_WRITE_DATA 0
|
||||||
u32 eeclkfreq;
|
u32 eeclkfreq;
|
||||||
u32 _unused0;
|
u32 _unused0;
|
||||||
// offset 0x0010
|
/* offset 0x0010 */
|
||||||
|
|
||||||
u32 pciirqenb0; /* interrupt PCI master ... */
|
u32 pciirqenb0; /* interrupt PCI master ... */
|
||||||
#define SETUP_PACKET_INTERRUPT_ENABLE 7
|
#define SETUP_PACKET_INTERRUPT_ENABLE 7
|
||||||
|
@ -131,7 +131,7 @@ struct net2280_regs {
|
||||||
#define RESUME_INTERRUPT_ENABLE 1
|
#define RESUME_INTERRUPT_ENABLE 1
|
||||||
#define SOF_INTERRUPT_ENABLE 0
|
#define SOF_INTERRUPT_ENABLE 0
|
||||||
|
|
||||||
// offset 0x0020
|
/* offset 0x0020 */
|
||||||
u32 _unused1;
|
u32 _unused1;
|
||||||
u32 usbirqenb1;
|
u32 usbirqenb1;
|
||||||
#define USB_INTERRUPT_ENABLE 31
|
#define USB_INTERRUPT_ENABLE 31
|
||||||
|
@ -195,7 +195,7 @@ struct net2280_regs {
|
||||||
#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
|
#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
|
||||||
#define RESUME_INTERRUPT 1
|
#define RESUME_INTERRUPT 1
|
||||||
#define SOF_INTERRUPT 0
|
#define SOF_INTERRUPT 0
|
||||||
// offset 0x0030
|
/* offset 0x0030 */
|
||||||
u32 idxaddr;
|
u32 idxaddr;
|
||||||
u32 idxdata;
|
u32 idxdata;
|
||||||
u32 fifoctl;
|
u32 fifoctl;
|
||||||
|
@ -204,7 +204,7 @@ struct net2280_regs {
|
||||||
#define PCI_BASE2_SELECT 2
|
#define PCI_BASE2_SELECT 2
|
||||||
#define FIFO_CONFIGURATION_SELECT 0
|
#define FIFO_CONFIGURATION_SELECT 0
|
||||||
u32 _unused2;
|
u32 _unused2;
|
||||||
// offset 0x0040
|
/* offset 0x0040 */
|
||||||
u32 memaddr;
|
u32 memaddr;
|
||||||
#define START 28
|
#define START 28
|
||||||
#define DIRECTION 27
|
#define DIRECTION 27
|
||||||
|
@ -213,7 +213,7 @@ struct net2280_regs {
|
||||||
u32 memdata0;
|
u32 memdata0;
|
||||||
u32 memdata1;
|
u32 memdata1;
|
||||||
u32 _unused3;
|
u32 _unused3;
|
||||||
// offset 0x0050
|
/* offset 0x0050 */
|
||||||
u32 gpioctl;
|
u32 gpioctl;
|
||||||
#define GPIO3_LED_SELECT 12
|
#define GPIO3_LED_SELECT 12
|
||||||
#define GPIO3_INTERRUPT_ENABLE 11
|
#define GPIO3_INTERRUPT_ENABLE 11
|
||||||
|
@ -237,7 +237,7 @@ struct net2280_regs {
|
||||||
|
|
||||||
/* usb control, BAR0 + 0x0080 */
|
/* usb control, BAR0 + 0x0080 */
|
||||||
struct net2280_usb_regs {
|
struct net2280_usb_regs {
|
||||||
// offset 0x0080
|
/* offset 0x0080 */
|
||||||
u32 stdrsp;
|
u32 stdrsp;
|
||||||
#define STALL_UNSUPPORTED_REQUESTS 31
|
#define STALL_UNSUPPORTED_REQUESTS 31
|
||||||
#define SET_TEST_MODE 16
|
#define SET_TEST_MODE 16
|
||||||
|
@ -275,7 +275,7 @@ struct net2280_usb_regs {
|
||||||
#define PME_WAKEUP_ENABLE 2
|
#define PME_WAKEUP_ENABLE 2
|
||||||
#define DEVICE_REMOTE_WAKEUP_ENABLE 1
|
#define DEVICE_REMOTE_WAKEUP_ENABLE 1
|
||||||
#define SELF_POWERED_STATUS 0
|
#define SELF_POWERED_STATUS 0
|
||||||
// offset 0x0090
|
/* offset 0x0090 */
|
||||||
u32 usbstat;
|
u32 usbstat;
|
||||||
#define HIGH_SPEED 7
|
#define HIGH_SPEED 7
|
||||||
#define FULL_SPEED 6
|
#define FULL_SPEED 6
|
||||||
|
@ -291,7 +291,7 @@ struct net2280_usb_regs {
|
||||||
#define TERMINATION_SELECT 0
|
#define TERMINATION_SELECT 0
|
||||||
u32 setup0123;
|
u32 setup0123;
|
||||||
u32 setup4567;
|
u32 setup4567;
|
||||||
// offset 0x0090
|
/* offset 0x0090 */
|
||||||
u32 _unused0;
|
u32 _unused0;
|
||||||
u32 ouraddr;
|
u32 ouraddr;
|
||||||
#define FORCE_IMMEDIATE 7
|
#define FORCE_IMMEDIATE 7
|
||||||
|
@ -301,7 +301,7 @@ struct net2280_usb_regs {
|
||||||
|
|
||||||
/* pci control, BAR0 + 0x0100 */
|
/* pci control, BAR0 + 0x0100 */
|
||||||
struct net2280_pci_regs {
|
struct net2280_pci_regs {
|
||||||
// offset 0x0100
|
/* offset 0x0100 */
|
||||||
u32 pcimstctl;
|
u32 pcimstctl;
|
||||||
#define PCI_ARBITER_PARK_SELECT 13
|
#define PCI_ARBITER_PARK_SELECT 13
|
||||||
#define PCI_MULTI LEVEL_ARBITER 12
|
#define PCI_MULTI LEVEL_ARBITER 12
|
||||||
|
@ -331,7 +331,7 @@ struct net2280_pci_regs {
|
||||||
* that can be loaded into some of these registers.
|
* that can be loaded into some of these registers.
|
||||||
*/
|
*/
|
||||||
struct net2280_dma_regs { /* [11.7] */
|
struct net2280_dma_regs { /* [11.7] */
|
||||||
// offset 0x0180, 0x01a0, 0x01c0, 0x01e0,
|
/* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
|
||||||
u32 dmactl;
|
u32 dmactl;
|
||||||
#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
|
#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
|
||||||
#define DMA_CLEAR_COUNT_ENABLE 21
|
#define DMA_CLEAR_COUNT_ENABLE 21
|
||||||
|
@ -355,7 +355,7 @@ struct net2280_dma_regs { /* [11.7] */
|
||||||
#define DMA_ABORT 1
|
#define DMA_ABORT 1
|
||||||
#define DMA_START 0
|
#define DMA_START 0
|
||||||
u32 _unused0 [2];
|
u32 _unused0 [2];
|
||||||
// offset 0x0190, 0x01b0, 0x01d0, 0x01f0,
|
/* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
|
||||||
u32 dmacount;
|
u32 dmacount;
|
||||||
#define VALID_BIT 31
|
#define VALID_BIT 31
|
||||||
#define DMA_DIRECTION 30
|
#define DMA_DIRECTION 30
|
||||||
|
@ -371,9 +371,9 @@ struct net2280_dma_regs { /* [11.7] */
|
||||||
/* dedicated endpoint registers, BAR0 + 0x0200 */
|
/* dedicated endpoint registers, BAR0 + 0x0200 */
|
||||||
|
|
||||||
struct net2280_dep_regs { /* [11.8] */
|
struct net2280_dep_regs { /* [11.8] */
|
||||||
// offset 0x0200, 0x0210, 0x220, 0x230, 0x240
|
/* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
|
||||||
u32 dep_cfg;
|
u32 dep_cfg;
|
||||||
// offset 0x0204, 0x0214, 0x224, 0x234, 0x244
|
/* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
|
||||||
u32 dep_rsp;
|
u32 dep_rsp;
|
||||||
u32 _unused [2];
|
u32 _unused [2];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
@ -383,7 +383,7 @@ struct net2280_dep_regs { /* [11.8] */
|
||||||
* ep0 reserved for control; E and F have only 64 bytes of fifo
|
* ep0 reserved for control; E and F have only 64 bytes of fifo
|
||||||
*/
|
*/
|
||||||
struct net2280_ep_regs { /* [11.9] */
|
struct net2280_ep_regs { /* [11.9] */
|
||||||
// offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0
|
/* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
|
||||||
u32 ep_cfg;
|
u32 ep_cfg;
|
||||||
#define ENDPOINT_BYTE_COUNT 16
|
#define ENDPOINT_BYTE_COUNT 16
|
||||||
#define ENDPOINT_ENABLE 10
|
#define ENDPOINT_ENABLE 10
|
||||||
|
@ -435,7 +435,7 @@ struct net2280_ep_regs { /* [11.9] */
|
||||||
#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
|
#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
|
||||||
#define DATA_OUT_PING_TOKEN_INTERRUPT 1
|
#define DATA_OUT_PING_TOKEN_INTERRUPT 1
|
||||||
#define DATA_IN_TOKEN_INTERRUPT 0
|
#define DATA_IN_TOKEN_INTERRUPT 0
|
||||||
// offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0
|
/* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
|
||||||
u32 ep_avail;
|
u32 ep_avail;
|
||||||
u32 ep_data;
|
u32 ep_data;
|
||||||
u32 _unused0 [2];
|
u32 _unused0 [2];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// include/linux/usb/otg.h
|
/* USB OTG (On The Go) defines */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These APIs may be used between USB controllers. USB device drivers
|
* These APIs may be used between USB controllers. USB device drivers
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
|
#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
|
||||||
#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
|
#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
|
||||||
|
|
||||||
#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */
|
/* The maximum number of ports one device can grab at once */
|
||||||
|
#define MAX_NUM_PORTS 8
|
||||||
|
|
||||||
/* parity check flag */
|
/* parity check flag */
|
||||||
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
|
#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
|
||||||
|
@ -61,29 +62,29 @@
|
||||||
* ports of a device.
|
* ports of a device.
|
||||||
*/
|
*/
|
||||||
struct usb_serial_port {
|
struct usb_serial_port {
|
||||||
struct usb_serial * serial;
|
struct usb_serial *serial;
|
||||||
struct tty_struct * tty;
|
struct tty_struct *tty;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct mutex mutex;
|
struct mutex mutex;
|
||||||
unsigned char number;
|
unsigned char number;
|
||||||
|
|
||||||
unsigned char * interrupt_in_buffer;
|
unsigned char *interrupt_in_buffer;
|
||||||
struct urb * interrupt_in_urb;
|
struct urb *interrupt_in_urb;
|
||||||
__u8 interrupt_in_endpointAddress;
|
__u8 interrupt_in_endpointAddress;
|
||||||
|
|
||||||
unsigned char * interrupt_out_buffer;
|
unsigned char *interrupt_out_buffer;
|
||||||
int interrupt_out_size;
|
int interrupt_out_size;
|
||||||
struct urb * interrupt_out_urb;
|
struct urb *interrupt_out_urb;
|
||||||
__u8 interrupt_out_endpointAddress;
|
__u8 interrupt_out_endpointAddress;
|
||||||
|
|
||||||
unsigned char * bulk_in_buffer;
|
unsigned char *bulk_in_buffer;
|
||||||
int bulk_in_size;
|
int bulk_in_size;
|
||||||
struct urb * read_urb;
|
struct urb *read_urb;
|
||||||
__u8 bulk_in_endpointAddress;
|
__u8 bulk_in_endpointAddress;
|
||||||
|
|
||||||
unsigned char * bulk_out_buffer;
|
unsigned char *bulk_out_buffer;
|
||||||
int bulk_out_size;
|
int bulk_out_size;
|
||||||
struct urb * write_urb;
|
struct urb *write_urb;
|
||||||
int write_urb_busy;
|
int write_urb_busy;
|
||||||
__u8 bulk_out_endpointAddress;
|
__u8 bulk_out_endpointAddress;
|
||||||
|
|
||||||
|
@ -98,12 +99,13 @@ struct usb_serial_port {
|
||||||
#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, 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 */
|
/* get and set the port private data pointer helper functions */
|
||||||
static inline void *usb_get_serial_port_data (struct usb_serial_port *port)
|
static inline void *usb_get_serial_port_data(struct usb_serial_port *port)
|
||||||
{
|
{
|
||||||
return dev_get_drvdata(&port->dev);
|
return dev_get_drvdata(&port->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data)
|
static inline void usb_set_serial_port_data(struct usb_serial_port *port,
|
||||||
|
void *data)
|
||||||
{
|
{
|
||||||
dev_set_drvdata(&port->dev, data);
|
dev_set_drvdata(&port->dev, data);
|
||||||
}
|
}
|
||||||
|
@ -126,9 +128,9 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
|
||||||
* usb_set_serial_data() to access this.
|
* usb_set_serial_data() to access this.
|
||||||
*/
|
*/
|
||||||
struct usb_serial {
|
struct usb_serial {
|
||||||
struct usb_device * dev;
|
struct usb_device *dev;
|
||||||
struct usb_serial_driver * type;
|
struct usb_serial_driver *type;
|
||||||
struct usb_interface * interface;
|
struct usb_interface *interface;
|
||||||
unsigned char disconnected;
|
unsigned char disconnected;
|
||||||
unsigned char minor;
|
unsigned char minor;
|
||||||
unsigned char num_ports;
|
unsigned char num_ports;
|
||||||
|
@ -137,30 +139,30 @@ struct usb_serial {
|
||||||
char num_interrupt_out;
|
char num_interrupt_out;
|
||||||
char num_bulk_in;
|
char num_bulk_in;
|
||||||
char num_bulk_out;
|
char num_bulk_out;
|
||||||
struct usb_serial_port * port[MAX_NUM_PORTS];
|
struct usb_serial_port *port[MAX_NUM_PORTS];
|
||||||
struct kref kref;
|
struct kref kref;
|
||||||
struct mutex disc_mutex;
|
struct mutex disc_mutex;
|
||||||
void * private;
|
void *private;
|
||||||
};
|
};
|
||||||
#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
|
#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
|
||||||
|
|
||||||
#define NUM_DONT_CARE 99
|
#define NUM_DONT_CARE 99
|
||||||
|
|
||||||
/* get and set the serial private data pointer helper functions */
|
/* get and set the serial private data pointer helper functions */
|
||||||
static inline void *usb_get_serial_data (struct usb_serial *serial)
|
static inline void *usb_get_serial_data(struct usb_serial *serial)
|
||||||
{
|
{
|
||||||
return serial->private;
|
return serial->private;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
|
static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
|
||||||
{
|
{
|
||||||
serial->private = data;
|
serial->private = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* usb_serial_driver - describes a usb serial driver
|
* usb_serial_driver - describes a usb serial driver
|
||||||
* @description: pointer to a string that describes this driver. This string used
|
* @description: pointer to a string that describes this driver. This string
|
||||||
* in the syslog messages when a device is inserted or removed.
|
* 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
|
* @id_table: pointer to a list of usb_device_id structures that define all
|
||||||
* of the devices this structure can support.
|
* of the devices this structure can support.
|
||||||
* @num_interrupt_in: If a device doesn't have this many interrupt-in
|
* @num_interrupt_in: If a device doesn't have this many interrupt-in
|
||||||
|
@ -221,82 +223,91 @@ struct usb_serial_driver {
|
||||||
struct usb_driver *usb_driver;
|
struct usb_driver *usb_driver;
|
||||||
struct usb_dynids dynids;
|
struct usb_dynids dynids;
|
||||||
|
|
||||||
int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
|
int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
|
||||||
int (*attach) (struct usb_serial *serial);
|
int (*attach)(struct usb_serial *serial);
|
||||||
int (*calc_num_ports) (struct usb_serial *serial);
|
int (*calc_num_ports) (struct usb_serial *serial);
|
||||||
|
|
||||||
void (*shutdown) (struct usb_serial *serial);
|
void (*shutdown)(struct usb_serial *serial);
|
||||||
|
|
||||||
int (*port_probe) (struct usb_serial_port *port);
|
int (*port_probe)(struct usb_serial_port *port);
|
||||||
int (*port_remove) (struct usb_serial_port *port);
|
int (*port_remove)(struct usb_serial_port *port);
|
||||||
|
|
||||||
int (*suspend) (struct usb_serial *serial, pm_message_t message);
|
int (*suspend)(struct usb_serial *serial, pm_message_t message);
|
||||||
int (*resume) (struct usb_serial *serial);
|
int (*resume)(struct usb_serial *serial);
|
||||||
|
|
||||||
/* serial function calls */
|
/* serial function calls */
|
||||||
int (*open) (struct usb_serial_port *port, struct file * filp);
|
int (*open)(struct usb_serial_port *port, struct file *filp);
|
||||||
void (*close) (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)(struct usb_serial_port *port, const unsigned char *buf,
|
||||||
int (*write_room) (struct usb_serial_port *port);
|
int count);
|
||||||
int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
|
int (*write_room)(struct usb_serial_port *port);
|
||||||
void (*set_termios) (struct usb_serial_port *port, struct ktermios * old);
|
int (*ioctl)(struct usb_serial_port *port, struct file *file,
|
||||||
void (*break_ctl) (struct usb_serial_port *port, int break_state);
|
unsigned int cmd, unsigned long arg);
|
||||||
int (*chars_in_buffer) (struct usb_serial_port *port);
|
void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
|
||||||
void (*throttle) (struct usb_serial_port *port);
|
void (*break_ctl)(struct usb_serial_port *port, int break_state);
|
||||||
void (*unthrottle) (struct usb_serial_port *port);
|
int (*chars_in_buffer)(struct usb_serial_port *port);
|
||||||
int (*tiocmget) (struct usb_serial_port *port, struct file *file);
|
void (*throttle)(struct usb_serial_port *port);
|
||||||
int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
|
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 (*read_int_callback)(struct urb *urb);
|
||||||
void (*write_int_callback)(struct urb *urb);
|
void (*write_int_callback)(struct urb *urb);
|
||||||
void (*read_bulk_callback)(struct urb *urb);
|
void (*read_bulk_callback)(struct urb *urb);
|
||||||
void (*write_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)
|
#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 int usb_serial_register(struct usb_serial_driver *driver);
|
||||||
extern void usb_serial_deregister(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 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 int usb_serial_probe(struct usb_interface *iface,
|
||||||
|
const struct usb_device_id *id);
|
||||||
extern void usb_serial_disconnect(struct usb_interface *iface);
|
extern void usb_serial_disconnect(struct usb_interface *iface);
|
||||||
|
|
||||||
extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
|
extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
|
||||||
extern int usb_serial_resume(struct usb_interface *intf);
|
extern int usb_serial_resume(struct usb_interface *intf);
|
||||||
|
|
||||||
extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
|
extern int ezusb_writememory(struct usb_serial *serial, int address,
|
||||||
extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
|
unsigned char *data, int length, __u8 bRequest);
|
||||||
|
extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
|
||||||
|
|
||||||
/* USB Serial console functions */
|
/* USB Serial console functions */
|
||||||
#ifdef CONFIG_USB_SERIAL_CONSOLE
|
#ifdef CONFIG_USB_SERIAL_CONSOLE
|
||||||
extern void usb_serial_console_init (int debug, int minor);
|
extern void usb_serial_console_init(int debug, int minor);
|
||||||
extern void usb_serial_console_exit (void);
|
extern void usb_serial_console_exit(void);
|
||||||
extern void usb_serial_console_disconnect(struct usb_serial *serial);
|
extern void usb_serial_console_disconnect(struct usb_serial *serial);
|
||||||
#else
|
#else
|
||||||
static inline void usb_serial_console_init (int debug, int minor) { }
|
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_exit(void) { }
|
||||||
static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
|
static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Functions needed by other parts of the usbserial core */
|
/* Functions needed by other parts of the usbserial core */
|
||||||
extern struct usb_serial *usb_serial_get_by_index (unsigned int minor);
|
extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
|
||||||
extern void usb_serial_put(struct usb_serial *serial);
|
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_open(struct usb_serial_port *port,
|
||||||
extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count);
|
struct file *filp);
|
||||||
extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp);
|
extern int usb_serial_generic_write(struct usb_serial_port *port,
|
||||||
extern int usb_serial_generic_resume (struct usb_serial *serial);
|
const unsigned char *buf, int count);
|
||||||
extern int usb_serial_generic_write_room (struct usb_serial_port *port);
|
extern void usb_serial_generic_close(struct usb_serial_port *port,
|
||||||
extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
|
struct file *filp);
|
||||||
extern void usb_serial_generic_read_bulk_callback (struct urb *urb);
|
extern int usb_serial_generic_resume(struct usb_serial *serial);
|
||||||
extern void usb_serial_generic_write_bulk_callback (struct urb *urb);
|
extern int usb_serial_generic_write_room(struct usb_serial_port *port);
|
||||||
extern void usb_serial_generic_throttle (struct usb_serial_port *port);
|
extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
|
||||||
extern void usb_serial_generic_unthrottle (struct usb_serial_port *port);
|
extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
|
||||||
extern void usb_serial_generic_shutdown (struct usb_serial *serial);
|
extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
|
||||||
extern int usb_serial_generic_register (int debug);
|
extern void usb_serial_generic_throttle(struct usb_serial_port *port);
|
||||||
extern void usb_serial_generic_deregister (void);
|
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 int usb_serial_bus_register(struct usb_serial_driver *device);
|
||||||
extern void usb_serial_bus_deregister (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 usb_serial_driver usb_serial_generic_device;
|
||||||
extern struct bus_type usb_serial_bus_type;
|
extern struct bus_type usb_serial_bus_type;
|
||||||
|
@ -310,16 +321,22 @@ static inline void usb_serial_debug_data(int debug,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
|
dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
|
||||||
|
function, size);
|
||||||
for (i = 0; i < size; ++i)
|
for (i = 0; i < size; ++i)
|
||||||
printk ("%.2x ", data[i]);
|
printk("%.2x ", data[i]);
|
||||||
printk ("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use our own dbg macro */
|
/* Use our own dbg macro */
|
||||||
#undef dbg
|
#undef dbg
|
||||||
#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0)
|
#define dbg(format, arg...) \
|
||||||
|
do { \
|
||||||
|
if (debug) \
|
||||||
|
printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \
|
||||||
|
## arg); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ struct sl811_platform_data {
|
||||||
/* pulse sl811 nRST (probably with a GPIO) */
|
/* pulse sl811 nRST (probably with a GPIO) */
|
||||||
void (*reset)(struct device *dev);
|
void (*reset)(struct device *dev);
|
||||||
|
|
||||||
// some boards need something like these:
|
/* some boards need something like these: */
|
||||||
// int (*check_overcurrent)(struct device *dev);
|
/* int (*check_overcurrent)(struct device *dev); */
|
||||||
// void (*clock_enable)(struct device *dev, int is_on);
|
/* void (*clock_enable)(struct device *dev, int is_on); */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue