Linux Audio

Check our new training course

Loading...
v4.6
  1/*
  2 * epautoconf.c -- endpoint autoconfiguration for usb gadget drivers
  3 *
  4 * Copyright (C) 2004 David Brownell
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License as published by
  8 * the Free Software Foundation; either version 2 of the License, or
  9 * (at your option) any later version.
 10 */
 11
 12#include <linux/kernel.h>
 13#include <linux/module.h>
 14#include <linux/types.h>
 15#include <linux/device.h>
 16
 17#include <linux/ctype.h>
 18#include <linux/string.h>
 19
 20#include <linux/usb/ch9.h>
 21#include <linux/usb/gadget.h>
 22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 23/**
 24 * usb_ep_autoconfig_ss() - choose an endpoint matching the ep
 25 * descriptor and ep companion descriptor
 26 * @gadget: The device to which the endpoint must belong.
 27 * @desc: Endpoint descriptor, with endpoint direction and transfer mode
 28 *    initialized.  For periodic transfers, the maximum packet
 29 *    size must also be initialized.  This is modified on
 30 *    success.
 31 * @ep_comp: Endpoint companion descriptor, with the required
 32 *    number of streams. Will be modified when the chosen EP
 33 *    supports a different number of streams.
 34 *
 35 * This routine replaces the usb_ep_autoconfig when needed
 36 * superspeed enhancments. If such enhancemnets are required,
 37 * the FD should call usb_ep_autoconfig_ss directly and provide
 38 * the additional ep_comp parameter.
 39 *
 40 * By choosing an endpoint to use with the specified descriptor,
 41 * this routine simplifies writing gadget drivers that work with
 42 * multiple USB device controllers.  The endpoint would be
 43 * passed later to usb_ep_enable(), along with some descriptor.
 44 *
 45 * That second descriptor won't always be the same as the first one.
 46 * For example, isochronous endpoints can be autoconfigured for high
 47 * bandwidth, and then used in several lower bandwidth altsettings.
 48 * Also, high and full speed descriptors will be different.
 49 *
 50 * Be sure to examine and test the results of autoconfiguration
 51 * on your hardware.  This code may not make the best choices
 52 * about how to use the USB controller, and it can't know all
 53 * the restrictions that may apply. Some combinations of driver
 54 * and hardware won't be able to autoconfigure.
 55 *
 56 * On success, this returns an claimed usb_ep, and modifies the endpoint
 57 * descriptor bEndpointAddress.  For bulk endpoints, the wMaxPacket value
 58 * is initialized as if the endpoint were used at full speed and
 59 * the bmAttribute field in the ep companion descriptor is
 60 * updated with the assigned number of streams if it is
 61 * different from the original value. To prevent the endpoint
 62 * from being returned by a later autoconfig call, claims it by
 63 * assigning ep->claimed to true.
 64 *
 65 * On failure, this returns a null endpoint descriptor.
 66 */
 67struct usb_ep *usb_ep_autoconfig_ss(
 68	struct usb_gadget		*gadget,
 69	struct usb_endpoint_descriptor	*desc,
 70	struct usb_ss_ep_comp_descriptor *ep_comp
 71)
 72{
 73	struct usb_ep	*ep;
 74	u8		type;
 75
 76	type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
 77
 78	if (gadget->ops->match_ep) {
 79		ep = gadget->ops->match_ep(gadget, desc, ep_comp);
 80		if (ep)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 81			goto found_ep;
 
 82	}
 83
 84	/* Second, look at endpoints until an unclaimed one looks usable */
 85	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
 86		if (usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
 87			goto found_ep;
 88	}
 89
 90	/* Fail */
 91	return NULL;
 92found_ep:
 93
 94	/*
 95	 * If the protocol driver hasn't yet decided on wMaxPacketSize
 96	 * and wants to know the maximum possible, provide the info.
 97	 */
 98	if (desc->wMaxPacketSize == 0)
 99		desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);
100
101	/* report address */
102	desc->bEndpointAddress &= USB_DIR_IN;
103	if (isdigit(ep->name[2])) {
104		u8 num = simple_strtoul(&ep->name[2], NULL, 10);
105		desc->bEndpointAddress |= num;
106	} else if (desc->bEndpointAddress & USB_DIR_IN) {
107		if (++gadget->in_epnum > 15)
108			return NULL;
109		desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum;
110	} else {
111		if (++gadget->out_epnum > 15)
112			return NULL;
113		desc->bEndpointAddress |= gadget->out_epnum;
114	}
115
116	/* report (variable) full speed bulk maxpacket */
117	if ((type == USB_ENDPOINT_XFER_BULK) && !ep_comp) {
118		int size = ep->maxpacket_limit;
119
120		/* min() doesn't work on bitfields with gcc-3.5 */
121		if (size > 64)
122			size = 64;
123		desc->wMaxPacketSize = cpu_to_le16(size);
124	}
125
126	ep->address = desc->bEndpointAddress;
127	ep->desc = NULL;
128	ep->comp_desc = NULL;
129	ep->claimed = true;
130	return ep;
131}
132EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
133
134/**
135 * usb_ep_autoconfig() - choose an endpoint matching the
136 * descriptor
137 * @gadget: The device to which the endpoint must belong.
138 * @desc: Endpoint descriptor, with endpoint direction and transfer mode
139 *	initialized.  For periodic transfers, the maximum packet
140 *	size must also be initialized.  This is modified on success.
141 *
142 * By choosing an endpoint to use with the specified descriptor, this
143 * routine simplifies writing gadget drivers that work with multiple
144 * USB device controllers.  The endpoint would be passed later to
145 * usb_ep_enable(), along with some descriptor.
146 *
147 * That second descriptor won't always be the same as the first one.
148 * For example, isochronous endpoints can be autoconfigured for high
149 * bandwidth, and then used in several lower bandwidth altsettings.
150 * Also, high and full speed descriptors will be different.
151 *
152 * Be sure to examine and test the results of autoconfiguration on your
153 * hardware.  This code may not make the best choices about how to use the
154 * USB controller, and it can't know all the restrictions that may apply.
155 * Some combinations of driver and hardware won't be able to autoconfigure.
156 *
157 * On success, this returns an claimed usb_ep, and modifies the endpoint
158 * descriptor bEndpointAddress.  For bulk endpoints, the wMaxPacket value
159 * is initialized as if the endpoint were used at full speed.  To prevent
160 * the endpoint from being returned by a later autoconfig call, claims it
161 * by assigning ep->claimed to true.
162 *
163 * On failure, this returns a null endpoint descriptor.
164 */
165struct usb_ep *usb_ep_autoconfig(
166	struct usb_gadget		*gadget,
167	struct usb_endpoint_descriptor	*desc
168)
169{
170	return usb_ep_autoconfig_ss(gadget, desc, NULL);
171}
172EXPORT_SYMBOL_GPL(usb_ep_autoconfig);
173
174/**
175 * usb_ep_autoconfig_release - releases endpoint and set it to initial state
176 * @ep: endpoint which should be released
177 *
178 * This function can be used during function bind for endpoints obtained
179 * from usb_ep_autoconfig(). It unclaims endpoint claimed by
180 * usb_ep_autoconfig() to make it available for other functions. Endpoint
181 * which was released is no longer invalid and shouldn't be used in
182 * context of function which released it.
183 */
184void usb_ep_autoconfig_release(struct usb_ep *ep)
185{
186	ep->claimed = false;
187	ep->driver_data = NULL;
188}
189EXPORT_SYMBOL_GPL(usb_ep_autoconfig_release);
190
191/**
192 * usb_ep_autoconfig_reset - reset endpoint autoconfig state
193 * @gadget: device for which autoconfig state will be reset
194 *
195 * Use this for devices where one configuration may need to assign
196 * endpoint resources very differently from the next one.  It clears
197 * state such as ep->claimed and the record of assigned endpoints
198 * used by usb_ep_autoconfig().
199 */
200void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
201{
202	struct usb_ep	*ep;
203
204	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
205		ep->claimed = false;
206		ep->driver_data = NULL;
207	}
208	gadget->in_epnum = 0;
209	gadget->out_epnum = 0;
 
 
210}
211EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);
v3.5.6
  1/*
  2 * epautoconf.c -- endpoint autoconfiguration for usb gadget drivers
  3 *
  4 * Copyright (C) 2004 David Brownell
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License as published by
  8 * the Free Software Foundation; either version 2 of the License, or
  9 * (at your option) any later version.
 10 */
 11
 12#include <linux/kernel.h>
 13#include <linux/init.h>
 14#include <linux/types.h>
 15#include <linux/device.h>
 16
 17#include <linux/ctype.h>
 18#include <linux/string.h>
 19
 20#include <linux/usb/ch9.h>
 21#include <linux/usb/gadget.h>
 22
 23#include "gadget_chips.h"
 24
 25
 26/* we must assign addresses for configurable endpoints (like net2280) */
 27static unsigned epnum;
 28
 29// #define MANY_ENDPOINTS
 30#ifdef MANY_ENDPOINTS
 31/* more than 15 configurable endpoints */
 32static unsigned in_epnum;
 33#endif
 34
 35
 36/*
 37 * This should work with endpoints from controller drivers sharing the
 38 * same endpoint naming convention.  By example:
 39 *
 40 *	- ep1, ep2, ... address is fixed, not direction or type
 41 *	- ep1in, ep2out, ... address and direction are fixed, not type
 42 *	- ep1-bulk, ep2-bulk, ... address and type are fixed, not direction
 43 *	- ep1in-bulk, ep2out-iso, ... all three are fixed
 44 *	- ep-* ... no functionality restrictions
 45 *
 46 * Type suffixes are "-bulk", "-iso", or "-int".  Numbers are decimal.
 47 * Less common restrictions are implied by gadget_is_*().
 48 *
 49 * NOTE:  each endpoint is unidirectional, as specified by its USB
 50 * descriptor; and isn't specific to a configuration or altsetting.
 51 */
 52static int
 53ep_matches (
 54	struct usb_gadget		*gadget,
 55	struct usb_ep			*ep,
 56	struct usb_endpoint_descriptor	*desc,
 57	struct usb_ss_ep_comp_descriptor *ep_comp
 58)
 59{
 60	u8		type;
 61	const char	*tmp;
 62	u16		max;
 63
 64	int		num_req_streams = 0;
 65
 66	/* endpoint already claimed? */
 67	if (NULL != ep->driver_data)
 68		return 0;
 69
 70	/* only support ep0 for portable CONTROL traffic */
 71	type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
 72	if (USB_ENDPOINT_XFER_CONTROL == type)
 73		return 0;
 74
 75	/* some other naming convention */
 76	if ('e' != ep->name[0])
 77		return 0;
 78
 79	/* type-restriction:  "-iso", "-bulk", or "-int".
 80	 * direction-restriction:  "in", "out".
 81	 */
 82	if ('-' != ep->name[2]) {
 83		tmp = strrchr (ep->name, '-');
 84		if (tmp) {
 85			switch (type) {
 86			case USB_ENDPOINT_XFER_INT:
 87				/* bulk endpoints handle interrupt transfers,
 88				 * except the toggle-quirky iso-synch kind
 89				 */
 90				if ('s' == tmp[2])	// == "-iso"
 91					return 0;
 92				/* for now, avoid PXA "interrupt-in";
 93				 * it's documented as never using DATA1.
 94				 */
 95				if (gadget_is_pxa (gadget)
 96						&& 'i' == tmp [1])
 97					return 0;
 98				break;
 99			case USB_ENDPOINT_XFER_BULK:
100				if ('b' != tmp[1])	// != "-bulk"
101					return 0;
102				break;
103			case USB_ENDPOINT_XFER_ISOC:
104				if ('s' != tmp[2])	// != "-iso"
105					return 0;
106			}
107		} else {
108			tmp = ep->name + strlen (ep->name);
109		}
110
111		/* direction-restriction:  "..in-..", "out-.." */
112		tmp--;
113		if (!isdigit (*tmp)) {
114			if (desc->bEndpointAddress & USB_DIR_IN) {
115				if ('n' != *tmp)
116					return 0;
117			} else {
118				if ('t' != *tmp)
119					return 0;
120			}
121		}
122	}
123
124	/*
125	 * Get the number of required streams from the EP companion
126	 * descriptor and see if the EP matches it
127	 */
128	if (usb_endpoint_xfer_bulk(desc)) {
129		if (ep_comp && gadget->max_speed >= USB_SPEED_SUPER) {
130			num_req_streams = ep_comp->bmAttributes & 0x1f;
131			if (num_req_streams > ep->max_streams)
132				return 0;
133		}
134
135	}
136
137	/*
138	 * If the protocol driver hasn't yet decided on wMaxPacketSize
139	 * and wants to know the maximum possible, provide the info.
140	 */
141	if (desc->wMaxPacketSize == 0)
142		desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket);
143
144	/* endpoint maxpacket size is an input parameter, except for bulk
145	 * where it's an output parameter representing the full speed limit.
146	 * the usb spec fixes high speed bulk maxpacket at 512 bytes.
147	 */
148	max = 0x7ff & usb_endpoint_maxp(desc);
149	switch (type) {
150	case USB_ENDPOINT_XFER_INT:
151		/* INT:  limit 64 bytes full speed, 1024 high/super speed */
152		if (!gadget_is_dualspeed(gadget) && max > 64)
153			return 0;
154		/* FALLTHROUGH */
155
156	case USB_ENDPOINT_XFER_ISOC:
157		/* ISO:  limit 1023 bytes full speed, 1024 high/super speed */
158		if (ep->maxpacket < max)
159			return 0;
160		if (!gadget_is_dualspeed(gadget) && max > 1023)
161			return 0;
162
163		/* BOTH:  "high bandwidth" works only at high speed */
164		if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) {
165			if (!gadget_is_dualspeed(gadget))
166				return 0;
167			/* configure your hardware with enough buffering!! */
168		}
169		break;
170	}
171
172	/* MATCH!! */
173
174	/* report address */
175	desc->bEndpointAddress &= USB_DIR_IN;
176	if (isdigit (ep->name [2])) {
177		u8	num = simple_strtoul (&ep->name [2], NULL, 10);
178		desc->bEndpointAddress |= num;
179#ifdef	MANY_ENDPOINTS
180	} else if (desc->bEndpointAddress & USB_DIR_IN) {
181		if (++in_epnum > 15)
182			return 0;
183		desc->bEndpointAddress = USB_DIR_IN | in_epnum;
184#endif
185	} else {
186		if (++epnum > 15)
187			return 0;
188		desc->bEndpointAddress |= epnum;
189	}
190
191	/* report (variable) full speed bulk maxpacket */
192	if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) {
193		int size = ep->maxpacket;
194
195		/* min() doesn't work on bitfields with gcc-3.5 */
196		if (size > 64)
197			size = 64;
198		desc->wMaxPacketSize = cpu_to_le16(size);
199	}
200	ep->address = desc->bEndpointAddress;
201	return 1;
202}
203
204static struct usb_ep *
205find_ep (struct usb_gadget *gadget, const char *name)
206{
207	struct usb_ep	*ep;
208
209	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
210		if (0 == strcmp (ep->name, name))
211			return ep;
212	}
213	return NULL;
214}
215
216/**
217 * usb_ep_autoconfig_ss() - choose an endpoint matching the ep
218 * descriptor and ep companion descriptor
219 * @gadget: The device to which the endpoint must belong.
220 * @desc: Endpoint descriptor, with endpoint direction and transfer mode
221 *    initialized.  For periodic transfers, the maximum packet
222 *    size must also be initialized.  This is modified on
223 *    success.
224 * @ep_comp: Endpoint companion descriptor, with the required
225 *    number of streams. Will be modified when the chosen EP
226 *    supports a different number of streams.
227 *
228 * This routine replaces the usb_ep_autoconfig when needed
229 * superspeed enhancments. If such enhancemnets are required,
230 * the FD should call usb_ep_autoconfig_ss directly and provide
231 * the additional ep_comp parameter.
232 *
233 * By choosing an endpoint to use with the specified descriptor,
234 * this routine simplifies writing gadget drivers that work with
235 * multiple USB device controllers.  The endpoint would be
236 * passed later to usb_ep_enable(), along with some descriptor.
237 *
238 * That second descriptor won't always be the same as the first one.
239 * For example, isochronous endpoints can be autoconfigured for high
240 * bandwidth, and then used in several lower bandwidth altsettings.
241 * Also, high and full speed descriptors will be different.
242 *
243 * Be sure to examine and test the results of autoconfiguration
244 * on your hardware.  This code may not make the best choices
245 * about how to use the USB controller, and it can't know all
246 * the restrictions that may apply. Some combinations of driver
247 * and hardware won't be able to autoconfigure.
248 *
249 * On success, this returns an un-claimed usb_ep, and modifies the endpoint
250 * descriptor bEndpointAddress.  For bulk endpoints, the wMaxPacket value
251 * is initialized as if the endpoint were used at full speed and
252 * the bmAttribute field in the ep companion descriptor is
253 * updated with the assigned number of streams if it is
254 * different from the original value. To prevent the endpoint
255 * from being returned by a later autoconfig call, claim it by
256 * assigning ep->driver_data to some non-null value.
257 *
258 * On failure, this returns a null endpoint descriptor.
259 */
260struct usb_ep *usb_ep_autoconfig_ss(
261	struct usb_gadget		*gadget,
262	struct usb_endpoint_descriptor	*desc,
263	struct usb_ss_ep_comp_descriptor *ep_comp
264)
265{
266	struct usb_ep	*ep;
267	u8		type;
268
269	type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
270
271	/* First, apply chip-specific "best usage" knowledge.
272	 * This might make a good usb_gadget_ops hook ...
273	 */
274	if (gadget_is_net2280 (gadget) && type == USB_ENDPOINT_XFER_INT) {
275		/* ep-e, ep-f are PIO with only 64 byte fifos */
276		ep = find_ep (gadget, "ep-e");
277		if (ep && ep_matches(gadget, ep, desc, ep_comp))
278			goto found_ep;
279		ep = find_ep (gadget, "ep-f");
280		if (ep && ep_matches(gadget, ep, desc, ep_comp))
281			goto found_ep;
282
283	} else if (gadget_is_goku (gadget)) {
284		if (USB_ENDPOINT_XFER_INT == type) {
285			/* single buffering is enough */
286			ep = find_ep(gadget, "ep3-bulk");
287			if (ep && ep_matches(gadget, ep, desc, ep_comp))
288				goto found_ep;
289		} else if (USB_ENDPOINT_XFER_BULK == type
290				&& (USB_DIR_IN & desc->bEndpointAddress)) {
291			/* DMA may be available */
292			ep = find_ep(gadget, "ep2-bulk");
293			if (ep && ep_matches(gadget, ep, desc,
294					      ep_comp))
295				goto found_ep;
296		}
297
298#ifdef CONFIG_BLACKFIN
299	} else if (gadget_is_musbhdrc(gadget)) {
300		if ((USB_ENDPOINT_XFER_BULK == type) ||
301		    (USB_ENDPOINT_XFER_ISOC == type)) {
302			if (USB_DIR_IN & desc->bEndpointAddress)
303				ep = find_ep (gadget, "ep5in");
304			else
305				ep = find_ep (gadget, "ep6out");
306		} else if (USB_ENDPOINT_XFER_INT == type) {
307			if (USB_DIR_IN & desc->bEndpointAddress)
308				ep = find_ep(gadget, "ep1in");
309			else
310				ep = find_ep(gadget, "ep2out");
311		} else
312			ep = NULL;
313		if (ep && ep_matches(gadget, ep, desc, ep_comp))
314			goto found_ep;
315#endif
316	}
317
318	/* Second, look at endpoints until an unclaimed one looks usable */
319	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
320		if (ep_matches(gadget, ep, desc, ep_comp))
321			goto found_ep;
322	}
323
324	/* Fail */
325	return NULL;
326found_ep:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327	ep->desc = NULL;
328	ep->comp_desc = NULL;
 
329	return ep;
330}
 
331
332/**
333 * usb_ep_autoconfig() - choose an endpoint matching the
334 * descriptor
335 * @gadget: The device to which the endpoint must belong.
336 * @desc: Endpoint descriptor, with endpoint direction and transfer mode
337 *	initialized.  For periodic transfers, the maximum packet
338 *	size must also be initialized.  This is modified on success.
339 *
340 * By choosing an endpoint to use with the specified descriptor, this
341 * routine simplifies writing gadget drivers that work with multiple
342 * USB device controllers.  The endpoint would be passed later to
343 * usb_ep_enable(), along with some descriptor.
344 *
345 * That second descriptor won't always be the same as the first one.
346 * For example, isochronous endpoints can be autoconfigured for high
347 * bandwidth, and then used in several lower bandwidth altsettings.
348 * Also, high and full speed descriptors will be different.
349 *
350 * Be sure to examine and test the results of autoconfiguration on your
351 * hardware.  This code may not make the best choices about how to use the
352 * USB controller, and it can't know all the restrictions that may apply.
353 * Some combinations of driver and hardware won't be able to autoconfigure.
354 *
355 * On success, this returns an un-claimed usb_ep, and modifies the endpoint
356 * descriptor bEndpointAddress.  For bulk endpoints, the wMaxPacket value
357 * is initialized as if the endpoint were used at full speed.  To prevent
358 * the endpoint from being returned by a later autoconfig call, claim it
359 * by assigning ep->driver_data to some non-null value.
360 *
361 * On failure, this returns a null endpoint descriptor.
362 */
363struct usb_ep *usb_ep_autoconfig(
364	struct usb_gadget		*gadget,
365	struct usb_endpoint_descriptor	*desc
366)
367{
368	return usb_ep_autoconfig_ss(gadget, desc, NULL);
369}
 
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
372/**
373 * usb_ep_autoconfig_reset - reset endpoint autoconfig state
374 * @gadget: device for which autoconfig state will be reset
375 *
376 * Use this for devices where one configuration may need to assign
377 * endpoint resources very differently from the next one.  It clears
378 * state such as ep->driver_data and the record of assigned endpoints
379 * used by usb_ep_autoconfig().
380 */
381void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
382{
383	struct usb_ep	*ep;
384
385	list_for_each_entry (ep, &gadget->ep_list, ep_list) {
 
386		ep->driver_data = NULL;
387	}
388#ifdef	MANY_ENDPOINTS
389	in_epnum = 0;
390#endif
391	epnum = 0;
392}
393