1 /*****************************************************************************/
3 * auerchain.h -- Auerswald PBX/System Telephone chained urb support.
5 * Copyright (C) 2002 Wolfgang Mües (wolfgang@iksw-muees.de)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /*****************************************************************************/
23 /* This module is used to make a FIFO of URBs, to serialize the submit.
24 * This may be used to serialize control messages, which is not supported
25 * by the Linux USB subsystem.
31 #include <linux/usb.h>
33 /* urb chain element */
34 struct auerchain; /* forward for circular reference */
35 struct auerchainelement {
36 struct auerchain *chain; /* pointer to the chain to which this element belongs */
37 struct urb *urbp; /* pointer to attached urb */
38 void *context; /* saved URB context */
39 usb_complete_t complete; /* saved URB completion function */
40 struct list_head list; /* to include element into a list */
45 struct auerchainelement *active;/* element which is submitted to urb */
46 spinlock_t lock; /* protection agains interrupts */
47 struct list_head waiting_list; /* list of waiting elements */
48 struct list_head free_list; /* list of available elements */
51 /* urb blocking completion helper struct */
52 struct auerchain_chs {
53 wait_queue_head_t wqh; /* wait for completion */
54 unsigned int done; /* completion flag */
58 /* Function prototypes */
59 int auerchain_submit_urb_list(struct auerchain *acp, struct urb *urb,
62 int auerchain_submit_urb(struct auerchain *acp, struct urb *urb);
64 int auerchain_unlink_urb(struct auerchain *acp, struct urb *urb);
66 void auerchain_unlink_all(struct auerchain *acp);
68 void auerchain_free(struct auerchain *acp);
70 void auerchain_init(struct auerchain *acp);
72 int auerchain_setup(struct auerchain *acp, unsigned int numElements);
74 int auerchain_control_msg(struct auerchain *acp, struct usb_device *dev,
75 unsigned int pipe, __u8 request,
76 __u8 requesttype, __u16 value, __u16 index,
77 void *data, __u16 size, int timeout);
79 #endif /* AUERCHAIN_H */