1 /*****************************************************************************/
3 * auerbuf.h -- Auerswald PBX/System Telephone urb list storage.
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 assembles together an URB, an usb_ctrlrequest struct for sending of
24 * control messages, and a data buffer.
25 * These items (auerbuf) are collected in a list (auerbufctl) and are used
26 * for serialized usb data transfer.
32 #include <linux/usb.h>
35 struct auerbufctl; /* forward */
37 unsigned char *bufp; /* reference to allocated data buffer */
38 unsigned int len; /* number of characters in data buffer */
39 unsigned int retries; /* for urb retries */
40 struct usb_ctrlrequest *dr; /* for setup data in control messages */
41 struct urb *urbp; /* USB urb */
42 struct auerbufctl *list; /* pointer to list */
43 struct list_head buff_list; /* reference to next buffer in list */
46 /* buffer list control block */
48 spinlock_t lock; /* protection in interrupt */
49 struct list_head free_buff_list;/* free buffers */
50 struct list_head rec_buff_list; /* buffers with received data */
53 /* Function prototypes */
54 void auerbuf_free(struct auerbuf *bp);
56 void auerbuf_free_list(struct list_head *q);
58 void auerbuf_init(struct auerbufctl *bcp);
60 void auerbuf_free_buffers(struct auerbufctl *bcp);
62 int auerbuf_setup(struct auerbufctl *bcp, unsigned int numElements,
63 unsigned int bufsize);
65 struct auerbuf *auerbuf_getbuf(struct auerbufctl *bcp);
67 void auerbuf_releasebuf(struct auerbuf *bp);
69 #endif /* AUERBUF_H */