1/*****************************************************************************/ 2/* 3 * auerchain.h -- Auerswald PBX/System Telephone chained urb support. 4 * 5 * Copyright (C) 2002 Wolfgang Mües (wolfgang@iksw-muees.de) 6 * 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. 11 * 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. 16 * 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. 20 */ 21 /*****************************************************************************/ 22 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. 26 */ 27 28#ifndef AUERCHAIN_H 29#define AUERCHAIN_H 30 31#include <linux/usb.h> 32 33/* urb chain element */ 34struct auerchain; /* forward for circular reference */ 35struct 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 */ 41}; 42 43/* urb chain */ 44struct auerchain { 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 */ 49}; 50 51/* urb blocking completion helper struct */ 52struct auerchain_chs { 53 wait_queue_head_t wqh; /* wait for completion */ 54 unsigned int done; /* completion flag */ 55}; 56 57 58/* Function prototypes */ 59int auerchain_submit_urb_list(struct auerchain *acp, struct urb *urb, 60 int early); 61 62int auerchain_submit_urb(struct auerchain *acp, struct urb *urb); 63 64int auerchain_unlink_urb(struct auerchain *acp, struct urb *urb); 65 66void auerchain_unlink_all(struct auerchain *acp); 67 68void auerchain_free(struct auerchain *acp); 69 70void auerchain_init(struct auerchain *acp); 71 72int auerchain_setup(struct auerchain *acp, unsigned int numElements); 73 74int 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); 78 79#endif /* AUERCHAIN_H */ 80

