Re: [PATCH 1/8] usb: USB over WiFi HCD driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-02-17 at 13:22 +0000, Chris Kelly wrote:
> Works with devices using Ozmo USB over WiFi technology.
> See README file for further details.
> Added first batch of files to drivers/staging/ozwpan.

You probably want to use different, descriptive subjects for each patch
in the series.  Next, does this really require wifi, or could it use a
suitable ethernet interface as well?  A quick look of the code didn't
show anything wifi-specific, though I didn't look too hard.  Also, I'd
recommend using an interface index instead of an interface name for
binding the network device, since names can and do change, but indexes
don't.

Dan

> Signed-off-by: Chris Kelly <ckelly@xxxxxxxxxxxxxxx>
> ---
>  drivers/staging/ozwpan/README        |   25 +++
>  drivers/staging/ozwpan/ozappif.h     |   46 +++++
>  drivers/staging/ozwpan/ozconfig.h    |   28 +++
>  drivers/staging/ozwpan/ozeventdef.h  |   47 +++++
>  drivers/staging/ozwpan/ozmain.c      |   62 ++++++
>  drivers/staging/ozwpan/ozprotocol.h  |  372 ++++++++++++++++++++++++++++++++++
>  drivers/staging/ozwpan/oztrace.c     |   36 ++++
>  drivers/staging/ozwpan/oztrace.h     |   35 ++++
>  drivers/staging/ozwpan/ozunaligned.h |   11 +
>  drivers/staging/ozwpan/ozusbif.h     |   43 ++++
>  10 files changed, 705 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/staging/ozwpan/README
>  create mode 100644 drivers/staging/ozwpan/ozappif.h
>  create mode 100644 drivers/staging/ozwpan/ozconfig.h
>  create mode 100644 drivers/staging/ozwpan/ozeventdef.h
>  create mode 100644 drivers/staging/ozwpan/ozmain.c
>  create mode 100644 drivers/staging/ozwpan/ozprotocol.h
>  create mode 100644 drivers/staging/ozwpan/oztrace.c
>  create mode 100644 drivers/staging/ozwpan/oztrace.h
>  create mode 100644 drivers/staging/ozwpan/ozunaligned.h
>  create mode 100644 drivers/staging/ozwpan/ozusbif.h
> 
> diff --git a/drivers/staging/ozwpan/README b/drivers/staging/ozwpan/README
> new file mode 100644
> index 0000000..bb1a69b
> --- /dev/null
> +++ b/drivers/staging/ozwpan/README
> @@ -0,0 +1,25 @@
> +OZWPAN USB Host Controller Driver
> +---------------------------------
> +This driver is a USB HCD driver that does not have an associated a physical
> +device but instead uses Wi-Fi to communicate with the wireless peripheral.
> +The USB requests are converted into a layer 2 network protocol and transmitted
> +on the network using an ethertype (0x892e) regestered to Ozmo Device Inc.
> +This driver is compatible with existing wireless devices that use Ozmo Devices
> +technology.
> +
> +To operate the driver must be bound to a suitable network interface. This can
> +be done when the module is loaded (specifying the name of the network interface
> +as a paramter - e.g. 'insmod ozwpan g_net_dev=go0') or can be bound after
> +loading using an ioctl call. See the ozappif.h file and the ioctls
> +OZ_IOCTL_ADD_BINDING and OZ_IOCTL_REMOVE_BINDING.
> +
> +The devices connect to the host use Wi-Fi Direct so a network card that supports
> +Wi-Fi direct is required. A recent version (0.8.x or later) version of the
> +wpa_supplicant can be used to setup the network interface to create a persistent
> +autonomous group (for older pre-WFD peripherals) or put in a listen state to
> +allow group negotiation to occur for more recent devices that support WFD.
> +
> +The protocol used over the network does not directly mimic the USB bus
> +transactions as this would be rather busy and inefficient. Instead the chapter 9
> +requests are converted into a request/response pair of messages. (See
> +ozprotocol.h for data structures used in the protocol).
> diff --git a/drivers/staging/ozwpan/ozappif.h b/drivers/staging/ozwpan/ozappif.h
> new file mode 100644
> index 0000000..af02732
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozappif.h
> @@ -0,0 +1,46 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZAPPIF_H
> +#define _OZAPPIF_H
> +
> +#include "ozeventdef.h"
> +
> +#define OZ_IOCTL_MAGIC	0xf4
> +
> +struct oz_mac_addr {
> +	unsigned char a[6];
> +};
> +
> +#define OZ_MAX_PDS	8
> +
> +struct oz_pd_list {
> +	int count;
> +	struct oz_mac_addr addr[OZ_MAX_PDS];
> +};
> +
> +#define OZ_MAX_BINDING_LEN	32
> +
> +struct oz_binding_info {
> +	char name[OZ_MAX_BINDING_LEN];
> +};
> +
> +struct oz_test {
> +	int action;
> +};
> +
> +#define OZ_IOCTL_GET_PD_LIST	_IOR(OZ_IOCTL_MAGIC, 0, struct oz_pd_list)
> +#define OZ_IOCTL_SET_ACTIVE_PD	_IOW(OZ_IOCTL_MAGIC, 1, struct oz_mac_addr)
> +#define OZ_IOCTL_GET_ACTIVE_PD	_IOR(OZ_IOCTL_MAGIC, 2, struct oz_mac_addr)
> +#define OZ_IOCTL_CLEAR_EVENTS	_IO(OZ_IOCTL_MAGIC, 3)
> +#define OZ_IOCTL_GET_EVENTS	_IOR(OZ_IOCTL_MAGIC, 4, struct oz_evtlist)
> +#define OZ_IOCTL_ADD_BINDING	_IOW(OZ_IOCTL_MAGIC, 5, struct oz_binding_info)
> +#define OZ_IOCTL_TEST		_IOWR(OZ_IOCTL_MAGIC, 6, struct oz_test)
> +#define OZ_IOCTL_SET_EVENT_MASK	_IOW(OZ_IOCTL_MAGIC, 7, unsigned long)
> +#define OZ_IOCTL_REMOVE_BINDING	_IOW(OZ_IOCTL_MAGIC, 8, struct oz_binding_info)
> +#define OZ_IOCTL_MAX		9
> +
> +
> +#endif /* _OZAPPIF_H */
> diff --git a/drivers/staging/ozwpan/ozconfig.h b/drivers/staging/ozwpan/ozconfig.h
> new file mode 100644
> index 0000000..a8c9726
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozconfig.h
> @@ -0,0 +1,28 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * ---------------------------------------------------------------------------*/
> +#ifndef _OZCONFIG_H
> +#define _OZCONFIG_H
> +
> +/* #define WANT_DEBUG_KMALLOC */
> +/* #define WANT_TRACE */
> +#ifdef WANT_TRACE
> +#define WANT_VERBOSE_TRACE
> +#endif /* #ifdef WANT_TRACE */
> +/* #define WANT_URB_PARANOIA */
> +
> +/* #define WANT_PRE_2_6_39 */
> +#define WANT_EVENT_TRACE
> +
> +/* These defines determine what verbose trace is displayed. */
> +#ifdef WANT_VERBOSE_TRACE
> +/* #define WANT_TRACE_STREAM */
> +/* #define WANT_TRACE_URB */
> +/* #define WANT_TRACE_CTRL_DETAIL */
> +#define WANT_TRACE_HUB
> +/* #define WANT_TRACE_RX_FRAMES */
> +/* #define WANT_TRACE_TX_FRAMES */
> +#endif /* WANT_VERBOSE_TRACE */
> +
> +#endif /* _OZCONFIG_H */
> diff --git a/drivers/staging/ozwpan/ozeventdef.h b/drivers/staging/ozwpan/ozeventdef.h
> new file mode 100644
> index 0000000..cfe4163
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozeventdef.h
> @@ -0,0 +1,47 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZEVENTDEF_H
> +#define _OZEVENTDEF_H
> +
> +#define OZ_EVT_RX_FRAME		0
> +#define OZ_EVT_RX_PROCESS	1
> +#define OZ_EVT_TX_FRAME		2
> +#define OZ_EVT_TX_ISOC		3
> +#define OZ_EVT_URB_SUBMIT	4
> +#define OZ_EVT_URB_DONE		5
> +#define OZ_EVT_URB_CANCEL	6
> +#define OZ_EVT_CTRL_REQ		7
> +#define OZ_EVT_CTRL_CNF		8
> +#define OZ_EVT_CTRL_LOCAL	9
> +#define OZ_EVT_CONNECT_REQ	10
> +#define OZ_EVT_CONNECT_RSP	11
> +#define OZ_EVT_EP_CREDIT	12
> +#define OZ_EVT_EP_BUFFERING	13
> +#define OZ_EVT_TX_ISOC_DONE	14
> +#define OZ_EVT_TX_ISOC_DROP	15
> +#define OZ_EVT_TIMER_CTRL	16
> +#define OZ_EVT_TIMER		17
> +#define OZ_EVT_PD_STATE		18
> +#define OZ_EVT_SERVICE		19
> +#define OZ_EVT_DEBUG		20
> +
> +struct oz_event {
> +	unsigned long jiffies;
> +	unsigned char evt;
> +	unsigned char ctx1;
> +	unsigned short ctx2;
> +	void *ctx3;
> +	unsigned ctx4;
> +};
> +
> +#define OZ_EVT_LIST_SZ	256
> +struct oz_evtlist {
> +	int count;
> +	int missed;
> +	struct oz_event evts[OZ_EVT_LIST_SZ];
> +};
> +
> +#endif /* _OZEVENTDEF_H */
> diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c
> new file mode 100644
> index 0000000..aec5d89
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozmain.c
> @@ -0,0 +1,62 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/timer.h>
> +#include <linux/sched.h>
> +#include <linux/netdevice.h>
> +#include <linux/errno.h>
> +#include <linux/ieee80211.h>
> +#include "ozconfig.h"
> +#include "ozpd.h"
> +#include "ozproto.h"
> +#include "ozcdev.h"
> +#include "ozalloc.h"
> +#include "oztrace.h"
> +#include "ozevent.h"
> +/*------------------------------------------------------------------------------
> + * The name of the 802.11 mac device. Empty string is the default value but a
> + * value can be supplied as a parameter to the module. An empty string means
> + * bind to nothing. '*' means bind to all netcards - this includes non-802.11
> + * netcards. Bindings can be added later using an IOCTL.
> + */
> +char *g_net_dev = "";
> +/*------------------------------------------------------------------------------
> + * Context: process
> + */
> +static int __init ozwpan_init(void)
> +{
> +	oz_trace("ozwpan.ko loaded. HZ = %d\n", HZ);
> +	oz_event_init();
> +	oz_cdev_register();
> +	oz_protocol_init(g_net_dev);
> +	oz_app_enable(OZ_APPID_USB, 1);
> +	oz_apps_init();
> +	return 0;
> +}
> +/*------------------------------------------------------------------------------
> + * Context: process
> + */
> +static void __exit ozwpan_exit(void)
> +{
> +	oz_protocol_term();
> +	oz_apps_term();
> +	oz_cdev_deregister();
> +	oz_trace_leaks();
> +	oz_event_term();
> +	oz_trace("Driver going - goodbye\n");
> +}
> +/*------------------------------------------------------------------------------
> + */
> +module_param(g_net_dev, charp, S_IRUGO);
> +module_init(ozwpan_init);
> +module_exit(ozwpan_exit);
> +
> +MODULE_AUTHOR("Chris Kelly");
> +MODULE_DESCRIPTION("Ozmo Devices USB over WiFi hcd driver");
> +MODULE_VERSION("1.0.7");
> +MODULE_LICENSE("GPL");
> +
> diff --git a/drivers/staging/ozwpan/ozprotocol.h b/drivers/staging/ozwpan/ozprotocol.h
> new file mode 100644
> index 0000000..b3e7d77
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozprotocol.h
> @@ -0,0 +1,372 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZPROTOCOL_H
> +#define _OZPROTOCOL_H
> +
> +#define PACKED __packed
> +
> +#define OZ_ETHERTYPE 0x892e
> +
> +/* Status codes
> + */
> +#define OZ_STATUS_SUCCESS		0
> +#define OZ_STATUS_INVALID_PARAM		1
> +#define OZ_STATUS_TOO_MANY_PDS		2
> +#define OZ_STATUS_NOT_ALLOWED		4
> +#define OZ_STATUS_SESSION_MISMATCH	5
> +#define OZ_STATUS_SESSION_TEARDOWN	6
> +
> +/* This is the generic element header.
> +   Every element starts with this.
> + */
> +struct oz_elt {
> +	u8 type;
> +	u8 length;
> +} PACKED;
> +
> +#define oz_next_elt(__elt)	\
> +	(struct oz_elt *)((u8 *)((__elt) + 1) + (__elt)->length)
> +
> +/* Protocol element IDs.
> + */
> +#define OZ_ELT_CONNECT_REQ	0x06
> +#define OZ_ELT_CONNECT_RSP	0x07
> +#define OZ_ELT_DISCONNECT	0x08
> +#define OZ_ELT_UPDATE_PARAM_REQ	0x11
> +#define OZ_ELT_FAREWELL_REQ	0x12
> +#define OZ_ELT_APP_DATA		0x31
> +
> +/* This is the Ozmo header which is the first Ozmo specific part
> + * of a frame and comes after the MAC header.
> + */
> +struct oz_hdr {
> +	u8	control;
> +	u8	last_pkt_num;
> +	u32	pkt_num;
> +} PACKED;
> +
> +#define OZ_PROTOCOL_VERSION	0x1
> +/* Bits in the control field. */
> +#define OZ_VERSION_MASK		0xc
> +#define OZ_VERSION_SHIFT	2
> +#define OZ_F_ACK		0x10
> +#define OZ_F_ISOC		0x20
> +#define OZ_F_MORE_DATA		0x40
> +#define OZ_F_ACK_REQUESTED	0x80
> +
> +#define oz_get_prot_ver(__x)	(((__x) & OZ_VERSION_MASK) >> OZ_VERSION_SHIFT)
> +
> +/* Used to select the bits of packet number to put in the last_pkt_num.
> + */
> +#define OZ_LAST_PN_MASK		0x00ff
> +
> +#define OZ_LAST_PN_HALF_CYCLE	127
> +
> +/* Connect request data structure.
> + */
> +struct oz_elt_connect_req {
> +	u8	mode;
> +	u8	resv1[16];
> +	u8	pd_info;
> +	u8	session_id;
> +	u8	presleep;
> +	u8	resv2;
> +	u8	host_vendor;
> +	u8	keep_alive;
> +	u16	apps;
> +	u8	max_len_div16;
> +	u8	ms_per_isoc;
> +	u8	resv3[2];
> +} PACKED;
> +
> +/* mode field bits.
> + */
> +#define OZ_MODE_POLLED		0x0
> +#define OZ_MODE_TRIGGERED	0x1
> +#define OZ_MODE_MASK		0xf
> +#define OZ_F_ISOC_NO_ELTS	0x40
> +#define OZ_F_ISOC_ANYTIME	0x80
> +
> +/* Keep alive field.
> + */
> +#define OZ_KALIVE_TYPE_MASK	0xc0
> +#define OZ_KALIVE_VALUE_MASK	0x3f
> +#define OZ_KALIVE_SPECIAL	0x00
> +#define OZ_KALIVE_SECS		0x40
> +#define OZ_KALIVE_MINS		0x80
> +#define OZ_KALIVE_HOURS		0xc0
> +
> +/* Connect response data structure.
> + */
> +struct oz_elt_connect_rsp {
> +	u8	mode;
> +	u8	status;
> +	u8	resv1[3];
> +	u8	session_id;
> +	u16	apps;
> +	u32	resv2;
> +} PACKED;
> +
> +struct oz_elt_farewell {
> +	u8	ep_num;
> +	u8	index;
> +	u8	report[1];
> +} PACKED;
> +
> +struct oz_elt_update_param {
> +	u8	resv1[16];
> +	u8	presleep;
> +	u8	resv2;
> +	u8	host_vendor;
> +	u8	keepalive;
> +} PACKED;
> +
> +/* Header common to all application elements.
> + */
> +struct oz_app_hdr {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +} PACKED;
> +
> +/* Values for app_id.
> + */
> +#define OZ_APPID_USB				0x1
> +#define OZ_APPID_UNUSED1			0x2
> +#define OZ_APPID_UNUSED2			0x3
> +#define OZ_APPID_SERIAL				0x4
> +#define OZ_APPID_MAX				OZ_APPID_SERIAL
> +#define OZ_NB_APPS				(OZ_APPID_MAX+1)
> +
> +/* USB header common to all elements for the  USB application.
> + * This header extends the oz_app_hdr and comes directly after
> + * the element header in a USB application.
> + */
> +struct oz_usb_hdr {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +} PACKED;
> +
> +
> +
> +/* USB requests element subtypes (type field of hs_usb_hdr).
> + */
> +#define OZ_GET_DESC_REQ			1
> +#define OZ_GET_DESC_RSP			2
> +#define OZ_SET_CONFIG_REQ		3
> +#define OZ_SET_CONFIG_RSP		4
> +#define OZ_SET_INTERFACE_REQ		5
> +#define OZ_SET_INTERFACE_RSP		6
> +#define OZ_VENDOR_CLASS_REQ		7
> +#define OZ_VENDOR_CLASS_RSP		8
> +#define OZ_GET_STATUS_REQ		9
> +#define OZ_GET_STATUS_RSP		10
> +#define OZ_CLEAR_FEATURE_REQ		11
> +#define OZ_CLEAR_FEATURE_RSP		12
> +#define OZ_SET_FEATURE_REQ		13
> +#define OZ_SET_FEATURE_RSP		14
> +#define OZ_GET_CONFIGURATION_REQ	15
> +#define OZ_GET_CONFIGURATION_RSP	16
> +#define OZ_GET_INTERFACE_REQ		17
> +#define OZ_GET_INTERFACE_RSP		18
> +#define OZ_SYNCH_FRAME_REQ		19
> +#define OZ_SYNCH_FRAME_RSP		20
> +#define OZ_USB_ENDPOINT_DATA		23
> +
> +#define OZ_REQD_D2H			0x80
> +
> +struct oz_get_desc_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u16	offset;
> +	u16	size;
> +	u8	req_type;
> +	u8	desc_type;
> +	u16	w_index;
> +	u8	index;
> +} PACKED;
> +
> +/* Values for desc_type field.
> +*/
> +#define OZ_DESC_DEVICE			0x01
> +#define OZ_DESC_CONFIG			0x02
> +#define OZ_DESC_STRING			0x03
> +
> +/* Values for req_type field.
> + */
> +#define OZ_RECP_MASK			0x1F
> +#define OZ_RECP_DEVICE			0x00
> +#define OZ_RECP_INTERFACE		0x01
> +#define OZ_RECP_ENDPOINT		0x02
> +
> +#define OZ_REQT_MASK			0x60
> +#define OZ_REQT_STD			0x00
> +#define OZ_REQT_CLASS			0x20
> +#define OZ_REQT_VENDOR			0x40
> +
> +struct oz_get_desc_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u16	offset;
> +	u16	total_size;
> +	u8	rcode;
> +	u8	data[1];
> +} PACKED;
> +
> +struct oz_feature_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	recipient;
> +	u8	index;
> +	u16	feature;
> +} PACKED;
> +
> +struct oz_feature_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	rcode;
> +} PACKED;
> +
> +struct oz_set_config_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	index;
> +} PACKED;
> +
> +struct oz_set_config_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	rcode;
> +} PACKED;
> +
> +struct oz_set_interface_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	index;
> +	u8	alternative;
> +} PACKED;
> +
> +struct oz_set_interface_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	rcode;
> +} PACKED;
> +
> +struct oz_get_interface_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	index;
> +} PACKED;
> +
> +struct oz_get_interface_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	rcode;
> +	u8	alternative;
> +} PACKED;
> +
> +struct oz_vendor_class_req {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	req_type;
> +	u8	request;
> +	u16	value;
> +	u16	index;
> +	u8	data[1];
> +} PACKED;
> +
> +struct oz_vendor_class_rsp {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	req_id;
> +	u8	rcode;
> +	u8	data[1];
> +} PACKED;
> +
> +struct oz_data {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	endpoint;
> +	u8	format;
> +} PACKED;
> +
> +struct oz_isoc_fixed {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	endpoint;
> +	u8	format;
> +	u8	unit_size;
> +	u8	frame_number;
> +	u8	data[1];
> +} PACKED;
> +
> +struct oz_multiple_fixed {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	endpoint;
> +	u8	format;
> +	u8	unit_size;
> +	u8	data[1];
> +} PACKED;
> +
> +struct oz_fragmented {
> +	u8	app_id;
> +	u8	elt_seq_num;
> +	u8	type;
> +	u8	endpoint;
> +	u8	format;
> +	u16	total_size;
> +	u16	offset;
> +	u8	data[1];
> +} PACKED;
> +
> +/* Note: the following does not get packaged in an element in the same way
> + * that other data formats are packaged. Instead the data is put in a frame
> + * directly after the oz_header and is the only permitted data in such a
> + * frame. The length of the data is directly determined from the frame size.
> + */
> +struct oz_isoc_large {
> +	u8	endpoint;
> +	u8	format;
> +	u8	ms_data;
> +	u8	frame_number;
> +} PACKED;
> +
> +#define OZ_DATA_F_TYPE_MASK		0xF
> +#define OZ_DATA_F_MULTIPLE_FIXED	0x1
> +#define OZ_DATA_F_MULTIPLE_VAR		0x2
> +#define OZ_DATA_F_ISOC_FIXED		0x3
> +#define OZ_DATA_F_ISOC_VAR		0x4
> +#define OZ_DATA_F_FRAGMENTED		0x5
> +#define OZ_DATA_F_ISOC_LARGE		0x7
> +
> +#endif /* _OZPROTOCOL_H */
> diff --git a/drivers/staging/ozwpan/oztrace.c b/drivers/staging/ozwpan/oztrace.c
> new file mode 100644
> index 0000000..353ead2
> --- /dev/null
> +++ b/drivers/staging/ozwpan/oztrace.c
> @@ -0,0 +1,36 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#include "ozconfig.h"
> +#include "oztrace.h"
> +
> +#ifdef WANT_VERBOSE_TRACE
> +unsigned long trace_flags =
> +	0
> +#ifdef WANT_TRACE_STREAM
> +	| OZ_TRACE_STREAM
> +#endif /* WANT_TRACE_STREAM */
> +#ifdef WANT_TRACE_URB
> +	| OZ_TRACE_URB
> +#endif /* WANT_TRACE_URB */
> +
> +#ifdef WANT_TRACE_CTRL_DETAIL
> +	| OZ_TRACE_CTRL_DETAIL
> +#endif /* WANT_TRACE_CTRL_DETAIL */
> +
> +#ifdef WANT_TRACE_HUB
> +	| OZ_TRACE_HUB
> +#endif /* WANT_TRACE_HUB */
> +
> +#ifdef WANT_TRACE_RX_FRAMES
> +	| OZ_TRACE_RX_FRAMES
> +#endif /* WANT_TRACE_RX_FRAMES */
> +
> +#ifdef WANT_TRACE_TX_FRAMES
> +	| OZ_TRACE_TX_FRAMES
> +#endif /* WANT_TRACE_TX_FRAMES */
> +	;
> +#endif /* WANT_VERBOSE_TRACE */
> +
> diff --git a/drivers/staging/ozwpan/oztrace.h b/drivers/staging/ozwpan/oztrace.h
> new file mode 100644
> index 0000000..8293b24
> --- /dev/null
> +++ b/drivers/staging/ozwpan/oztrace.h
> @@ -0,0 +1,35 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZTRACE_H_
> +#define _OZTRACE_H_
> +#include "ozconfig.h"
> +
> +#define TRACE_PREFIX	KERN_ALERT "OZWPAN: "
> +
> +#ifdef WANT_TRACE
> +#define oz_trace(...) printk(TRACE_PREFIX __VA_ARGS__)
> +#ifdef WANT_VERBOSE_TRACE
> +extern unsigned long trace_flags;
> +#define oz_trace2(_flag, ...) \
> +	do { if (trace_flags & _flag) printk(TRACE_PREFIX __VA_ARGS__); \
> +	} while (0)
> +#else
> +#define oz_trace2(...)
> +#endif /* #ifdef WANT_VERBOSE_TRACE */
> +#else
> +#define oz_trace(...)
> +#define oz_trace2(...)
> +#endif /* #ifdef WANT_TRACE */
> +
> +#define OZ_TRACE_STREAM		0x1
> +#define OZ_TRACE_URB		0x2
> +#define OZ_TRACE_CTRL_DETAIL	0x4
> +#define OZ_TRACE_HUB		0x8
> +#define OZ_TRACE_RX_FRAMES	0x10
> +#define OZ_TRACE_TX_FRAMES	0x20
> +
> +#endif /* Sentry */
> +
> diff --git a/drivers/staging/ozwpan/ozunaligned.h b/drivers/staging/ozwpan/ozunaligned.h
> new file mode 100644
> index 0000000..01d6416
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozunaligned.h
> @@ -0,0 +1,11 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZUNALIGNED_H
> +#define _OZUNALIGNED_H
> +
> +#include <asm/unaligned.h>
> +
> +#endif /* _OZUNALIGNED_H */
> diff --git a/drivers/staging/ozwpan/ozusbif.h b/drivers/staging/ozwpan/ozusbif.h
> new file mode 100644
> index 0000000..3acf598
> --- /dev/null
> +++ b/drivers/staging/ozwpan/ozusbif.h
> @@ -0,0 +1,43 @@
> +/* -----------------------------------------------------------------------------
> + * Copyright (c) 2011 Ozmo Inc
> + * Released under the GNU General Public License Version 2 (GPLv2).
> + * -----------------------------------------------------------------------------
> + */
> +#ifndef _OZUSBIF_H
> +#define _OZUSBIF_H
> +
> +#include <linux/usb.h>
> +
> +/* Reference counting functions.
> + */
> +void oz_usb_get(void *hpd);
> +void oz_usb_put(void *hpd);
> +
> +/* Stream functions.
> + */
> +int oz_usb_stream_create(void *hpd, u8 ep_num);
> +int oz_usb_stream_delete(void *hpd, u8 ep_num);
> +
> +/* Request functions.
> + */
> +int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup,
> +		u8 *data, int data_len);
> +int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type,
> +	u8 index, u16 windex, int offset, int len);
> +int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb);
> +void oz_usb_request_heartbeat(void *hpd);
> +
> +/* Confirmation functions.
> + */
> +void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status,
> +	u8 *desc, int length, int offset, int total_size);
> +void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode,
> +	u8 *data, int data_len);
> +
> +/* Indication functions.
> + */
> +void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len);
> +
> +int oz_hcd_heartbeat(void *hport);
> +
> +#endif /* _OZUSBIF_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux